summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
Diffstat (limited to 'basic')
-rw-r--r--basic/inc/basic/basicrt.hxx12
-rw-r--r--basic/inc/basic/basmgr.hxx73
-rw-r--r--basic/inc/basic/basrdll.hxx8
-rw-r--r--basic/inc/basic/modsizeexceeded.hxx (renamed from basic/inc/modsizeexceeded.hxx)0
-rw-r--r--basic/inc/basic/mybasic.hxx38
-rw-r--r--basic/inc/basic/process.hxx16
-rw-r--r--basic/inc/basic/sbdef.hxx1
-rw-r--r--basic/inc/basic/sberrors.hxx2
-rw-r--r--basic/inc/basic/sbmeth.hxx22
-rw-r--r--basic/inc/basic/sbmod.hxx73
-rw-r--r--basic/inc/basic/sbobjmod.hxx23
-rw-r--r--basic/inc/basic/sbprop.hxx2
-rw-r--r--basic/inc/basic/sbstar.hxx91
-rw-r--r--basic/inc/basic/sbstdobj.hxx60
-rw-r--r--basic/inc/basic/sbx.hxx109
-rw-r--r--basic/inc/basic/sbxbase.hxx5
-rw-r--r--basic/inc/basic/sbxcore.hxx104
-rw-r--r--basic/inc/basic/sbxdef.hxx481
-rw-r--r--basic/inc/basic/sbxfac.hxx8
-rw-r--r--basic/inc/basic/sbxform.hxx30
-rw-r--r--basic/inc/basic/sbxmeth.hxx2
-rw-r--r--basic/inc/basic/sbxmstrm.hxx2
-rw-r--r--basic/inc/basic/sbxobj.hxx23
-rw-r--r--basic/inc/basic/sbxvar.hxx397
-rwxr-xr-x[-rw-r--r--]basic/inc/basic/svtmsg.hrc (renamed from basic/inc/svtmsg.hrc)0
-rwxr-xr-x[-rw-r--r--]basic/inc/basic/testtool.hrc (renamed from basic/inc/testtool.hrc)0
-rw-r--r--basic/inc/basic/testtool.hxx16
-rwxr-xr-x[-rw-r--r--]basic/inc/basic/ttglobal.hrc0
-rwxr-xr-x[-rw-r--r--]basic/inc/basic/ttmsg.hrc (renamed from basic/inc/ttmsg.hrc)0
-rw-r--r--basic/inc/basic/ttstrhlp.hxx20
-rw-r--r--basic/inc/basic/vbahelper.hxx86
-rwxr-xr-x[-rw-r--r--]basic/inc/makefile.mk0
-rw-r--r--basic/inc/pch/precompiled_basic.hxx5
-rwxr-xr-x[-rw-r--r--]basic/inc/sb.hrc0
-rw-r--r--[-rwxr-xr-x]basic/prj/build.lst2
-rw-r--r--basic/prj/d.lst40
-rw-r--r--basic/source/app/app.cxx604
-rw-r--r--basic/source/app/app.hxx62
-rw-r--r--basic/source/app/appbased.cxx55
-rw-r--r--basic/source/app/appbased.hxx6
-rw-r--r--basic/source/app/appedit.cxx40
-rw-r--r--basic/source/app/appedit.hxx8
-rw-r--r--basic/source/app/apperror.cxx21
-rw-r--r--basic/source/app/apperror.hxx5
-rw-r--r--basic/source/app/appwin.cxx167
-rw-r--r--basic/source/app/appwin.hxx61
-rwxr-xr-x[-rw-r--r--]basic/source/app/basic.hrc0
-rw-r--r--basic/source/app/basic.src188
-rw-r--r--basic/source/app/basicrt.cxx10
-rwxr-xr-x[-rw-r--r--]basic/source/app/basmsg.hrc0
-rw-r--r--basic/source/app/basmsg.src2
-rw-r--r--basic/source/app/brkpnts.cxx168
-rw-r--r--basic/source/app/brkpnts.hxx58
-rw-r--r--basic/source/app/dataedit.hxx24
-rw-r--r--basic/source/app/dialogs.cxx201
-rw-r--r--basic/source/app/dialogs.hxx25
-rwxr-xr-x[-rw-r--r--]basic/source/app/makefile.mk0
-rw-r--r--basic/source/app/msgedit.cxx240
-rw-r--r--basic/source/app/msgedit.hxx27
-rw-r--r--basic/source/app/mybasic.cxx103
-rw-r--r--basic/source/app/printer.cxx4
-rw-r--r--basic/source/app/process.cxx59
-rw-r--r--basic/source/app/processw.cxx42
-rw-r--r--basic/source/app/processw.hxx16
-rwxr-xr-x[-rw-r--r--]basic/source/app/resids.hrc0
-rw-r--r--basic/source/app/status.cxx14
-rw-r--r--basic/source/app/svtmsg.src4
-rw-r--r--basic/source/app/testtool.src4
-rw-r--r--basic/source/app/textedit.cxx204
-rw-r--r--basic/source/app/textedit.hxx31
-rw-r--r--basic/source/app/ttmsg.src22
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx72
-rw-r--r--basic/source/basmgr/basmgr.cxx623
-rwxr-xr-x[-rw-r--r--]basic/source/basmgr/makefile.mk3
-rw-r--r--basic/source/basmgr/vbahelper.cxx212
-rw-r--r--basic/source/classes/disas.cxx100
-rw-r--r--basic/source/classes/errobject.cxx2
-rw-r--r--basic/source/classes/eventatt.cxx58
-rw-r--r--basic/source/classes/image.cxx161
-rwxr-xr-x[-rw-r--r--]basic/source/classes/makefile.mk0
-rw-r--r--basic/source/classes/propacc.cxx28
-rw-r--r--basic/source/classes/sb.cxx641
-rw-r--r--basic/source/classes/sb.src58
-rw-r--r--basic/source/classes/sbintern.cxx8
-rw-r--r--basic/source/classes/sbunoobj.cxx822
-rw-r--r--basic/source/classes/sbxmod.cxx689
-rw-r--r--basic/source/comp/buffer.cxx126
-rw-r--r--basic/source/comp/codegen.cxx141
-rw-r--r--basic/source/comp/dim.cxx320
-rw-r--r--basic/source/comp/exprgen.cxx54
-rw-r--r--basic/source/comp/exprnode.cxx120
-rw-r--r--basic/source/comp/exprtree.cxx239
-rw-r--r--basic/source/comp/io.cxx42
-rw-r--r--basic/source/comp/loops.cxx73
-rwxr-xr-x[-rw-r--r--]basic/source/comp/makefile.mk0
-rw-r--r--basic/source/comp/parser.cxx78
-rw-r--r--basic/source/comp/sbcomp.cxx492
-rw-r--r--basic/source/comp/scanner.cxx129
-rw-r--r--basic/source/comp/symtbl.cxx53
-rw-r--r--basic/source/comp/token.cxx204
-rw-r--r--basic/source/inc/buffer.hxx30
-rw-r--r--basic/source/inc/codegen.hxx28
-rw-r--r--basic/source/inc/disas.hxx14
-rw-r--r--basic/source/inc/expr.hxx90
-rw-r--r--basic/source/inc/filefmt.hxx109
-rw-r--r--basic/source/inc/image.hxx45
-rw-r--r--basic/source/inc/iosys.hxx12
-rw-r--r--basic/source/inc/namecont.hxx7
-rw-r--r--basic/source/inc/object.hxx14
-rw-r--r--basic/source/inc/opcodes.hxx4
-rw-r--r--basic/source/inc/parser.hxx46
-rw-r--r--basic/source/inc/propacc.hxx6
-rw-r--r--basic/source/inc/runtime.hxx185
-rw-r--r--basic/source/inc/sbdiagnose.hxx (renamed from basic/workben/basmgr.src)17
-rw-r--r--basic/source/inc/sbintern.hxx12
-rw-r--r--basic/source/inc/sbjsmod.hxx4
-rw-r--r--basic/source/inc/sbtrace.hxx7
-rw-r--r--basic/source/inc/sbunoobj.hxx55
-rw-r--r--basic/source/inc/scanner.hxx54
-rw-r--r--basic/source/inc/scriptcont.hxx3
-rw-r--r--basic/source/inc/stdobj.hxx2
-rw-r--r--basic/source/inc/symtbl.hxx139
-rw-r--r--basic/source/inc/token.hxx32
-rw-r--r--basic/source/runtime/basrdll.cxx14
-rw-r--r--basic/source/runtime/comenumwrapper.cxx81
-rw-r--r--basic/source/runtime/comenumwrapper.hxx54
-rw-r--r--basic/source/runtime/ddectrl.cxx32
-rw-r--r--basic/source/runtime/ddectrl.hxx12
-rw-r--r--basic/source/runtime/dllmgr-none.cxx68
-rw-r--r--basic/source/runtime/dllmgr-x64.cxx776
-rw-r--r--basic/source/runtime/dllmgr-x86.cxx (renamed from basic/source/runtime/dllmgr.cxx)71
-rw-r--r--basic/source/runtime/inputbox.cxx5
-rw-r--r--basic/source/runtime/iosys.cxx199
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/makefile.mk25
-rw-r--r--basic/source/runtime/methods.cxx775
-rw-r--r--basic/source/runtime/methods1.cxx570
-rw-r--r--basic/source/runtime/props.cxx13
-rw-r--r--basic/source/runtime/rtlproto.hxx11
-rw-r--r--basic/source/runtime/runtime.cxx164
-rw-r--r--basic/source/runtime/sbdiagnose.cxx134
-rw-r--r--basic/source/runtime/stdobj.cxx143
-rw-r--r--basic/source/runtime/stdobj1.cxx128
-rw-r--r--basic/source/runtime/step0.cxx239
-rw-r--r--basic/source/runtime/step1.cxx90
-rw-r--r--basic/source/runtime/step2.cxx267
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/wnt-mingw.s0
-rw-r--r--basic/source/runtime/wnt-x86.asm (renamed from basic/source/runtime/wnt.asm)0
-rw-r--r--basic/source/sample/collelem.cxx2
-rwxr-xr-x[-rw-r--r--]basic/source/sample/makefile.mk0
-rw-r--r--basic/source/sample/object.cxx37
-rwxr-xr-x[-rw-r--r--]basic/source/sbx/makefile.mk3
-rw-r--r--basic/source/sbx/sbxarray.cxx181
-rw-r--r--basic/source/sbx/sbxbase.cxx121
-rw-r--r--basic/source/sbx/sbxbool.cxx60
-rw-r--r--basic/source/sbx/sbxbyte.cxx69
-rw-r--r--basic/source/sbx/sbxchar.cxx53
-rw-r--r--basic/source/sbx/sbxcoll.cxx32
-rw-r--r--basic/source/sbx/sbxconv.hxx75
-rw-r--r--basic/source/sbx/sbxcurr.cxx525
-rw-r--r--basic/source/sbx/sbxdate.cxx40
-rw-r--r--basic/source/sbx/sbxdbl.cxx31
-rw-r--r--basic/source/sbx/sbxdec.cxx153
-rw-r--r--basic/source/sbx/sbxdec.hxx30
-rw-r--r--basic/source/sbx/sbxexec.cxx28
-rw-r--r--basic/source/sbx/sbxform.cxx200
-rw-r--r--basic/source/sbx/sbxint.cxx215
-rw-r--r--basic/source/sbx/sbxlng.cxx82
-rw-r--r--basic/source/sbx/sbxobj.cxx347
-rw-r--r--basic/source/sbx/sbxres.cxx4
-rw-r--r--basic/source/sbx/sbxres.hxx4
-rw-r--r--basic/source/sbx/sbxscan.cxx141
-rw-r--r--basic/source/sbx/sbxsng.cxx53
-rw-r--r--basic/source/sbx/sbxstr.cxx42
-rw-r--r--basic/source/sbx/sbxuint.cxx71
-rw-r--r--basic/source/sbx/sbxulng.cxx59
-rw-r--r--basic/source/sbx/sbxvals.cxx37
-rw-r--r--basic/source/sbx/sbxvalue.cxx704
-rw-r--r--basic/source/sbx/sbxvar.cxx128
-rw-r--r--basic/source/uno/dlgcont.cxx105
-rwxr-xr-x[-rw-r--r--]basic/source/uno/makefile.mk0
-rw-r--r--basic/source/uno/modsizeexceeded.cxx19
-rw-r--r--basic/source/uno/namecont.cxx201
-rw-r--r--basic/source/uno/scriptcont.cxx110
-rwxr-xr-x[-rw-r--r--]basic/util/makefile.mk10
-rwxr-xr-xbasic/util/sb.component39
-rw-r--r--basic/workben/makefile.mk89
-rw-r--r--basic/workben/mgrtest.cxx69
187 files changed, 9755 insertions, 8974 deletions
diff --git a/basic/inc/basic/basicrt.hxx b/basic/inc/basic/basicrt.hxx
index 5366d9bf10..2e9a9d4d4a 100644
--- 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 6b3a024ec4..9d7b44f486 100644
--- a/basic/inc/basic/basmgr.hxx
+++ b/basic/inc/basic/basmgr.hxx
@@ -25,7 +25,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-//
#ifndef _BASMGR_HXX
#define _BASMGR_HXX
@@ -69,26 +68,25 @@ 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; }
};
-//
class BasicLibs;
class ErrorManager;
@@ -147,33 +145,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 +188,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 +207,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 +236,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 c8a59a32fa..abf7ec99e2 100644
--- 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/modsizeexceeded.hxx b/basic/inc/basic/modsizeexceeded.hxx
index 6e290b82a9..6e290b82a9 100644
--- 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 4a32e04a0b..6b9189bd31 100644
--- a/basic/inc/basic/mybasic.hxx
+++ b/basic/inc/basic/mybasic.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -30,32 +30,35 @@
#define _MYBASIC_HXX
#include <basic/sbstar.hxx>
+#include <vector>
class BasicApp;
class AppBasEd;
class ErrorEntry;
+#define SBXID_MYBASIC 0x594D // MyBasic: MY
+#define SBXCR_TEST 0x54534554 // TEST
+
+//-----------------------------------------------------------------------------
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();
};
-DECLARE_LIST( ErrorList, BasicError* )
-
-#define SBXID_MYBASIC 0x594D // MyBasic: MY
-#define SBXCR_TEST 0x54534554 // TEST
-
+//-----------------------------------------------------------------------------
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;
+ size_t CurrentError;
Link GenLogHdl();
Link GenWinInfoHdl();
Link GenModuleWinExistsHdl();
@@ -68,23 +71,26 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_TEST,SBXID_MYBASIC,1);
TYPEINFO();
- ErrorList aErrors;
MyBasic();
virtual ~MyBasic();
- virtual BOOL Compile( SbModule* );
+ virtual sal_Bool Compile( SbModule* );
void Reset();
SbError GetErrors() { return nError; }
+ size_t GetCurrentError() { return CurrentError; }
+ BasicError* FirstError();
+ BasicError* NextError();
+ BasicError* PrevError();
- // Do not use #ifdefs here because this header file is both used for testtool and basic
+ // Do not use #ifdefs here because this header file is both used for testtool and basic
SbxObject *pTestObject; // for Testool; otherwise NULL
virtual void LoadIniFile();
- // Determines the extended symbol type for syntax highlighting
- virtual SbTextType GetSymbolType( const String &Symbol, BOOL bWasTTControl );
+ // Determines the extended symbol type for syntax highlighting
+ 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 68f3147ac6..7143493247 100644
--- 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 03ae7c4dfe..faa9ae4614 100644
--- a/basic/inc/basic/sbdef.hxx
+++ b/basic/inc/basic/sbdef.hxx
@@ -99,7 +99,6 @@ void setBasicWatchMode( bool bOn );
#define SBX_HINT_BASICSTART SFX_HINT_USER04
#define SBX_HINT_BASICSTOP SFX_HINT_USER05
-// #115826
enum PropertyMode
{
PROPERTY_MODE_NONE,
diff --git a/basic/inc/basic/sberrors.hxx b/basic/inc/basic/sberrors.hxx
index 1a7d630f66..c77c783f94 100644
--- 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 defc2c6418..bb890ace22 100644
--- 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 678da36487..05a1930c65 100644
--- 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 2e77d32a43..af602191cd 100644
--- a/basic/inc/basic/sbobjmod.hxx
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -3,12 +3,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: sbobjmod.hxx,v $
- *
- * $Revision: 1.4 $
- *
- * last change: $Author: $ $Date: 2007/08/27 16:31:39 $
- *
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
@@ -53,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 ) ;
@@ -82,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& );
@@ -94,6 +96,11 @@ public:
void triggerLayoutEvent();
void triggerResizeEvent();
+ bool getInitState( void )
+ { return mbInit; }
+ void setInitState( bool bInit )
+ { mbInit = bInit; }
+
class SbUserFormModuleInstance* CreateInstance();
};
@@ -105,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 e2920dffb0..db000f406c 100644
--- 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 a40ac39433..e94e193ca1 100644
--- 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 3ae022073c..ddff393c59 100644
--- 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/sbx.hxx b/basic/inc/basic/sbx.hxx
index 54450c623a..570debb48b 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -33,14 +33,13 @@
#include "svl/svarray.hxx"
#include "svl/smplhint.hxx"
#include "svl/lstner.hxx"
+
#include <basic/sbxdef.hxx>
#include <basic/sbxform.hxx>
-
#include <basic/sbxobj.hxx>
#include <basic/sbxprop.hxx>
#include <basic/sbxmeth.hxx>
-class BigInt;
class String;
class UniString;
class SvStream;
@@ -52,15 +51,11 @@ class SbxObject;
class SbxArray;
class SbxDimArray;
class SbxFactory;
-struct SbxINT64;
-struct SbxUINT64;
class SfxBroadcaster;
class SvDispatch;
-///////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
#ifndef __SBX_SBXPARAMINFO
#define __SBX_SBXPARAMINFO
@@ -71,9 +66,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() {}
};
@@ -92,27 +87,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
@@ -125,7 +120,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; }
};
@@ -139,7 +134,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:
@@ -168,7 +163,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
@@ -176,8 +171,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);
@@ -186,28 +181,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
@@ -226,15 +221,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);
@@ -256,17 +251,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; };
};
@@ -281,7 +276,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?):
@@ -295,7 +290,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();
};
@@ -309,17 +304,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 2925f99b17..abf2f77895 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -30,7 +30,6 @@
#define _SBXBASE_HXX
#include <i18npool/lang.h>
-#include "tools/list.hxx"
#include "svl/svarray.hxx"
#include <basic/sbxdef.hxx>
@@ -39,14 +38,12 @@ class SbxVariable;
class SbxBasicFormater;
SV_DECL_PTRARR_DEL(SbxFacs,SbxFactory*,5,5)
-DECLARE_LIST(SbxVarList_Impl, SbxVariable*)
// AppData-Struktur for SBX:
struct SbxAppData
{
SbxError eSbxError; // Error code
SbxFacs aFacs; // Factories
- SbxVarList_Impl aVars; // for Dump
SbxBasicFormater *pBasicFormater; // Pointer to Format()-Command helper class
LanguageType eBasicFormaterLangType;
diff --git a/basic/inc/basic/sbxcore.hxx b/basic/inc/basic/sbxcore.hxx
index 5f37de70c2..7290480967 100644
--- 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 e5881ab5c2..e40ad07917 100644
--- a/basic/inc/basic/sbxdef.hxx
+++ b/basic/inc/basic/sbxdef.hxx
@@ -38,14 +38,14 @@
#ifndef _SBX_CLASS_TYPE
#define _SBX_CLASS_TYPE
-enum SbxClassType { // SBX-class-IDs (order is important!)
- SbxCLASS_DONTCARE = 1, // don't care (search, not 0 due to StarBASIC)
- SbxCLASS_ARRAY, // Array of SbxVariables
- SbxCLASS_VALUE, // simple value
- SbxCLASS_VARIABLE, // Variable (from here there is Broadcaster)
- SbxCLASS_METHOD, // Method (Function or Sub)
- SbxCLASS_PROPERTY, // Property
- SbxCLASS_OBJECT // Object
+enum SbxClassType { // SBX-class-IDs (order is important!)
+ SbxCLASS_DONTCARE = 1, // don't care (search, not 0 due to StarBASIC)
+ SbxCLASS_ARRAY, // Array of SbxVariables
+ SbxCLASS_VALUE, // simple value
+ SbxCLASS_VARIABLE, // Variable (from here there is Broadcaster)
+ SbxCLASS_METHOD, // Method (Function or Sub)
+ SbxCLASS_PROPERTY, // Property
+ SbxCLASS_OBJECT // Object
};
#endif
@@ -54,90 +54,100 @@ enum SbxClassType { // SBX-class-IDs (order is important!)
#define _SBX_DATA_TYPE
enum SbxDataType {
- SbxEMPTY = 0, // * Uninitialized
- SbxNULL = 1, // * Contains no valid data
- SbxINTEGER = 2, // * Integer (INT16)
- SbxLONG = 3, // * Long integer (INT32)
- SbxSINGLE = 4, // * Single-precision floating point number (float)
- SbxDOUBLE = 5, // * Double-precision floating point number (double)
- SbxCURRENCY = 6, // Currency (INT64)
- SbxDATE = 7, // * Date (double)
- SbxSTRING = 8, // * String (StarView)
- SbxOBJECT = 9, // * SbxBase object pointer
- SbxERROR = 10, // * Error (UINT16)
- SbxBOOL = 11, // * Boolean (0 or -1)
- SbxVARIANT = 12, // * Display for variant datatype
- SbxDATAOBJECT = 13, // * Common data object w/o ref count
-
- SbxCHAR = 16, // * signed char
- SbxBYTE = 17, // * unsigned char
- SbxUSHORT = 18, // * unsigned short (UINT16)
- SbxULONG = 19, // * unsigned long (UINT32)
- SbxLONG64 = 20, // signed 64-bit int
- SbxULONG64 = 21, // unsigned 64-bit int
- SbxINT = 22, // * signed machine-dependent int
- SbxUINT = 23, // * unsigned machine-dependent int
- SbxVOID = 24, // * no value (= SbxEMPTY)
- SbxHRESULT = 25, // HRESULT
- SbxPOINTER = 26, // generic pointer
- SbxDIMARRAY = 27, // dimensioned array
- SbxCARRAY = 28, // C style array
- SbxUSERDEF = 29, // user defined
- SbxLPSTR = 30, // * null terminated string
- SbxLPWSTR = 31, // wide null terminated string
- SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting
- SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
- SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
- SbxSALINT64 = 35, // for UNO hyper
- SbxSALUINT64 = 36, // for UNO unsigned hyper
- SbxDECIMAL = 37, // for UNO/automation Decimal
-
- SbxVECTOR = 0x1000, // simple counted array
- SbxARRAY = 0x2000, // array
- SbxBYREF = 0x4000, // access by reference
-
- SbxSV1 = 128, // first defined data type for StarView
- SbxMEMORYSTREAM, // SvMemoryStream
- SbxSTORAGE, // SvStorage
-
- SbxUSER1 = 256, // first user defined data type
- SbxUSERn = 2047 // last user defined data type
+ SbxEMPTY = 0, // * Uninitialized
+ SbxNULL = 1, // * Contains no valid data
+ 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 (sal_Int64)
+ SbxDATE = 7, // * Date (double)
+ SbxSTRING = 8, // * String (StarView)
+ SbxOBJECT = 9, // * SbxBase object pointer
+ SbxERROR = 10, // * Error (sal_uInt16)
+ SbxBOOL = 11, // * Boolean (0 or -1)
+
+ SbxVARIANT = 12, // * Display for variant datatype
+ SbxDATAOBJECT = 13, // * Common data object w/o ref count
+
+ SbxCHAR = 16, // * signed char
+ SbxBYTE = 17, // * unsigned char
+ 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
+ SbxULONG64 = 21, // moved to SbxSALUINT64 as 64bit int
+
+ SbxINT = 22, // * signed machine-dependent int
+ SbxUINT = 23, // * unsigned machine-dependent int
+
+ SbxVOID = 24, // * no value (= SbxEMPTY)
+ SbxHRESULT = 25, // HRESULT
+ SbxPOINTER = 26, // generic pointer
+ SbxDIMARRAY = 27, // dimensioned array
+ SbxCARRAY = 28, // C style array
+ SbxUSERDEF = 29, // user defined
+ SbxLPSTR = 30, // * null terminated string
+
+ SbxLPWSTR = 31, // wide null terminated string
+ SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting<
+
+ SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper
+ SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper
+ SbxDECIMAL = 37, // for UNO/automation Decimal
+
+ SbxVECTOR = 0x1000, // simple counted array
+ SbxARRAY = 0x2000, // array
+ SbxBYREF = 0x4000, // access by reference
+
+ SbxSV1 = 128, // first defined data type for StarView
+ SbxMEMORYSTREAM, // SvMemoryStream
+ SbxSTORAGE, // SvStorage
+
+ SbxUSER1 = 256, // first user defined data type
+ 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
#define _SBX_OPERATOR
enum SbxOperator {
- // Arithmetical:
- SbxEXP, // this ^ var
- SbxMUL, // this * var
- SbxDIV, // this / var
- SbxMOD, // this MOD var
- SbxPLUS, // this + var
- SbxMINUS, // this - var
- SbxNEG, // -this (var is ignored)
- SbxIDIV, // this / var (both operands max. INT32!)
- // Boolean operators (max INT32!):
- SbxAND, // this & var
- SbxOR, // this | var
- SbxXOR, // this ^ var
- SbxEQV, // ~this ^ var
- SbxIMP, // ~this | var
- SbxNOT, // ~this (var is ignored)
- // String-concat:
- SbxCAT, // this & var
- // Comparisons:
- SbxEQ, // this = var
- SbxNE, // this <> var
- SbxLT, // this < var
- SbxGT, // this > var
- SbxLE, // this <= var
- SbxGE // this >= var
+ // Arithmetical:
+ SbxEXP, // this ^ var
+ SbxMUL, // this * var
+ SbxDIV, // this / var
+ SbxMOD, // this MOD var (max INT32!)
+ SbxPLUS, // this + var
+ SbxMINUS, // this - var
+ SbxNEG, // -this (var is ignored)
+ 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
+ SbxXOR, // this ^ var
+ SbxEQV, // ~this ^ var
+ SbxIMP, // ~this | var
+ SbxNOT, // ~this (var is ignored)
+
+ // String concatenation:
+ SbxCAT, // this & var (VBA: this + var)
+
+ // Comparisons:
+ SbxEQ, // this = var
+ SbxNE, // this <> var
+ SbxLT, // this < var
+ SbxGT, // this > var
+ SbxLE, // this <= var
+ SbxGE // this >= var
};
#endif
@@ -145,204 +155,181 @@ enum SbxOperator {
#ifndef _SBX_NAME_TYPE
#define _SBX_NAME_TYPE
-enum SbxNameType { // Type of the questioned name of a variable
- SbxNAME_NONE, // plain name
- SbxNAME_SHORT, // Name(A,B)
- SbxNAME_SHORT_TYPES, // Name%(A%,B$)
- SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer
+enum SbxNameType { // Type of the questioned name of a variable
+ SbxNAME_NONE, // plain name
+ SbxNAME_SHORT, // Name(A,B)
+ SbxNAME_SHORT_TYPES, // Name%(A%,B$)
+ SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer
};
#endif
// from 1996/3/20: New error messages
-typedef ULONG SbxError; // Preserve old type
+typedef sal_uIntPtr SbxError; // Preserve old type
#endif
-// von #ifndef __RSC
// New error codes per define
-#define ERRCODE_SBX_OK ERRCODE_NONE // processed
-#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_COMPILER) // Syntaxerror in parser (where else could syntax errors happen? ;-)
-#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_NOTSUPPORTED) // not possible
-#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_SBX) // overflow
-#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_SBX) // Invalid array index
-#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_SBX) // Division by zero
-#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_SBX) // wrong data type
-#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // invalid Parameter
-#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // BASIC-Sub or Function undefined
-#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_UNKNOWN) // other object-related error
-#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Object variable unassigned
-#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_CREATE) // Object cannot be loaded or initialized
-#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_SBX) // Invalid object index
-#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_ACCESS) // Object is not activated
-#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Bad property value
-#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_READ) // Property is read only
-#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_WRITE) // Property is write only
-#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_ACCESS) // Invalid object reference
-#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt
-#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_ACCESS) // Invalid object usage
-#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_ACCESS) // No OLE-Object
-#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Method not supported
-#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // OLE Automation Error
-#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_NOTSUPPORTED) // Action not supported
-#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // No named arguments
-#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_NOTSUPPORTED) // Locale settings not supported
-#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Unknown named argument
-#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Argument not optional
-#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_SBX) // Invalid number of arguments
-#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_RUNTIME) // Object contains no elements
-#define LAST_SBX_ERROR_ID 29UL
-
-
-// Less important for resources
+#define ERRCODE_SBX_OK ERRCODE_NONE // processed
+
+#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER)
+#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED)
+#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow
+#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index
+#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero
+#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type
+#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter
+#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def
+#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error
+#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object
+#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail
+#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index
+#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active
+#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value
+#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only
+#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only
+#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference
+#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt
+#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage
+#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object
+#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported
+#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error
+#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported
+#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments
+#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported
+#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument
+#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional
+#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments
+#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements
+#define LAST_SBX_ERROR_ID 29UL
+
#ifndef __RSC
// Map old codes to new ones
-#define SbxERR_OK ERRCODE_SBX_OK
-#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX
-#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP
-#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW
-#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS
-#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV
-#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION
-#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER
-#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED
-#define SbxERR_ERROR ERRCODE_SBX_ERROR
-#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT
-#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD
-#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX
-#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT
-#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE
-#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY
-#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY
-#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT
-#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD
-#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT
-#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE
-#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD
-#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR
-#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION
-#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS
-#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE
-#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND
-#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL
-#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS
-#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL
+#define SbxERR_OK ERRCODE_SBX_OK
+#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX
+#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP
+#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW
+#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS
+#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV
+#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION
+#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER
+#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED
+#define SbxERR_ERROR ERRCODE_SBX_ERROR
+#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT
+#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD
+#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX
+#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT
+#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE
+#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY
+#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY
+#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT
+#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD
+#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT
+#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE
+#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD
+#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR
+#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION
+#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS
+#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE
+#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND
+#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL
+#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS
+#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL
// Flag-Bits:
-#define SBX_READ 0x0001 // Read permission
-#define SBX_WRITE 0x0002 // Write permission
-#define SBX_READWRITE 0x0003 // Read/Write permission
-#define SBX_DONTSTORE 0x0004 // Don't store object
-#define SBX_MODIFIED 0x0008 // Object was changed
-#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable)
-#define SBX_CONST 0x0020 // Definition of const value
-#define SBX_OPTIONAL 0x0040 // Parameter is optional
-#define SBX_HIDDEN 0x0080 // Element is invisible
-#define SBX_INVISIBLE 0x0100 // Element is not found by Find()
-#define SBX_EXTSEARCH 0x0200 // Object is searched completely
-#define SBX_EXTFOUND 0x0400 // Variable was found through extended search
-#define SBX_GBLSEARCH 0x0800 // Global search via Parents
-#define SBX_RESERVED 0x1000 // reserved
-#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED
-#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
-#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_READ 0x0001 // Read permission
+#define SBX_WRITE 0x0002 // Write permission
+#define SBX_READWRITE 0x0003 // Read/Write permission
+#define SBX_DONTSTORE 0x0004 // Don't store object
+#define SBX_MODIFIED 0x0008 // Object was changed
+#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable)
+#define SBX_CONST 0x0020 // Definition of const value
+#define SBX_OPTIONAL 0x0040 // Parameter is optional
+#define SBX_HIDDEN 0x0080 // Element is invisible
+#define SBX_INVISIBLE 0x0100 // Element is not found by Find()
+#define SBX_EXTSEARCH 0x0200 // Object is searched completely
+#define SBX_EXTFOUND 0x0400 // Variable was found through extended search
+#define SBX_GBLSEARCH 0x0800 // Global search via Parents
+#define SBX_RESERVED 0x1000 // reserved
+#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED
+#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
+#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
-#define SBX_HINT_DATAWANTED SFX_HINT_USER00
-#define SBX_HINT_DATACHANGED SFX_HINT_DATACHANGED
-#define SBX_HINT_CONVERTED SFX_HINT_USER01
-#define SBX_HINT_INFOWANTED SFX_HINT_USER02
-#define SBX_HINT_OBJECTCHANGED SFX_HINT_USER03
+#define SBX_HINT_DYING SFX_HINT_DYING
+#define SBX_HINT_DATAWANTED SFX_HINT_USER00
+#define SBX_HINT_DATACHANGED SFX_HINT_DATACHANGED
+#define SBX_HINT_CONVERTED SFX_HINT_USER01
+#define SBX_HINT_INFOWANTED SFX_HINT_USER02
+#define SBX_HINT_OBJECTCHANGED SFX_HINT_USER03
// List of all creators for Load/Store
-#define SBXCR_SBX 0x20584253 // SBX(blank)
+#define SBXCR_SBX 0x20584253 // SBX(blank)
// List of predefined SBX-IDs. New SBX-IDs must be precisly defined so that
// they are unique within the Stream and appropriate Factory.
-#define SBXID_VALUE 0x4E4E // NN: SbxValue
-#define SBXID_VARIABLE 0x4156 // VA: SbxVariable
-#define SBXID_ARRAY 0x5241 // AR: SbxArray
-#define SBXID_DIMARRAY 0x4944 // DI: SbxDimArray
-#define SBXID_OBJECT 0x424F // OB: SbxObject
-#define SBXID_COLLECTION 0x4F43 // CO: SbxCollection
-#define SBXID_FIXCOLLECTION 0x4346 // FC: SbxStdCollection
-#define SBXID_METHOD 0x454D // ME: SbxMethod
-#define SBXID_PROPERTY 0x5250 // PR: SbxProperty
+#define SBXID_VALUE 0x4E4E // NN: SbxValue
+#define SBXID_VARIABLE 0x4156 // VA: SbxVariable
+#define SBXID_ARRAY 0x5241 // AR: SbxArray
+#define SBXID_DIMARRAY 0x4944 // DI: SbxDimArray
+#define SBXID_OBJECT 0x424F // OB: SbxObject
+#define SBXID_COLLECTION 0x4F43 // CO: SbxCollection
+#define SBXID_FIXCOLLECTION 0x4346 // FC: SbxStdCollection
+#define SBXID_METHOD 0x454D // ME: SbxMethod
+#define SBXID_PROPERTY 0x5250 // PR: SbxProperty
// StarBASIC restricts the base data type to different intervals.
-// These intervals are fixed due to portability and independent
+// These intervals are fixed to create 'portability and independent
// of the implementation. Only type double is greedy and takes
// what it gets.
-#define SbxMAXCHAR ((sal_Unicode)65535)
-#define SbxMINCHAR (0)
-#define SbxMAXBYTE ( 255)
-#define SbxMAXINT ( 32767)
-#define SbxMININT (-32768)
-#define SbxMAXUINT ((UINT16) 65535)
-#define SbxMAXLNG ( 2147483647)
-#define SbxMINLNG ((INT32)(-2147483647-1))
-#define SbxMAXULNG ((UINT32) 0xffffffff)
-
-#define SbxMAXSALINT64 SAL_MAX_INT64
-#define SbxMINSALINT64 SAL_MIN_INT64
-#define SbxMAXSALUINT64 SAL_MAX_UINT64
-
-#define SbxMAXSNG ( 3.402823e+38)
-#define SbxMINSNG (-3.402823e+38)
-#define SbxMAXSNG2 ( 1.175494351e-38)
-#define SbxMINSNG2 (-1.175494351e-38)
-#define SbxMAXCURR ( 922337203685477.5807)
-#define SbxMINCURR (-922337203685477.5808)
-#define CURRENCY_FACTOR 10000
-#define SbxMAXCURRLNG (SbxMAXLNG/CURRENCY_FACTOR)
-#define SbxMINCURRLNG (SbxMINLNG/CURRENCY_FACTOR)
+#define SbxMAXCHAR ((sal_Unicode)65535)
+#define SbxMINCHAR (0)
+#define SbxMAXBYTE ( 255)
+#define SbxMAXINT ( 32767)
+#define SbxMININT (-32768)
+#define SbxMAXUINT ((sal_uInt16) 65535)
+#define SbxMAXLNG ( 2147483647)
+#define SbxMINLNG ((sal_Int32)(-2147483647-1))
+#define SbxMAXULNG ((sal_uInt32) 0xffffffff)
+
+#define SbxMAXSALUINT64 SAL_MAX_UINT64
+#define SbxMAXSALINT64 SAL_MAX_INT64
+#define SbxMINSALINT64 SAL_MIN_INT64
+
+ // Currency stored as SbxSALINT64 == sal_Int64
+ // value range limits are ~(2^63 - 1)/10000
+ // fixed precision has 4 digits right of decimal pt
+#define CURRENCY_FACTOR (10000)
+#define CURRENCY_FACTOR_SQUARE (100000000)
+
+// TODO effective MAX/MINCURR limits:
+// true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double
+#define SbxMAXCURR ( 922337203685477.5807)
+#define SbxMINCURR (-922337203685477.5808)
+
+#define SbxMAXSNG ( 3.402823e+38)
+#define SbxMINSNG (-3.402823e+38)
+#define SbxMAXSNG2 ( 1.175494351e-38)
+#define SbxMINSNG2 (-1.175494351e-38)
// Max valid offset index of a Sbx-Array (due to 64K limit)
-#define SBX_MAXINDEX 0x3FF0
-#define SBX_MAXINDEX32 SbxMAXLNG
+#define SBX_MAXINDEX 0x3FF0
+#define SBX_MAXINDEX32 SbxMAXLNG
-// The numeric values of TRUE and FALSE
+// The numeric values of sal_True and FALSE
enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 };
-#endif // __RSC
+#endif //ifndef __RSC
#endif
diff --git a/basic/inc/basic/sbxfac.hxx b/basic/inc/basic/sbxfac.hxx
index bb58cf2d76..c7deb7559f 100644
--- 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 e1d25b979f..d607842b3e 100644
--- a/basic/inc/basic/sbxform.hxx
+++ b/basic/inc/basic/sbxform.hxx
@@ -112,16 +112,14 @@ 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 +127,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 875627f233..e054e15a64 100644
--- 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 dfee8ecade..c5a6bd54f5 100644
--- 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 cdcced040b..a361b07b0f 100644
--- a/basic/inc/basic/sbxobj.hxx
+++ b/basic/inc/basic/sbxobj.hxx
@@ -32,7 +32,6 @@
#include <svl/lstner.hxx>
#include <basic/sbxvar.hxx>
-///////////////////////////////////////////////////////////////////////////
class SbxProperty;
class SvDispatch;
@@ -43,9 +42,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 +52,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 +67,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 +75,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 +96,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 +108,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/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index 6e6aee88e8..26da3e0ef6 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -34,169 +34,47 @@
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <basic/sbxcore.hxx>
-#ifndef __SBX_64
-#define __SBX_64
-
-struct SbxINT64
-{
- INT32 nHigh; UINT32 nLow;
-
-#if FALSE
- SbxINT64() : nHigh( 0 ), nLow( 0 ) {}
- SbxINT64( UINT8 n ) : nHigh( 0 ), nLow( n ) {}
- SbxINT64( UINT16 n ) : nHigh( 0 ), nLow( n ) {}
- SbxINT64( UINT32 n ) : nHigh( 0 ), nLow( n ) {}
- SbxINT64( unsigned int n ) : nHigh( 0 ), nLow( n ) {}
- SbxINT64( INT8 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
- SbxINT64( INT16 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
- SbxINT64( INT32 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
- SbxINT64( int n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
- SbxINT64( SbxINT64 &r ) : nHigh( r.nHigh ), nLow( r.nLow ) {}
-
- SbxINT64( BigInt &r );
- SbxINT64( double n );
-#endif
- void CHS()
- {
- nLow ^= (UINT32)-1;
- nHigh ^= -1;
- nLow++;
- if( !nLow )
- nHigh++;
- }
-
- // blc/os2i do not like operator =
- void Set(double n)
- {
- if( n >= 0 )
- {
- nHigh = (INT32)(n / (double)4294967296.0);
- nLow = (UINT32)(n - ((double)nHigh * (double)4294967296.0) + 0.5);
- }
- else {
- nHigh = (INT32)(-n / (double)4294967296.0);
- nLow = (UINT32)(-n - ((double)nHigh * (double)4294967296.0) + 0.5);
- CHS();
- }
- }
- void Set(INT32 n) { nHigh = n < 0 ? -1 : 0; nLow = n; }
-
- void SetMax() { nHigh = 0x7FFFFFFF; nLow = 0xFFFFFFFF; }
- void SetMin() { nHigh = 0x80000000; nLow = 0x00000000; }
- void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; }
-
- int operator ! () const { return !nHigh && !nLow; }
-
- SbxINT64 &operator -= ( const SbxINT64 &r );
- SbxINT64 &operator += ( const SbxINT64 &r );
- SbxINT64 &operator /= ( const SbxINT64 &r );
- SbxINT64 &operator %= ( const SbxINT64 &r );
- SbxINT64 &operator *= ( const SbxINT64 &r );
- SbxINT64 &operator &= ( const SbxINT64 &r );
- SbxINT64 &operator |= ( const SbxINT64 &r );
- SbxINT64 &operator ^= ( const SbxINT64 &r );
-
- friend SbxINT64 operator - ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator + ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator / ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator % ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator * ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator & ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator | ( const SbxINT64 &l, const SbxINT64 &r );
- friend SbxINT64 operator ^ ( const SbxINT64 &l, const SbxINT64 &r );
-
- friend SbxINT64 operator - ( const SbxINT64 &r );
- friend SbxINT64 operator ~ ( const SbxINT64 &r );
-
- static double GetMin() { return ((double)0x7FFFFFFF*(double)4294967296.0
- + (double)0xFFFFFFFF)
- / CURRENCY_FACTOR; }
- static double GetMax() { return ((double)0x80000000*(double)4294967296.0
- + (double)0xFFFFFFFF)
- / CURRENCY_FACTOR; }
-};
-
-struct SbxUINT64
-{
- UINT32 nHigh; UINT32 nLow;
- void Set(double n)
- {
- nHigh = (UINT32)(n / (double)4294967296.0);
- nLow = (UINT32)(n - ((double)nHigh * (double)4294967296.0));
- }
-
- void Set(UINT32 n) { nHigh = 0; nLow = n; }
-
- void SetMax() { nHigh = 0xFFFFFFFF; nLow = 0xFFFFFFFF; }
- void SetMin() { nHigh = 0x00000000; nLow = 0x00000000; }
- void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; }
-
- int operator ! () const { return !nHigh && !nLow; }
-
- SbxUINT64 &operator -= ( const SbxUINT64 &r );
- SbxUINT64 &operator += ( const SbxUINT64 &r );
- SbxUINT64 &operator /= ( const SbxUINT64 &r );
- SbxUINT64 &operator %= ( const SbxUINT64 &r );
- SbxUINT64 &operator *= ( const SbxUINT64 &r );
- SbxUINT64 &operator &= ( const SbxUINT64 &r );
- SbxUINT64 &operator |= ( const SbxUINT64 &r );
- SbxUINT64 &operator ^= ( const SbxUINT64 &r );
-
- friend SbxUINT64 operator - ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator + ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator / ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator % ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator * ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator & ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator | ( const SbxUINT64 &l, const SbxUINT64 &r );
- friend SbxUINT64 operator ^ ( const SbxUINT64 &l, const SbxUINT64 &r );
-
- friend SbxUINT64 operator ~ ( const SbxUINT64 &r );
-};
-
-#endif
-
#ifndef __SBX_SBXVALUES_HXX
#define __SBX_SBXVALUES_HXX
-class BigInt;
class SbxDecimal;
struct SbxValues
{
union {
+ sal_uInt8 nByte;
+ sal_uInt16 nUShort;
sal_Unicode nChar;
- BYTE nByte;
- INT16 nInteger;
- INT32 nLong;
- UINT16 nUShort;
- UINT32 nULong;
+ sal_Int16 nInteger;
+ sal_uInt32 nULong;
+ sal_Int32 nLong;
+ unsigned int nUInt;
+ int nInt;
+ sal_uInt64 uInt64;
+ sal_Int64 nInt64;
+
float nSingle;
double nDouble;
- SbxINT64 nLong64;
- SbxUINT64 nULong64;
- sal_Int64 nInt64;
- sal_uInt64 uInt64;
- int nInt;
- unsigned int nUInt;
- ::rtl::OUString* pOUString;
+
+ rtl::OUString* pOUString;
SbxDecimal* pDecimal;
SbxBase* pObj;
+
+ sal_uInt8* pByte;
+ sal_uInt16* pUShort;
sal_Unicode* pChar;
- BYTE* pByte;
- INT16* pInteger;
- INT32* pLong;
- UINT16* pUShort;
- UINT32* pULong;
+ sal_Int16* pInteger;
+ sal_uInt32* pULong;
+ sal_Int32* pLong;
+ unsigned int* pUInt;
+ int* pInt;
+ sal_uInt64* puInt64;
+ sal_Int64* pnInt64;
+
float* pSingle;
double* pDouble;
- SbxINT64* pLong64;
- SbxUINT64* pULong64;
- sal_Int64* pnInt64;
- sal_uInt64* puInt64;
- int* pInt;
- unsigned int* pUInt;
+
void* pData;
};
SbxDataType eType;
@@ -204,20 +82,20 @@ 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( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
- SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
+ 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) {}
+ SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {}
SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
- SbxValues( const BigInt &rBig );
+
};
#endif
@@ -234,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();
@@ -253,112 +131,112 @@ 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; }
- SbxINT64 GetCurrency() const;
- SbxINT64 GetLong64() const;
- SbxUINT64 GetULong64() const;
- sal_Int64 GetInt64() const;
- sal_uInt64 GetUInt64() const;
- INT16 GetInteger() const;
- INT32 GetLong() const;
- float GetSingle() const;
- double GetDouble() const;
- double GetDate() const;
- BOOL GetBool() const;
- UINT16 GetErr() const;
- const String& GetString() const;
- const String& GetCoreString() const;
- ::rtl::OUString GetOUString() const;
- SbxDecimal* GetDecimal() const;
- SbxBase* GetObject() const;
- BOOL HasObject() const;
- void* GetData() const;
sal_Unicode GetChar() const;
- BYTE GetByte() const;
- UINT16 GetUShort() const;
- UINT32 GetULong() const;
+ sal_Int16 GetInteger() const;
+ sal_Int32 GetLong() const;
+ sal_Int64 GetInt64() const;
+ sal_uInt64 GetUInt64() const;
+
+ sal_Int64 GetCurrency() const;
+ SbxDecimal* GetDecimal() const;
+
+ float GetSingle() const;
+ 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;
+ sal_Bool HasObject() const;
+ void* GetData() const;
+ sal_uInt8 GetByte() const;
+ sal_uInt16 GetUShort() const;
+ sal_uInt32 GetULong() const;
int GetInt() const;
- BOOL PutCurrency( const SbxINT64& );
- BOOL PutLong64( const SbxINT64& );
- BOOL PutULong64( const SbxUINT64& );
- BOOL PutInt64( sal_Int64 );
- BOOL PutUInt64( sal_uInt64 );
- BOOL PutInteger( INT16 );
- BOOL PutLong( INT32 );
- BOOL PutSingle( float );
- BOOL PutDouble( double );
- BOOL PutDate( double );
- BOOL PutBool( BOOL );
- BOOL PutErr( USHORT );
- BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE")
- BOOL PutString( const ::rtl::OUString& );
- BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING
- BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR
- BOOL PutDecimal( SbxDecimal* pDecimal );
- BOOL PutObject( SbxBase* );
- BOOL PutData( void* );
- BOOL PutChar( sal_Unicode );
- BOOL PutByte( BYTE );
- BOOL PutUShort( UINT16 );
- BOOL PutULong( UINT32 );
- BOOL PutInt( int );
- BOOL PutEmpty();
- BOOL PutNull();
-
- // Special decimal methods
- BOOL PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
- BOOL fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
-
- virtual BOOL Convert( SbxDataType );
- virtual BOOL Compute( SbxOperator, const SbxValue& );
- virtual BOOL Compare( SbxOperator, const SbxValue& ) const;
- BOOL Scan( const String&, USHORT* = NULL );
+ 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
+ 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, sal_Bool bSingle = sal_False );
+
+ sal_Bool PutObject( SbxBase* );
+ sal_Bool PutData( void* );
+
+ 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;
- // Interface for CDbl in Basic
- static SbxError ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle=FALSE );
-
// The following operators are definied for easier handling.
- // Error conditions (overflow, conversions) are not
- // taken into consideration.
+ // TODO: Ensure error conditions (overflow, conversions)
+ // are taken into consideration in Compute and Compare
inline int operator ==( const SbxValue& ) const;
inline int operator !=( const SbxValue& ) const;
@@ -440,16 +318,17 @@ SV_DECL_REF(SbxInfo)
class SfxBroadcaster;
class SbxVariableImpl;
+class StarBASIC;
class SbxVariable : public SbxValue
{
friend class SbMethod;
SbxVariableImpl* mpSbxVariableImpl; // Impl data
- SfxBroadcaster* pCst; // Broadcaster, if needed
+ 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 );
@@ -458,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();
@@ -468,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; }
@@ -491,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; }
@@ -500,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 f94fca403d..f94fca403d 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 c61c2282f2..c61c2282f2 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 80a8dc4b90..2f29b93369 100644
--- a/basic/inc/basic/testtool.hxx
+++ b/basic/inc/basic/testtool.hxx
@@ -39,9 +39,9 @@
#define ASSERTION_STACK_PREFIX "Backtrace:"
-// #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors
+// 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 4fa6130c7c..4fa6130c7c 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 07da20096a..07da20096a 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 7600e7231f..ee70a614a6 100644
--- 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 100644
index 0000000000..451d15cf40
--- /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/makefile.mk b/basic/inc/makefile.mk
index 1b56b67748..1b56b67748 100644..100755
--- a/basic/inc/makefile.mk
+++ b/basic/inc/makefile.mk
diff --git a/basic/inc/pch/precompiled_basic.hxx b/basic/inc/pch/precompiled_basic.hxx
index 162f20a126..1b7a570328 100644
--- a/basic/inc/pch/precompiled_basic.hxx
+++ b/basic/inc/pch/precompiled_basic.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -213,7 +213,6 @@
#include "tools/fsys.hxx"
#include "tools/gen.hxx"
#include "tools/link.hxx"
-#include "tools/list.hxx"
#include "tools/rc.hxx"
#include "tools/rcid.h"
#include "tools/ref.hxx"
@@ -274,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 340b594bf0..340b594bf0 100644..100755
--- a/basic/inc/sb.hrc
+++ b/basic/inc/sb.hrc
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index c00a3d8412..c6f684fefa 100755..100644
--- 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 : TRANSLATIONS:translations 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 d2a083ebcb..41d1a59550 100644
--- 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 c7a613fbb4..97106afaf8 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -58,7 +58,6 @@
#include "runtime.hxx"
#include "sbintern.hxx"
-#ifdef _USE_UNO
#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/configurationkeys.hxx>
#include <comphelper/regpathhelper.hxx>
@@ -74,65 +73,65 @@
using namespace comphelper;
using namespace cppu;
-using namespace rtl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::beans;
-#endif /* _USE_UNO */
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
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;
}
@@ -154,25 +153,25 @@ void TestToolDebugMessageFilter( const sal_Char *pString, BOOL bIsOsl )
printf("DbgPrintMsgBox failed: %s\n", pString );
}
}
-/* DBG_INSTOUTERROR( DBG_OUT_MSGBOX )
- DBG_ERROR( pString );
- DBG_INSTOUTERROR( DBG_OUT_TESTTOOL )*/
- 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
+// 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(" ");
@@ -202,38 +201,18 @@ uno::Reference< XContentProviderManager > InitializeUCB( void )
}
- //////////////////////////////////////////////////////////////////////
// set global factory
setProcessServiceFactory( xSMgr );
-/* // Create simple ConfigManager
- Sequence< Any > aConfArgs(3);
- aConfArgs[0] <<= PropertyValue( OUString::createFromAscii("servertype"), 0, makeAny( OUString::createFromAscii("local") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
- aConfArgs[1] <<= PropertyValue( OUString::createFromAscii("sourcepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
- aConfArgs[2] <<= PropertyValue( OUString::createFromAscii("updatepath"), 0, makeAny( OUString::createFromAscii("g:\\") ), ::com::sun::star::beans::PropertyState_DIRECT_VALUE );
-
- uno::Reference< XContentProvider > xConfProvider
- ( xSMgr->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), aConfArgs), UNO_QUERY );
-*/
-
-
// Create unconfigured Ucb:
-/* Sequence< Any > aArgs(1);
- aArgs[1] = makeAny ( xConfProvider );*/
Sequence< Any > aArgs;
::ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
uno::Reference< XContentProviderManager > xUcb =
::ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
uno::Reference< XContentProvider > xFileProvider
- ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY );
- xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True );
-
-
-/* uno::Reference< XContentProvider > xPackageProvider
- ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.PackageContentProvider" ) ), UNO_QUERY );
- xUcb->registerContentProvider( xPackageProvider, OUString::createFromAscii( "vnd.sun.star.pkg" ), sal_True );
- */
+ ( xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.FileContentProvider" )) ), UNO_QUERY );
+ xUcb->registerContentProvider( xFileProvider, OUString(RTL_CONSTASCII_USTRINGPARAM( "file" )), sal_True );
return xUcb;
}
@@ -245,17 +224,10 @@ static void ReplaceStringHookProc( UniString& rStr )
if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND )
{
rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", aTestToolName );
- /*
- rStr.SearchAndReplaceAllAscii( "%PRODUCTVERSION", rVersion );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSION", rAboutBoxVersion );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTEXTENSION", rExtension );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATNAME", rXMLFileFormatName );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATVERSION", rXMLFileFormatVersion );
- */
}
}
-void BasicApp::Main( )
+int BasicApp::Main( )
{
#ifdef DBG_UTIL
// Install filter for OSLAsserts
@@ -264,7 +236,7 @@ void BasicApp::Main( )
DBG_INSTOUTERROR( DBG_OUT_TESTTOOL );
if ( osl_setDebugMessageFunc( osl_TestToolDebugMessageFilter ) )
- DBG_ERROR("osl_setDebugMessageFunc returns non NULL pointer");
+ OSL_FAIL("osl_setDebugMessageFunc returns non NULL pointer");
#endif
ResMgr::SetReadStringHook( ReplaceStringHookProc );
@@ -282,8 +254,8 @@ void BasicApp::Main( )
DirEntry aAppFileName( GetAppFileName() );
String aAppDir ( aAppFileName.GetPath().GetFull() );
-// DirEntry aDefIniPath( Config::GetConfigName( aAppDir, CUniString("testtool") ) );
-// Do not use Config::GetConfigName here because is uses a hidden file for UNIX
+ // Do not use Config::GetConfigName here because is uses a hidden
+ // file for UNIX
DirEntry aDefIniPath( aAppDir );
ByteString aFileName;
@@ -297,7 +269,7 @@ void BasicApp::Main( )
if ( aDefIniPath.Exists() )
{
aDefIniPath.CopyTo( aIniPath, FSYS_ACTION_COPYFILE );
- FileStat::SetReadOnlyFlag( aIniPath, FALSE );
+ FileStat::SetReadOnlyFlag( aIniPath, sal_False );
}
}
}
@@ -315,31 +287,12 @@ void BasicApp::Main( )
AllSettings aSettings = GetSettings();
aSettings.SetUILanguage( aRequestedLanguage );
aSettings.SetLanguage( aRequestedLanguage );
-// International aInternational;
-// aInternational = GetSettings().GetInternational();
-// aInternational = International( aRequestedLanguage );
-// aSettings.SetInternational( aInternational );
SetSettings( aSettings );
-// aInternational = GetSettings().GetInternational();
}
-// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt ), )
-//const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio )
-
-// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt )
-// ResMgr *pRes = new ResMgr( "testtool.res" );
-// Resource::SetResManager( pRes );
-
BasicDLL aBasicDLL;
nWait = 0;
- // Hilfe:
-// pHelp = new Help;
-// SetHelp( pHelp );
-// Help::EnableContextHelp();
-// Help::EnableExtHelp();
-// DeactivateExtHelp();
-
// Acceleratoren
Accelerator aAccel( SttResId( MAIN_ACCEL ) );
InsertAccel( &aAccel );
@@ -363,7 +316,6 @@ void BasicApp::Main( )
PostUserEvent( LINK( this, BasicApp, LateInit ) );
Execute();
-// delete pHelp;
delete pFrame;
RemoveAccel( pMainAccel );
@@ -383,6 +335,7 @@ void BasicApp::Main( )
InfoBox( NULL, String::CreateFromAscii( "unknown Exception not caught" ) ).Execute();
throw;
}
+ return EXIT_SUCCESS;
}
void BasicApp::LoadIniFile()
@@ -398,8 +351,8 @@ void BasicApp::SetFocus()
IMPL_LINK( BasicApp, LateInit, void *, pDummy )
{
- (void) pDummy; /* avoid warning about unused parameter */
- USHORT i;
+ (void) pDummy; /* avoid warning about unused parameter */
+ sal_uInt16 i;
for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
{
if ( Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("-run") == COMPARE_EQUAL
@@ -407,7 +360,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
@@ -418,7 +371,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++;
}
@@ -460,7 +413,6 @@ IMPL_LINK( BasicApp, LateInit, void *, pDummy )
return 0;
}
-//////////////////////////////////////////////////////////////////////////
class FloatingExecutionStatus : public FloatingWindow
{
@@ -490,7 +442,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 );
@@ -498,7 +450,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 );
@@ -506,22 +458,21 @@ void FloatingExecutionStatus::SetAdditionalInfo( String aF )
IMPL_LINK(FloatingExecutionStatus, HideNow, FloatingExecutionStatus*, pFLC )
{
- (void) pFLC; /* avoid warning about unused parameter */
+ (void) pFLC; /* avoid warning about unused parameter */
Hide();
return 0;
}
-//////////////////////////////////////////////////////////////////////////
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 )
@@ -531,21 +482,18 @@ 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;
if ( pBasic->pTestObject ) // Are we the testtool?
{
-// aAppIcon = Icon( ResId( RID_APPICON2 ) );
aAppName = String( SttResId( IDS_APPNAME2 ) );
}
else
{
-// aAppIcon = Icon( ResId( RID_APPICON ) );
aAppName = String( SttResId( IDS_APPNAME ) );
}
@@ -618,7 +566,6 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
LoadIniFile();
UpdateTitle();
-// SetIcon( aAppIcon );
// Size: half width, 0.75 * height - 2 * IconSize
{
@@ -627,15 +574,10 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
SetWindowState( aConf.ReadKey("WinParams", "") );
}
-// pWork = new AppEdit( this, NULL );
-// pWork->Show();
-// pWork->Close();
-
aLineNum.SetTimeoutHdl( LINK( this, BasicFrame, ShowLineNr ) );
aLineNum.SetTimeout(200);
aLineNum.Start();
-
aCheckFiles.SetTimeout( 10000 );
aCheckFiles.SetTimeoutHdl( LINK( this, BasicFrame, CheckAllFiles ) );
aCheckFiles.Start();
@@ -646,11 +588,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++ )
@@ -681,17 +623,15 @@ void BasicFrame::LoadIniFile()
if ( pBasic )
pBasic->LoadIniFile();
- for ( i = 0 ; i < pList->Count() ; i++ )
- pList->GetObject( i )->LoadIniFile();
+ for ( i = 0 ; i < pList->size() ; i++ )
+ pList->at( i )->LoadIniFile();
}
BasicFrame::~BasicFrame()
{
- AppWin* p = pList->First();
- DBG_ASSERT( !p, "Still open FileWindows");
- if( p )
- while( (p = pList->Remove() ) != NULL )
- delete p;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ delete pList->at( i );
+ pList->clear();
MenuBar *pBar = GetMenuBar();
SetMenuBar( NULL );
@@ -700,12 +640,10 @@ BasicFrame::~BasicFrame()
delete pStatus;
delete pPrn;
delete pList;
-// delete pExecutionStatus;
-// delete pBasic;
pBasic.Clear();
}
-void BasicFrame::Command( const CommandEvent& rCEvt )
+void BasicFrame::Command( const CommandEvent& rCEvt )
{
switch( rCEvt.GetCommand() ) {
case COMMAND_SHOWDIALOG:
@@ -755,8 +693,8 @@ IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer )
{
AppWin* pStartWin = pWork;
Window* pFocusWin = Application::GetFocusWindow();
- for ( int i = pList->Count()-1 ; i >= 0 ; i-- )
- pList->GetObject( i )->CheckReload();
+ for ( size_t i = pList->size() ; i > 0 ; )
+ pList->at( --i )->CheckReload();
if ( pWork != pStartWin )
{
@@ -770,12 +708,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;
}
@@ -803,19 +741,10 @@ void BasicFrame::Notify( SfxBroadcaster&, const SfxHint& rHint )
aTotalStatus.AppendAscii( " " );
aTotalStatus.Append( pStatusHint->GetAdditionalExecutionStatus() );
pStatus->Message( aTotalStatus );
-/* if ( !pExecutionStatus )
- pExecutionStatus = new FloatingExecutionStatus( this );
- pExecutionStatus->SetStatus( pStatusHint->GetExecutionStatus() );
- pExecutionStatus->SetAdditionalInfo( pStatusHint->GetAdditionalExecutionStatus() );*/
}
break;
case TT_EXECUTION_HIDE_ACTION:
{
-/* if ( pExecutionStatus )
- {
- delete pExecutionStatus;
- pExecutionStatus = NULL;
- }*/
}
break;
}
@@ -842,14 +771,22 @@ void BasicFrame::Resize()
// Resize possibly maximized window
- ULONG i;
- for( i = pList->Count(); i > 0 ; i-- )
+ for( size_t i = pList->size(); i > 0 ; i-- )
{
- if ( pList->GetObject( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
- pList->GetObject( i-1 )->Maximize();
+ if ( pList->at( i-1 )->GetWinState() == TT_WIN_STATE_MAX )
+ pList->at( i-1 )->Maximize();
}
}
+Rectangle BasicFrame::GetInnerRect() const
+{
+ Rectangle aRect( Point(0,0), GetOutputSizePixel() );
+ aRect.Bottom() = pStatus->GetPosPixel().Y()-1;
+ if( aRect.Bottom() < 0 ) // sanity check
+ aRect.Bottom() = 0;
+ return aRect;
+}
+
void BasicFrame::Move()
{
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
@@ -866,42 +803,58 @@ void BasicFrame::GetFocus()
IMPL_LINK( BasicFrame, CloseButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->GrabFocus();
- return Command( RID_FILECLOSE, FALSE );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->GrabFocus();
+ break;
+ }
+ }
+ return Command( RID_FILECLOSE, sal_False );
}
IMPL_LINK( BasicFrame, FloatButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ break;
+ }
+ }
return 1;
}
IMPL_LINK( BasicFrame, HideButtonClick, void*, EMPTYARG )
{
AppWin* p;
- for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() )
- {};
- if ( p )
- p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ p = pList->at( i - 1 );
+ if ( p->GetWinState() == TT_WIN_STATE_MAX )
+ {
+ p->TitleButtonClick( TITLE_BUTTON_HIDE );
+ break;
+ }
+ }
return 1;
}
void BasicFrame::WinShow_Hide()
{
- if ( !pList->Count() )
+ if ( pList->empty() )
return;
AppWin* p;
- BOOL bWasFullscreen = FALSE;
- for ( p = pList->Last() ; p ; p = pList->Prev() )
+ sal_Bool bWasFullscreen = sal_False;
+ for ( size_t i = pList->size(); i > 0; --i )
{
+ p = pList->at( i - 1 );
if ( p->pDataEdit )
{
if ( p->GetWinState() & TT_WIN_STATE_HIDE // Hidden
@@ -909,7 +862,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;
}
@@ -919,18 +872,27 @@ void BasicFrame::WinMax_Restore()
{
// The application buttons
AppWin* p;
- BOOL bHasFullscreenWin = FALSE;
- for( p = pList->First(); p && !bHasFullscreenWin ; p = pList->Next() )
- bHasFullscreenWin |= ( p->GetWinState() == TT_WIN_STATE_MAX );
- GetMenuBar()->ShowButtons( bHasFullscreenWin, FALSE, 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, sal_False, sal_False );
WinShow_Hide();
}
void BasicFrame::RemoveWindow( AppWin *pWin )
{
-// delete pIcon;
- pList->Remove( pWin );
- pWork = pList->Last();
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pWork = ( pList->empty() ) ? NULL : pList->back();
WinShow_Hide();
@@ -940,10 +902,11 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
WinMax_Restore();
Menu* pMenu = GetMenuBar();
- if( pList->Count() == 0 ) {
- pMenu->EnableItem( RID_APPEDIT, FALSE );
- pMenu->EnableItem( RID_APPRUN, FALSE );
- pMenu->EnableItem( RID_APPWINDOW, FALSE );
+ if( pList->empty() )
+ {
+ pMenu->EnableItem( RID_APPEDIT, sal_False );
+ pMenu->EnableItem( RID_APPRUN, sal_False );
+ pMenu->EnableItem( RID_APPWINDOW, sal_False );
}
PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW );
@@ -959,28 +922,29 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
void BasicFrame::AddWindow( AppWin *pWin )
{
- pList->Insert( pWin, LIST_APPEND );
+ pList->push_back( pWin );
pWork = pWin;
WinMax_Restore();
// Enable main menu
MenuBar* pMenu = GetMenuBar();
- if( pList->Count() > 0 ) {
- pMenu->EnableItem( RID_APPEDIT, TRUE );
- pMenu->EnableItem( RID_APPRUN, TRUE );
- pMenu->EnableItem( RID_APPWINDOW, TRUE );
+ if( !pList->empty() )
+ {
+ 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++;
@@ -1004,9 +968,16 @@ void BasicFrame::WindowRenamed( AppWin *pWin )
void BasicFrame::FocusWindow( AppWin *pWin )
{
pWork = pWin;
- pList->Remove( pWin );
- pList->Insert( pWin, LIST_APPEND );
- pWin->Minimize( FALSE );
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pList->push_back( pWin );
+ pWin->Minimize( sal_False );
aAppFile = pWin->GetText();
UpdateTitle();
@@ -1015,14 +986,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();
@@ -1036,30 +1007,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->Count() )
- if ( !pList->Last()->Close() )
- return FALSE;
- return TRUE;
+ while ( !pList->empty() )
+ if ( !pList->back()->Close() )
+ return sal_False;
+ return sal_True;
}
-BOOL BasicFrame::CompileAll()
+sal_Bool BasicFrame::CompileAll()
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
- if( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE;
- return TRUE;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ {
+ p = pList->at( i );
+ if ( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return sal_False;
+ }
+ 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 )
@@ -1078,9 +1052,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++ )
{
@@ -1112,15 +1086,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 );
@@ -1130,7 +1104,7 @@ void BasicFrame::LoadLRU()
if (bAddSep)
{
pPopup->InsertSeparator();
- bAddSep = FALSE;
+ bAddSep = sal_False;
}
if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND )
@@ -1149,13 +1123,11 @@ 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( /*bNormal &&*/ pWork != NULL );
+ sal_Bool bHasEdit = sal_Bool( pWork != NULL );
-// pMenu->EnableItem( RID_FILENEW, bNormal ); // always possible
-// pMenu->EnableItem( RID_FILEOPEN, bNormal );
pMenu->EnableItem( RID_FILECLOSE, bHasEdit );
pMenu->EnableItem( RID_FILESAVE, bHasEdit );
pMenu->EnableItem( RID_FILESAVEAS, bHasEdit );
@@ -1164,44 +1136,31 @@ 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;
- if( bHasErr )
+ sal_Bool bHasErr = sal_Bool( bNormal && pBasic->GetErrors() != 0 );
+ sal_Bool bNext = bHasErr & bNormal;
+ sal_Bool bPrev = bHasErr & bNormal;
+ if( bHasErr )
{
- ULONG n = pBasic->aErrors.GetCurPos();
+ size_t n = pBasic->GetCurrentError();
if( n == 0 )
- bPrev = FALSE;
- if( USHORT(n+1) == pBasic->GetErrors() )
- bNext = FALSE;
+ bPrev = sal_False;
+ if( SbError(n+1) == pBasic->GetErrors() )
+ bNext = sal_False;
}
pMenu->EnableItem( RID_RUNNEXTERR, bNext );
pMenu->EnableItem( RID_RUNPREVERR, bPrev );
pMenu->CheckItem( RID_RUNDISAS, bDisas );
- if( pWork )
+ 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 */
-/* pMenu->EnableItem( RID_RUNCOMPILE );
-
- pMenu->EnableItem( RID_FILECLOSE );
- pMenu->EnableItem( RID_FILESAVE );
- pMenu->EnableItem( RID_FILESAVEAS );
- pMenu->EnableItem( RID_FILEPRINT );
- pMenu->EnableItem( RID_FILESETUP );
- pMenu->EnableItem( RID_FILELOADLIB );
- pMenu->EnableItem( RID_FILESAVELIB );
-
- pMenu->EnableItem( RID_RUNNEXTERR );
- pMenu->EnableItem( RID_RUNPREVERR );
- if( pWork ) pWork->DeInitMenu( pMenu );
-*/
- SetAutoRun( FALSE );
+ (void) pMenu; /* avoid warning about unused parameter */
+
+ SetAutoRun( sal_False );
String aString;
pStatus->Message( aString );
return 0L;
@@ -1218,22 +1177,22 @@ 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 )
IMPL_LINK_INLINE_START( BasicFrame, ShowLineNr, AutoTimer *, pTimer )
{
- (void) pTimer; /* avoid warning about unused parameter */
+ (void) pTimer; /* avoid warning about unused parameter */
String aPos;
if ( pWork && pWork->ISA(AppBasEd))
{
@@ -1291,14 +1250,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 );
@@ -1325,7 +1284,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;
@@ -1334,15 +1293,13 @@ long BasicFrame::Command( short nID, BOOL bChecked )
AppBasEd* p = new AppBasEd( this, NULL );
p->Show();
p->GrabFocus();
- // InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
} break;
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 );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
} break;
case RID_FILELOADLIB:
@@ -1353,7 +1310,6 @@ long BasicFrame::Command( short nID, BOOL bChecked )
break;
case RID_FILECLOSE:
if( pWork && pWork->Close() ){};
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
break;
case RID_FILEPRINT:
if( pWork )
@@ -1380,7 +1336,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 )
@@ -1388,7 +1344,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)" );
@@ -1398,7 +1354,6 @@ long BasicFrame::Command( short nID, BOOL bChecked )
nFlags = SbDEBUG_BREAK;
goto start;
start: {
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
if ( !Basic().IsRunning() || bInBreak )
{
AppBasEd* p = NULL;
@@ -1410,7 +1365,14 @@ long BasicFrame::Command( short nID, BOOL bChecked )
else
{
AppWin *w = NULL;
- for ( w = pList->Last() ; w ? !w->ISA(AppBasEd) : FALSE ; w = pList->Prev() ) ;
+ for ( size_t i = pList->size(); i > 0; --i )
+ {
+ if ( pList->at( i-1 )->ISA( AppBasEd ) )
+ {
+ w = pList->at( i-1 );
+ break;
+ }
+ }
if ( w )
{
p = ((AppBasEd*)w);
@@ -1423,7 +1385,7 @@ long BasicFrame::Command( short nID, BOOL bChecked )
if( bInBreak )
// Reset the flag
- bInBreak = FALSE;
+ bInBreak = sal_False;
else
{
if( IsAutoSave() && !SaveAll() ) break;
@@ -1432,16 +1394,14 @@ 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
-// BasicDLL::EnableBreak( TRUE );
}
}}
}
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // after run
break;
case RID_RUNCOMPILE:
if( pWork && pWork->ISA(AppBasEd) && SaveAll() )
@@ -1452,25 +1412,24 @@ 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 )
{
-// pINST->CalcBreakCallLevel(SbDEBUG_STEPINTO);
pINST->nBreakCallLvl = pINST->nCallLvl;
}
break;
case RID_RUNSTOP:
Basic().Stop();
- bInBreak = FALSE;
+ bInBreak = sal_False;
break;
case RID_RUNNEXTERR:
- pErr = pBasic->aErrors.Next();
+ pErr = pBasic->NextError();
if( pErr ) pErr->Show();
break;
case RID_RUNPREVERR:
- pErr = pBasic->aErrors.Prev();
+ pErr = pBasic->PrevError();
if( pErr ) pErr->Show();
break;
@@ -1487,13 +1446,12 @@ long BasicFrame::Command( short nID, BOOL bChecked )
case RID_WINTILE:
{
WindowArrange aArange;
- for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
-
sal_Int32 nTitleHeight;
{
sal_Int32 nDummy1, nDummy2, nDummy3;
@@ -1511,10 +1469,10 @@ long BasicFrame::Command( short nID, BOOL bChecked )
case RID_WINTILEHORZ:
{
WindowArrange aArange;
- for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
@@ -1533,16 +1491,12 @@ long BasicFrame::Command( short nID, BOOL bChecked )
}
break;
case RID_WINTILEVERT:
-//#define WINDOWARRANGE_TILE 1
-//#define WINDOWARRANGE_HORZ 2
-//#define WINDOWARRANGE_VERT 3
-//#define WINDOWARRANGE_CASCADE 4
{
WindowArrange aArange;
- for ( ULONG i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- aArange.AddWindow( pList->GetObject( i ) );
- pList->GetObject( i )->Restore();
+ aArange.AddWindow( pList->at( i ) );
+ pList->at( i )->Restore();
}
@@ -1562,26 +1516,14 @@ long BasicFrame::Command( short nID, BOOL bChecked )
break;
case RID_WINCASCADE:
{
- for ( USHORT i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- pList->GetObject( i )->Cascade( i );
+ pList->at( i )->Cascade( i );
}
}
break;
-/* case RID_HELPTOPIC:
- if( pWork ) pWork->Help();
- break;
- case RID_HELPKEYS:
- aBasicApp.pHelp->Start( CUniString( "Keyboard" ) );
- break;
- case RID_HELPINDEX:
- aBasicApp.pHelp->Start( OOO_HELP_INDEX );
- break;
- case RID_HELPINTRO:
- aBasicApp.pHelp->Start( OOO_HELP_HELPONHELP );
- break;
-*/ case RID_HELPABOUT:
+ case RID_HELPABOUT:
{
SttResId aResId( IDD_ABOUT_DIALOG );
if ( Basic().pTestObject ) // Are we TestTool?
@@ -1614,32 +1556,30 @@ long BasicFrame::Command( short nID, BOOL bChecked )
AddToLRU( s );
LoadFile( s );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
else
{
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
if( pWork )
pWork->Command( CommandEvent( Point(), nID ) );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
}
}
- return TRUE;
+ return sal_True;
}
-BOOL BasicFrame::SaveAll()
+sal_Bool BasicFrame::SaveAll()
{
AppWin* p, *q = pWork;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
- USHORT nRes = p->QuerySave( QUERY_DISK_CHANGED );
+ p = pList->at( i );
+ 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 )
@@ -1650,8 +1590,9 @@ IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename )
AppBasEd* BasicFrame::FindModuleWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->ISA(AppBasEd) && ((AppBasEd*)p)->GetModName() == rName )
return ((AppBasEd*)p);
}
@@ -1661,8 +1602,9 @@ AppBasEd* BasicFrame::FindModuleWin( const String& rName )
AppError* BasicFrame::FindErrorWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->ISA(AppError) && ((AppError*)p)->GetText() == rName )
return ((AppError*)p);
}
@@ -1672,19 +1614,21 @@ AppError* BasicFrame::FindErrorWin( const String& rName )
AppWin* BasicFrame::FindWin( const String& rName )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->GetText() == rName )
return p;
}
return NULL;
}
-AppWin* BasicFrame::FindWin( USHORT nWinId )
+AppWin* BasicFrame::FindWin( sal_uInt16 nWinId )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p->GetWinId() == nWinId )
return p;
}
@@ -1694,8 +1638,9 @@ AppWin* BasicFrame::FindWin( USHORT nWinId )
AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
+ for ( size_t i = 0, n = pList->size(); i < n ; i++ )
{
+ p = pList->at( i );
if( p == pMaybeWin )
return p;
}
@@ -1704,13 +1649,13 @@ AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
IMPL_LINK( BasicFrame, WriteString, String*, pString )
{
- if ( pList->Last() )
+ if ( !pList->empty() )
{
- pList->Last()->pDataEdit->ReplaceSelected( *pString );
- return TRUE;
+ pList->back()->pDataEdit->ReplaceSelected( *pString );
+ return sal_True;
}
else
- return FALSE;
+ return sal_False;
}
class NewFileDialog : public FileDialog
@@ -1733,7 +1678,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++;
@@ -1746,13 +1691,11 @@ void NewFileDialog::FilterSelect()
aConf.SetGroup( aCurrentProfile );
aLastPath = UniString( aConf.ReadKey( aFilterType, aConf.ReadKey( "BaseDir" ) ), RTL_TEXTENCODING_UTF8 );
SetPath( aLastPath );
-// if ( IsInExecute() )
-// SetPath( "" );
}
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") ));
@@ -1765,8 +1708,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 ) );
@@ -1806,42 +1749,34 @@ BOOL BasicFrame::QueryFileName
aDlg.SetCurFilter( String( SttResId( IDS_BASFILTER ) ) );
aDlg.FilterSelect(); // Selects the last used path
-// if ( bSave )
if ( rName.Len() > 0 )
aDlg.SetPath( rName );
if( aDlg.Execute() )
{
rName = aDlg.GetPath();
-/* rExtension = aDlg.GetCurrentFilter();
- var i:integer;
- for ( i = 0 ; i < aDlg.GetFilterCount() ; i++ )
- if ( rExtension == aDlg.GetFilterName( i ) )
- rExtension = aDlg.GetFilterType( i );
-*/
- return TRUE;
- } else return FALSE;
-}
-
-USHORT BasicFrame::BreakHandler()
-{
- bInBreak = TRUE;
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
-// MenuBar aBar( ResId( RID_APPMENUBAR ) );
-// aBar.EnableItem( RID_APPEDIT, FALSE );
+ return sal_True;
+ } else return sal_False;
+}
+
+sal_uInt16 BasicFrame::BreakHandler()
+{
+ bInBreak = sal_True;
SetAppMode( String( SttResId ( IDS_APPMODE_BREAK ) ) );
- while( bInBreak )
+
+ while( bInBreak ) {
GetpApp()->Yield();
+ }
+
SetAppMode( String( SttResId ( IDS_APPMODE_RUN ) ) );
-// aBar.EnableItem( RID_APPEDIT, TRUE );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
+
return nFlags;
}
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 );
@@ -1851,7 +1786,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 );
@@ -1869,7 +1804,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 ) )
@@ -1883,8 +1818,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 &&
@@ -1903,22 +1838,17 @@ String BasicFrame::GenRealString( const String &aResString )
nEnd = nEnd + aString.Len();
aString.Erase();
}
-// if ( Resource::GetResManager()->IsAvailable( ResId( aValue ) ) )
- aString = String( SttResId( (USHORT)(aValue.ToInt32()) ) );
-// else
- {
-// DBG_ERROR( "Could not load resource!" );
-// return aResString;
- }
+
+ 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;
@@ -1926,7 +1856,7 @@ String BasicFrame::GenRealString( const String &aResString )
}
else
{
- DBG_ERROR( CByteString("Unknown replacement in String: ").Append( ByteString( aResult.Copy(nStart,nEnd-nStart), RTL_TEXTENCODING_UTF8 ) ).GetBuffer() );
+ OSL_FAIL( CByteString("Unknown replacement in String: ").Append( ByteString( aResult.Copy(nStart,nEnd-nStart), RTL_TEXTENCODING_UTF8 ) ).GetBuffer() );
nStartPos = nStartPos + StartKenn.Len();
}
}
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index 48a348a686..c178219bf4 100644
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -39,8 +39,8 @@
class BasicFrame;
#include <basic/mybasic.hxx>
+#include <vector>
-class EditList;
class AppWin;
class AppEdit;
class AppBasEd;
@@ -50,19 +50,19 @@ class StatusLine;
class BasicPrinter;
struct TTLogMsg;
+typedef ::std::vector< AppWin* > EditList;
+
class BasicApp : public Application {
short nWait; // Wait-Zaehler
public:
-// Help* pHelp; // Hilfesystem
BasicFrame* pFrame; // Frame Window
-// MenuBar* pMainMenu; // Hauptmenue
Accelerator* pMainAccel; // Acceleratoren
- void Main( );
+ int Main( );
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,27 +90,26 @@ 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();
+ virtual void Resize();
+ virtual void Move();
+ virtual void GetFocus();
void LoadLibrary();
void SaveLibrary();
- BOOL bIsAutoRun;
+ sal_Bool bIsAutoRun;
DisplayHidDlg* pDisplayHidDlg;
-// BreakPoint *pRunToCursorBP;
SbxVariable *pEditVar;
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 +125,16 @@ virtual void GetFocus();
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 +156,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 );
@@ -183,6 +182,7 @@ public:
void SetAppMode( const String &aNewMode ){ aAppMode = aNewMode; UpdateTitle(); }
String GenRealString( const String &aResString );
+ Rectangle GetInnerRect() const;
};
diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx
index 09ed489581..5b008673dd 100644
--- a/basic/source/app/appbased.cxx
+++ b/basic/source/app/appbased.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -56,12 +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().pTextEngine->SetWordDelimiters( CUniString(" ,.;:(){}[]\"'+-*/<>^\\") );
- ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( TRUE );
- ((TextEdit*)pDataEdit)->SaveAsUTF8( TRUE );
+ ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( sal_True );
+ ((TextEdit*)pDataEdit)->SaveAsUTF8( sal_True );
String aEmpty;
@@ -76,10 +74,6 @@ AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p )
pBreakpoints->SetModule( pMod );
- // Define icon:
-// pIcon = new Icon( ResId( RID_WORKICON ) );
-// if( pIcon ) SetIcon( *pIcon );
-
SetText( pMod->GetName() );
pDataEdit->SetText( pMod->GetSource() );
@@ -107,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();
@@ -122,9 +116,9 @@ FileType AppBasEd::GetFileType()
IMPL_LINK_INLINE_START( AppBasEd, EditChange, void *, p )
{
- (void) p; /* avoid warning about unused parameter */
- bCompiled = FALSE;
- return TRUE;
+ (void) p; /* avoid warning about unused parameter */
+ bCompiled = sal_False;
+ return sal_True;
}
IMPL_LINK_INLINE_END( AppBasEd, EditChange, void *, p )
@@ -132,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
@@ -158,7 +152,7 @@ void AppBasEd::Command( const CommandEvent& rCEvt )
void AppBasEd::Resize()
{
- if( pDataEdit )
+ if( pDataEdit )
{
AppEdit::Resize();
@@ -183,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();
@@ -205,9 +199,8 @@ void AppBasEd::Reload()
// Reload source code file after change
void AppBasEd::LoadSource()
{
- BOOL bErr;
+ sal_Bool bErr;
-// if( pDataEdit->GetText().Len() != 0 ) return;
String aName = pMod->GetName();
bErr = !pDataEdit->Load( aName );
pBreakpoints->LoadBreakpoints( GetText() );
@@ -215,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)
@@ -226,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() );
@@ -247,7 +240,7 @@ BOOL AppBasEd::Compile()
}
else
{
- BasicError* pErr = pFrame->Basic().aErrors.First();
+ BasicError* pErr = pFrame->Basic().FirstError();
if( pErr ) pErr->Show();
}
return bCompiled = bRes;
@@ -264,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 )
{
@@ -284,8 +277,8 @@ void AppBasEd::Run()
pMain->Run();
if (aBasicApp.pFrame)
{
- BasicError* pErr = aBasicApp.pFrame->Basic().aErrors.First();
- if( pErr )
+ BasicError* pErr = aBasicApp.pFrame->Basic().FirstError();
+ if( pErr )
pErr->Show();
aBasicApp.pFrame->SetAppMode( String() );
}
diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx
index 2baf8326c9..9684eabb60 100644
--- 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 f6f888b925..fbaea06499 100644
--- a/basic/source/app/appedit.cxx
+++ b/basic/source/app/appedit.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -52,9 +52,6 @@ AppEdit::AppEdit( BasicFrame* pParent )
pDataEdit = new TextEdit( this, WB_LEFT );
LoadIniFile();
- // define Icon:
-// pIcon = new Icon( ResId( RID_WORKICON ) );
-// if( pIcon ) SetIcon( *pIcon );
pDataEdit->SetText( aEmpty );
@@ -82,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") ));
@@ -92,9 +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.GetValue( FUNIT_POINT );
- ULONG nFontSize = aFontSize.ToInt32();
-// aFont.SetSize( Size( nFontSize, nFontSize ) );
+ sal_uIntPtr nFontSize = aFontSize.ToInt32();
aFont.SetHeight( nFontSize );
#if OSL_DEBUG_LEVEL > 1
@@ -102,9 +97,7 @@ void AppEdit::LoadIniFile()
Font aFont2( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0, pFrame ));
}
#endif
- aFont.SetTransparent( FALSE );
-// aFont.SetAlign( ALIGN_BOTTOM );
-// aFont.SetHeight( aFont.GetHeight()+2 );
+ aFont.SetTransparent( sal_False );
pDataEdit->SetFont( aFont );
if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() )
@@ -132,7 +125,7 @@ void AppEdit::Command( const CommandEvent& rCEvt )
IMPL_LINK( AppEdit, Scroll, ScrollBar*, pScroll )
{
- (void) pScroll; /* avoid warning about unused parameter */
+ (void) pScroll; /* avoid warning about unused parameter */
if ( !pHScroll || !pVScroll )
return 0;
@@ -183,9 +176,9 @@ void AppEdit::SetScrollBarRanges()
-USHORT AppEdit::GetLineNr()
-{
- return pDataEdit->GetLineNr();
+sal_uInt16 AppEdit::GetLineNr()
+{
+ return pDataEdit->GetLineNr();
}
FileType AppEdit::GetFileType()
@@ -200,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 )
@@ -217,7 +210,7 @@ long AppEdit::DeInitMenu( Menu* pMenu )
pMenu->EnableItem( RID_EDITUNDO );
pMenu->EnableItem( RID_EDITREDO );
- return TRUE;
+ return sal_True;
}
void AppEdit::Resize()
@@ -232,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();
}
@@ -240,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();
}
@@ -276,7 +269,6 @@ void AppEdit::Resize()
aStartDocPos.Y() = nMaxVisAreaStart;
pTextView->SetStartDocPos( aStartDocPos );
pTextView->ShowCursor();
-// pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
}
InitScrollBars();
if ( nVisY != pTextView->GetStartDocPos().Y() )
@@ -292,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 5b1a548b40..6dd14f0b44 100644
--- 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 512a5ac406..441701b3ec 100644
--- a/basic/source/app/apperror.cxx
+++ b/basic/source/app/apperror.cxx
@@ -44,9 +44,6 @@ AppError::AppError( BasicFrame* pParent, String aFileName )
bHasFile = pDataEdit->Load( aFileName );
DirEntry aEntry( aFileName );
UpdateFileInfo( HAS_BEEN_LOADED );
- // Define icon
-// pIcon = new Icon( ResId( RID_WORKICON ) );
-// if( pIcon ) SetIcon( *pIcon );
pDataEdit->Show();
GrabFocus();
@@ -64,10 +61,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 +74,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,14 +99,10 @@ 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();
-// aFont.SetSize( Size( nFontSize, nFontSize ) );
+ sal_uIntPtr nFontSize = aFontSize.ToInt32();
aFont.SetHeight( nFontSize );
- aFont.SetTransparent( FALSE );
-// aFont.SetAlign( ALIGN_BOTTOM );
-// aFont.SetHeight( aFont.GetHeight()+2 );
+ aFont.SetTransparent( sal_False );
pDataEdit->SetFont( aFont );
}
diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx
index 6e0bdbc7fd..77ecf1889b 100644
--- a/basic/source/app/apperror.hxx
+++ b/basic/source/app/apperror.hxx
@@ -37,13 +37,12 @@ public:
TYPEINFO();
AppError( BasicFrame*, String );
~AppError();
-// 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 0d393afa88..84633c6f88 100644
--- a/basic/source/app/appwin.cxx
+++ b/basic/source/app/appwin.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -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,19 +115,13 @@ void AppWin::Maximize()
nNormalPos = GetPosPixel();
nNormalSize = GetSizePixel();
- SetFloatingMode( FALSE );
+ SetFloatingMode( sal_False );
pFrame->nMaximizedWindows++;
nWinState = TT_WIN_STATE_MAX;
}
- sal_Int32 nTitleHeight;
- {
- sal_Int32 nDummy1, nDummy2, nDummy3;
- pFrame->GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 );
- }
- Size aSize = pFrame->GetOutputSizePixel();
- aSize.Height() -= nTitleHeight;
+ Size aSize = pFrame->GetInnerRect().GetSize();
aSize.Height() -= 2;
aSize.Width() -= 2;
SetSizePixel( aSize );
@@ -137,7 +131,7 @@ void AppWin::Maximize()
void AppWin::Restore()
{
- SetFloatingMode( TRUE );
+ SetFloatingMode( sal_True );
SetPosSizePixel( nNormalPos, nNormalSize );
if ( TT_WIN_STATE_MAX == nWinState )
@@ -147,7 +141,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 +150,7 @@ void AppWin::Minimize( BOOL bMinimize )
pFrame->WinMax_Restore();
}
-void AppWin::Cascade( USHORT nNr )
+void AppWin::Cascade( sal_uInt16 nNr )
{
Restore();
@@ -188,16 +182,14 @@ void AppWin::RequestHelp( const HelpEvent& )
void AppWin::Help()
{
String s = pDataEdit->GetSelected();
- if( s.Len() > 0 )
+ if( s.Len() > 0 )
{
// Trim leading whitespaces
- while( s.GetChar(0) == ' ' )
+ while( s.GetChar(0) == ' ' )
s.Erase( 0, 1 );
-// aBasicApp.pHelp->Start( s );
- }
- else
+ }
+ else
{
-// aBasicApp.pHelp->Start( OOO_HELP_INDEX );
}
}
@@ -216,7 +208,6 @@ void AppWin::GetFocus()
if( pDataEdit ) // GetFocus is called by the destructor, so this check
{
pDataEdit->GrabFocus();
-// InitMenu(GetpApp()->GetAppMenu()->GetPopupMenu( RID_APPEDIT ));
}
}
@@ -226,9 +217,9 @@ long AppWin::PreNotify( NotifyEvent& rNEvt )
if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
Activate();
if ( rNEvt.GetType() == EVENT_GETFOCUS )
- if ( pFrame->pList->Last() != this )
+ 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,35 +232,34 @@ 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 );
pMenu->EnableItem( RID_EDITPASTE, ( ::svt::OStringTransfer::PasteString( aTemp, this ) ) );
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 +276,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 +284,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;
@@ -317,12 +307,12 @@ void AppWin::Command( const CommandEvent& rCEvt )
case RID_EDITPASTE:
{
::rtl::OUString aTemp;
- if( ::svt::OStringTransfer::PasteString( aTemp, this ) )
+ if( ::svt::OStringTransfer::PasteString( aTemp, this ) )
pDataEdit->Paste();
}
break;
case RID_EDITDEL:
- /*if( bHasMark ) */pDataEdit->Delete();
+ pDataEdit->Delete();
break;
case RID_EDITUNDO:
pDataEdit->Undo();
@@ -336,7 +326,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 +337,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,22 +351,20 @@ 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 );
}
-// uncomment to avoid compiler warning
-// break;
case SINCE_LAST_ASK_RELOAD:
{
String aFilename( GetText() );
@@ -387,21 +375,19 @@ BOOL AppWin::DiskFileChanged( USHORT nWhat )
return ( !aLastAccess.GetError() != !aStat.GetError() )
|| aLastAccess.IsYounger( aStat ) || aStat.IsYounger( aLastAccess );
}
-// uncomment to avoid compiler warning
-// break;
default:
- DBG_ERROR("Not Implemented in AppWin::DiskFileChanged");
+ 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 );
}
@@ -415,7 +401,7 @@ void AppWin::UpdateFileInfo( USHORT nWhat )
}
break;
default:
- DBG_ERROR("Not Implemented in AppWin::UpdateFileInfo");
+ OSL_FAIL("Not Implemented in AppWin::UpdateFileInfo");
}
}
@@ -432,7 +418,6 @@ void AppWin::CheckReload()
if ( !aFile.Exists() )
return;
-// FileStat aStat( aFile );
if ( DiskFileChanged( SINCE_LAST_ASK_RELOAD ) && ReloadAllowed() )
{
@@ -446,7 +431,7 @@ void AppWin::CheckReload()
}
else
{
- bReloadAborted = TRUE;
+ bReloadAborted = sal_True;
}
}
}
@@ -457,17 +442,15 @@ 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;
bErr = !pDataEdit->Load( aName );
if( bErr )
{
@@ -493,17 +476,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 +496,7 @@ USHORT AppWin::ImplSave()
if ( pDataEdit->Save( aName ) )
{
nResult = SAVE_RES_SAVED;
- bHasFile = TRUE;
+ bHasFile = sal_True;
}
else
{
@@ -522,38 +505,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 +545,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 +560,7 @@ USHORT AppWin::QuerySave( QueryBits nBits )
}
pFrame->AlwaysEnableInput( bAlwaysEnableInput );
- USHORT nReturn;
+ sal_uInt16 nReturn;
switch( nResult )
{
case RET_YES:
@@ -590,14 +573,14 @@ USHORT AppWin::QuerySave( QueryBits nBits )
nReturn = SAVE_RES_CANCEL;
break;
default:
- DBG_ERROR("switch default where no default should be: Internal error");
+ 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 +589,15 @@ BOOL AppWin::Close()
{
DockingWindow::Close();
delete this;
- return TRUE;
+ return sal_True;
}
-// uncomment to avoid compiler warning
-// break;
case SAVE_RES_ERROR:
- return FALSE;
-// uncomment to avoid compiler warning
-// break;
+ return sal_False;
case SAVE_RES_CANCEL:
- return FALSE;
-// uncomment to avoid compiler warning
-// break;
+ return sal_False;
default:
- DBG_ERROR("Not Implemented in AppWin::Close");
- return FALSE;
+ OSL_FAIL("Not Implemented in AppWin::Close");
+ return sal_False;
}
}
@@ -630,7 +607,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 +619,7 @@ void AppWin::Replace()
ReplaceDialog* pDlg = new ReplaceDialog
(this, aResId, aFind, aReplace );
if( pDlg->Execute() ) {
- bFind = FALSE;
+ bFind = sal_False;
Repeat();
}
}
@@ -650,7 +627,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 ef3636045c..57dc9f0e4d 100644
--- a/basic/source/app/appwin.hxx
+++ b/basic/source/app/appwin.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -35,15 +35,17 @@
#include "app.hxx"
#include "dataedit.hxx"
-typedef USHORT QueryBits;
+#include <vector>
+typedef sal_uInt16 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
@@ -69,71 +71,70 @@ 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
-// Icon* pIcon; // Document icon
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; }
};
-DECLARE_LIST( EditList, AppWin* )
+typedef ::std::vector< AppWin* > EditList;
#endif
diff --git a/basic/source/app/basic.hrc b/basic/source/app/basic.hrc
index 634d86f30e..634d86f30e 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 4283e9981a..4402142cbf 100644
--- a/basic/source/app/basic.src
+++ b/basic/source/app/basic.src
@@ -29,25 +29,22 @@
#include "resids.hrc"
ModalDialog RID_CALLDLG {
+ HelpID = "basic:ModalDialog:RID_CALLDLG";
PosSize = MAP_SYSFONT (18,18,142,142);
SVLook = TRUE;
MOVEABLE = TRUE;
CLOSEABLE = TRUE;
-// WinChilds = {
-// FixedText {
-// Text = "Aktuelle Parameter";
-// PosSize = MAP_SYSFONT (10,10,120,8);
-// };
-// };
FixedText RID_RETTYPE {
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,44 +58,10 @@ 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;
-/*
- WINCHILDS = {
- FixedText {
- Pos = MAP_APPFONT( 40, 5 );
- Size = MAP_APPFONT( 110, 10 );
- TEXT = "Testtool";
- CENTER = TRUE;
- };
- FixedText {
- Pos = MAP_APPFONT( 40, 20 );
- Size = MAP_APPFONT( 110, 20 );
- TEXT = "Ojektorientiertes BASIC-Entwicklungssystem";
- CENTER = TRUE;
- };
- FixedText {
- Pos = MAP_APPFONT( 40, 45 );
- Size = MAP_APPFONT( 110, 10 );
- TEXT = "Version 2.0 May 2002";
- CENTER = TRUE;
- };
- FixedText {
- Pos = MAP_APPFONT( 40, 60 );
- Size = MAP_APPFONT( 110, 10 );
- TEXT = "�1995-2010 Oracle";
- CENTER = TRUE;
- };
- };
-*/
-// FixedIcon RID_ICON {
-// Pos = MAP_APPFONT( 20, 26 );
-// Size = MAP_APPFONT( 20, 20 );
-// FIXED = Icon {
-// FILE = "basic.ico";
-// };
-// };
OKButton RID_OK {
Pos = MAP_APPFONT( 55, 80 );
Size = MAP_APPFONT( 40, 14 );
@@ -107,6 +70,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,11 +102,11 @@ 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;
MOVEABLE = TRUE;
- // CLOSEABLE = TRUE; // It has a cancelbutton
FixedText RID_FIXEDTEXT1 {
Pos = MAP_APPFONT( 5, 10 );
@@ -150,6 +114,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,11 +137,11 @@ 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;
MOVEABLE = TRUE;
- // CLOSEABLE = TRUE; // It has a cancelbutton
FixedText RID_FIXEDTEXT1 {
Pos = MAP_APPFONT( 5, 10 );
Size = MAP_APPFONT( 55, 10 );
@@ -188,12 +153,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 );
@@ -415,15 +382,6 @@ String IDS_CANCEL {
String IDS_DISASWIN {
TEXT[ en-US ] = "Disassembly";
};
-//Icon RID_APPICON {
-// FILE = "basic.ico";
-//};
-//Icon RID_APPICON2 {
-// FILE = "testtool.ico";
-//};
-//Icon RID_WORKICON {
-// FILE = "work.ico";
-//};
Bitmap MBP_PLUS {
File = "plus.bmp";
@@ -532,12 +490,10 @@ Menu RID_EDIT {
MenuItem {
Identifier = RID_EDITUNDO;
TEXT[ en-US ] = "~Undo";
-// AccelKey = KeyCode { Function = KEYFUNC_CUT; };
};
MenuItem {
Identifier = RID_EDITREDO;
TEXT[ en-US ] = "~Redo";
-// AccelKey = KeyCode { Function = KEYFUNC_CUT; };
};
MenuItem {
SEPARATOR = TRUE;
@@ -578,7 +534,6 @@ Menu RID_EDIT {
Identifier = RID_EDITREPEAT;
TEXT[ en-US ] = "Repeat S~earch";
AccelKey = KeyCode { Code = KEY_F3; };
-// AccelKey = KeyCode { Function = KEYFUNC_REPEAT; };
};
};
};
@@ -607,11 +562,6 @@ Menu RID_RUN {
TEXT[ en-US ] = "Si~ngle Step over Procedure";
AccelKey = KeyCode { Code = KEY_F10; };
};
-// MenuItem {
-// Identifier = RID_RUNTOCURSOR;
-// TEXT = "Run to cursor";
-// AccelKey = KeyCode { Code = KEY_F7; };
-// };
MenuItem {
Identifier = RID_TOGLEBRKPNT;
TEXT[ en-US ] = "Set / Delete Break Point";
@@ -665,52 +615,11 @@ Menu RID_TT_EXTRAS {
};
Menu RID_WINDOW {
ITEMLIST = {
-/* MenuItem {
- Identifier = RID_WINCASCADE;
- TEXT[ en-US ] = "~Cascade";
- };
- MenuItem {
- Identifier = RID_WINTILE;
- TEXT[ en-US ] = "~Tile";
- };
- MenuItem {
- Identifier = RID_WINTILEHORZ;
- TEXT[ en-US ] = "~Arrange Horizontally";
- };
- MenuItem {
- Identifier = RID_WINTILEVERT;
- TEXT[ en-US ] = "~Arrange Vertically";
- };*/
};
};
Menu RID_HELP {
ITEMLIST = {
-/* MenuItem {
- Identifier = RID_HELPINDEX;
- TEXT = "~Index";
- };
MenuItem {
- SEPARATOR = TRUE;
- };
- MenuItem {
- Identifier = RID_HELPKEYS;
- TEXT = "~Tastaturbelegung";
- };
- MenuItem {
- Identifier = RID_HELPINTRO;
- TEXT = "~Anleitung";
- };
- MenuItem {
- SEPARATOR = TRUE;
- };
- MenuItem {
- Identifier = RID_HELPTOPIC;
- TEXT = "~Markierter Text";
- };
- MenuItem {
- SEPARATOR = TRUE;
- };
-*/ MenuItem {
ABOUT = TRUE;
Identifier = RID_HELPABOUT;
TEXT[ en-US ] = "~About...";
@@ -718,6 +627,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 +694,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 +704,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 +715,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 +734,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 +744,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 +753,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 +770,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 +780,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 +791,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 +820,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 +828,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 +890,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 +900,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 +911,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 +923,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 +937,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 +948,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 +958,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 +973,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 +985,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 +1004,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 +1029,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 +1045,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 +1062,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 +1079,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 +1089,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 +1101,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 +1112,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 +1128,7 @@ TabPage RID_TP_FONT {
FloatingWindow IDD_DISPLAY_HID {
+ HelpID = "basic:FloatingWindow:IDD_DISPLAY_HID";
OutputSize = TRUE;
SVLook = TRUE;
Size = MAP_APPFONT( 261, 160 );
@@ -1191,12 +1142,6 @@ FloatingWindow IDD_DISPLAY_HID {
Border = TRUE;
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 260, 14 );
-/* ItemList = {
- ToolBoxItem {
- Text = "erster der Toolbox";
- };
- };*/
-// Hide = TRUE;
};
FixedText RID_FT_CONTROLS {
Pos = MAP_APPFONT( 4, 16 );
@@ -1204,6 +1149,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 +1162,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 +1170,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 +1185,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;
@@ -1278,22 +1228,6 @@ Accelerator MAIN_ACCEL {
Identifier = RID_QUIT;
Key = KeyCode { Function = KEYFUNC_QUIT; };
};
-// AcceleratorItem {
-// Identifier = RID_EDITCUT;
-// Key = KeyCode { Function = KEYFUNC_CUT; };
-// };
-// AcceleratorItem {
-// Identifier = RID_EDITCOPY;
-// Key = KeyCode { Function = KEYFUNC_COPY; };
-// };
-// AcceleratorItem {
-// Identifier = RID_EDITPASTE;
-// Key = KeyCode { Function = KEYFUNC_PASTE; };
-// };
-// AcceleratorItem {
-// Identifier = RID_EDITDEL;
-// Key = KeyCode { Function = KEYFUNC_DELETE; };
-// };
AcceleratorItem {
Identifier = RID_EDITSEARCH;
Key = KeyCode { Function = KEYFUNC_FIND; };
@@ -1301,7 +1235,6 @@ Accelerator MAIN_ACCEL {
AcceleratorItem {
Identifier = RID_EDITREPEAT;
Key = KeyCode { Code = KEY_F3; };
-// Key = KeyCode { Function = KEYFUNC_REPEAT; };
};
AcceleratorItem {
Identifier = RID_RUNSTART;
@@ -1356,6 +1289,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 +1320,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 +1328,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 +1336,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 +1351,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 +1366,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 +1388,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 94c445dd44..9330cae2dc 100644
--- 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 feea22a61d..feea22a61d 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 ba96cf55f5..208272ee01 100644
--- a/basic/source/app/basmsg.src
+++ b/basic/source/app/basmsg.src
@@ -30,7 +30,6 @@
// Here are included the messages of the folder /basic/source/app
-///////////////////////////////
// Error messages which go to the result file.
// *********************
// *** !!ATTENTION!! ***
@@ -38,7 +37,6 @@
// The numbers must NEVER(!) change,
// because they are saved in the result files and a renewed display
// would display new strings or no strings.
-///////////////////////////////
String S_PROG_START
{
diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx
index 60195971b9..c4358a7848 100644
--- a/basic/source/app/brkpnts.cxx
+++ b/basic/source/app/brkpnts.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -28,7 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#include <tools/list.hxx>
#include <basic/sbx.hxx>
#include <basic/sbmod.hxx>
#include <basic/sbstar.hxx>
@@ -47,21 +46,18 @@
struct Breakpoint
{
- USHORT nLine;
-
- Breakpoint( USHORT nL ) { nLine = nL; }
+ sal_uInt32 nLine;
+ Breakpoint( sal_uInt32 nL ) { nLine = nL; }
};
-
ImageList* BreakpointWindow::pImages = NULL;
-
BreakpointWindow::BreakpointWindow( Window *pParent )
: Window( pParent )
, nCurYOffset( 0 )
, nMarkerPos( MARKER_NOMARKER )
, pModule( NULL )
-, bErrorMarker( FALSE )
+, bErrorMarker( sal_False )
{
if ( !pImages )
pImages = new ImageList( SttResId( RID_IMGLST_LAYOUT ) );
@@ -75,13 +71,9 @@ BreakpointWindow::BreakpointWindow( Window *pParent )
void BreakpointWindow::Reset()
{
- Breakpoint* pBrk = First();
- while ( pBrk )
- {
- delete pBrk;
- pBrk = Next();
- }
- Clear();
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
+ delete BreakpointList[ i ];
+ BreakpointList.clear();
pModule->ClearAllBP();
}
@@ -89,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 ) );
@@ -102,16 +94,15 @@ void BreakpointWindow::SetBPsInModule()
{
pModule->ClearAllBP();
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- pModule->SetBP( (USHORT)pBrk->nLine );
+ Breakpoint* pBrk = BreakpointList[ i ];
+ 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
- pBrk = Next();
}
- 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)" );
@@ -120,27 +111,30 @@ void BreakpointWindow::SetBPsInModule()
}
-void BreakpointWindow::InsertBreakpoint( USHORT nLine )
+void BreakpointWindow::InsertBreakpoint( sal_uInt32 nLine )
{
Breakpoint* pNewBrk = new Breakpoint( nLine );
- Breakpoint* pBrk = First();
- while ( pBrk )
+
+ for ( ::std::vector< Breakpoint* >::iterator i = BreakpointList.begin();
+ i < BreakpointList.end();
+ ++ i
+ )
{
+ Breakpoint* pBrk = *i;
if ( nLine <= pBrk->nLine )
{
- if ( pBrk->nLine != nLine )
- Insert( pNewBrk );
+ if ( nLine != pBrk->nLine )
+ BreakpointList.insert( i, pNewBrk );
else
delete pNewBrk;
pNewBrk = NULL;
- pBrk = NULL;
+ break;
}
- else
- pBrk = Next();
}
+
// No insert position found => LIST_APPEND
if ( pNewBrk )
- Insert( pNewBrk, LIST_APPEND );
+ BreakpointList.push_back( pNewBrk );
Invalidate();
@@ -151,7 +145,7 @@ void BreakpointWindow::InsertBreakpoint( USHORT 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)" );
@@ -165,35 +159,34 @@ void BreakpointWindow::InsertBreakpoint( USHORT nLine )
}
-Breakpoint* BreakpointWindow::FindBreakpoint( ULONG nLine )
+Breakpoint* BreakpointWindow::FindBreakpoint( sal_uInt32 nLine )
{
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- if ( pBrk->nLine == nLine )
- return pBrk;
-
- pBrk = Next();
+ Breakpoint* pBP = BreakpointList[ i ];
+ if ( pBP->nLine == nLine )
+ return pBP;
}
-
- return (Breakpoint*)0;
+ return NULL;
}
-void BreakpointWindow::AdjustBreakpoints( ULONG nLine, BOOL bInserted )
+void BreakpointWindow::AdjustBreakpoints( sal_uInt32 nLine, bool bInserted )
{
if ( nLine == 0 ) //TODO: nLine == TEXT_PARA_ALL+1
return;
- Breakpoint* pBrk = First();
- while ( pBrk )
+
+ for ( size_t i = 0; i < BreakpointList.size(); )
{
- BOOL bDelBrk = FALSE;
+ Breakpoint* pBrk = BreakpointList[ i ];
+ bool bDelBrk = false;
+
if ( pBrk->nLine == nLine )
{
if ( bInserted )
pBrk->nLine++;
else
- bDelBrk = TRUE;
+ bDelBrk = true;
}
else if ( pBrk->nLine > nLine )
{
@@ -202,18 +195,19 @@ void BreakpointWindow::AdjustBreakpoints( ULONG nLine, BOOL bInserted )
else
pBrk->nLine--;
}
-
if ( bDelBrk )
{
- ULONG n = GetCurPos();
- delete Remove( pBrk );
- pBrk = Seek( n );
+ delete pBrk;
+ ::std::vector< Breakpoint* >::iterator it = BreakpointList.begin();
+ ::std::advance( it, i );
+ BreakpointList.erase( it );
}
else
{
- pBrk = Next();
+ ++i;
}
}
+
Invalidate();
}
@@ -231,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() );
}
}
@@ -240,14 +234,12 @@ void BreakpointWindow::SaveBreakpoints( String aFilename )
{
ByteString aBreakpoints;
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
+ Breakpoint* pBrk = BreakpointList[ i ];
if ( aBreakpoints.Len() )
aBreakpoints += ';';
-
aBreakpoints += ByteString::CreateFromInt32( pBrk->nLine );
- pBrk = Next();
}
Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
@@ -273,56 +265,62 @@ void BreakpointWindow::Paint( const Rectangle& )
aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2;
aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2;
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
+ Breakpoint* pBrk = BreakpointList[ i ];
#if OSL_DEBUG_LEVEL > 1
DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
#endif
- ULONG nLine = pBrk->nLine-1;
- ULONG nY = nLine*nLineHeight - nCurYOffset;
+ sal_Int32 nLine = pBrk->nLine-1;
+ sal_Int32 nY = nLine*nLineHeight - nCurYOffset;
DrawImage( Point( 0, nY ) + aBmpOff, aBrk );
- pBrk = Next();
}
- ShowMarker( TRUE );
+ ShowMarker( sal_True );
}
Breakpoint* BreakpointWindow::FindBreakpoint( const Point& rMousePos )
{
- long nLineHeight = GetTextHeight();
- long nYPos = rMousePos.Y() + nCurYOffset;
+ sal_Int32 nLineHeight = GetTextHeight();
+ sal_Int32 nYPos = rMousePos.Y() + nCurYOffset;
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- ULONG nLine = pBrk->nLine-1;
- long nY = nLine*nLineHeight;
+ Breakpoint* pBrk = BreakpointList[ i ];
+ sal_Int32 nLine = pBrk->nLine-1;
+ sal_Int32 nY = nLine * nLineHeight;
if ( ( nYPos > nY ) && ( nYPos < ( nY + nLineHeight ) ) )
return pBrk;
- pBrk = Next();
}
- return 0;
+ return NULL;
}
-void BreakpointWindow::ToggleBreakpoint( USHORT nLine )
+void BreakpointWindow::ToggleBreakpoint( sal_uInt32 nLine )
{
- Breakpoint* pBrk = FindBreakpoint( nLine );
- if ( pBrk ) // remove
+ bool Removed = false;
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
- pModule->ClearBP( nLine );
- delete Remove( pBrk );
+ Breakpoint* pBP = BreakpointList[ i ];
+ if ( pBP->nLine == nLine ) // remove
+ {
+ pModule->ClearBP( nLine );
+ delete pBP;
+ ::std::vector< Breakpoint* >::iterator it = BreakpointList.begin();
+ ::std::advance( it, i );
+ BreakpointList.erase( it );
+ Removed = true;
+ break;
+ }
}
- else // create one
- {
+
+ if ( !Removed ) // create one
InsertBreakpoint( nLine );
- }
Invalidate();
}
-void BreakpointWindow::ShowMarker( BOOL bShow )
+void BreakpointWindow::ShowMarker( bool bShow )
{
if ( nMarkerPos == MARKER_NOMARKER )
return;
@@ -342,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 )
@@ -360,23 +358,23 @@ 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();
}
}
-void BreakpointWindow::SetMarkerPos( USHORT nLine, BOOL bError )
+void BreakpointWindow::SetMarkerPos( sal_uInt32 nLine, bool bError )
{
- ShowMarker( FALSE ); // Remove old one
+ ShowMarker( false ); // Remove old one
nMarkerPos = nLine;
bErrorMarker = bError;
- ShowMarker( TRUE ); // Draw new one
+ ShowMarker( true ); // Draw new one
Update();
}
-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 a9c08105e1..0ded6d8c89 100644
--- a/basic/source/app/brkpnts.hxx
+++ b/basic/source/app/brkpnts.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -27,70 +27,52 @@
************************************************************************/
#include <vcl/window.hxx>
+#include <vector>
#define MARKER_NOMARKER 0xFFFF
-
class SbModule;
-class BreakpointListe;
struct Breakpoint;
class ImageList;
-DECLARE_LIST( BreakpointList, Breakpoint* )
-
-class BreakpointWindow : public Window, public BreakpointList
+class BreakpointWindow : public Window
{
using Window::Scroll;
public:
BreakpointWindow( Window *pParent );
-// ~BreakpointWindow();
void Reset();
void SetModule( SbModule *pMod );
void SetBPsInModule();
- void InsertBreakpoint( USHORT nLine );
- void ToggleBreakpoint( USHORT nLine );
- void AdjustBreakpoints( ULONG nLine, BOOL bInserted );
+ void InsertBreakpoint( sal_uInt32 nLine );
+ void ToggleBreakpoint( sal_uInt32 nLine );
+ void AdjustBreakpoints( sal_uInt32 nLine, bool bInserted );
void LoadBreakpoints( String aFilename );
void SaveBreakpoints( String aFilename );
-protected:
- Breakpoint* FindBreakpoint( ULONG nLine );
-
private:
- long nCurYOffset;
- USHORT nMarkerPos;
- SbModule* pModule;
- BOOL bErrorMarker;
- static ImageList *pImages;
+ ::std::vector< Breakpoint* > BreakpointList;
+ long nCurYOffset;
+ sal_uInt32 nMarkerPos;
+ SbModule* pModule;
+ bool bErrorMarker;
+ static ImageList* pImages;
protected:
- virtual void Paint( const Rectangle& );
- Breakpoint* FindBreakpoint( const Point& rMousePos );
- void ShowMarker( BOOL bShow );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& );
+ Breakpoint* FindBreakpoint( const Point& rMousePos );
+ Breakpoint* FindBreakpoint( sal_uInt32 nLine );
+ void ShowMarker( bool bShow );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
public:
-
-// void SetModulWindow( ModulWindow* pWin )
-// { pModulWindow = pWin; }
-
- void SetMarkerPos( USHORT nLine, BOOL bErrorMarker = FALSE );
-
- virtual void Scroll( long nHorzScroll, long nVertScroll,
- USHORT nFlags = 0 );
- long& GetCurYOffset() { return nCurYOffset; }
+ void SetMarkerPos( sal_uInt32 nLine, bool bErrorMarker = false );
+ virtual void Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags = 0 );
+ long& GetCurYOffset() { return nCurYOffset; }
};
-
-
-
-
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx
index bf0761665f..931eddd27b 100644
--- 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 c55b4dd922..8ccf09f836 100644
--- a/basic/source/app/dialogs.cxx
+++ b/basic/source/app/dialogs.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -74,7 +74,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& id )
FreeResource();
}
-////////////////////////////////////////////////////////////////////
FindDialog::FindDialog( Window* pParent, const ResId& id, String& Text )
: ModalDialog( pParent, id )
@@ -95,9 +94,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,12 +124,11 @@ 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;
}
-////////////////////////////////////////////////////////////////////
void CheckButtons( ComboBox &aCB, Button &aNewB, Button &aDelB )
@@ -150,7 +148,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 +157,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 +195,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 +245,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 +259,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 ) )
{
@@ -301,7 +299,7 @@ IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl )
case RID_TP_FON:
pNewTabPage = new FontOptions( pTabCtrl, aConfig );
break;
- default: DBG_ERROR( "PageHdl: Unbekannte ID!" );
+ default: OSL_FAIL( "PageHdl: Unbekannte ID!" );
}
DBG_ASSERT( pNewTabPage, "Keine Page!" );
pTabCtrl->SetTabPage( nId, pNewTabPage );
@@ -314,7 +312,7 @@ IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl )
IMPL_LINK( OptionsDialog, OKClick, Button *, pButton )
{
- (void) pButton; /* avoid warning about unused parameter */
+ (void) pButton; /* avoid warning about unused parameter */
aConfig.EnablePersistence();
GenericOptions *pGeneric;
pGeneric = (GenericOptions*)aTabCtrl.GetTabPage( RID_TP_GEN );
@@ -349,7 +347,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 +369,7 @@ ProfileOptions::ProfileOptions( Window* pParent, Config &rConfig )
{
FreeResource();
- aCbProfile.EnableAutocomplete( TRUE );
+ aCbProfile.EnableAutocomplete( sal_True );
aCbProfile.SetSelectHdl( LINK( this, ProfileOptions, Select ) );
@@ -386,7 +384,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 ) )
@@ -468,7 +466,7 @@ IMPL_LINK( ProfileOptions, NewProfile, Button*, EMPTYARG )
IMPL_LINK( ProfileOptions, CheckButtonsHdl, ComboBox*, pCB )
{
- (void) pCB; /* avoid warning about unused parameter */
+ (void) pCB; /* avoid warning about unused parameter */
CheckButtons( aCbProfile, aPbNewProfile, aPbDelProfile );
return 0;
}
@@ -507,7 +505,7 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig )
{
FreeResource();
- aNFCRPort.SetUseThousandSep( FALSE );
+ aNFCRPort.SetUseThousandSep( sal_False );
ByteString aTemp;
@@ -517,7 +515,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 +530,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 +596,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 +646,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() ) );
@@ -677,9 +675,6 @@ FontOptions::FontOptions( Window* pParent, Config &aConfig )
aFontName.EnableWYSIWYG();
aFontName.EnableSymbols();
-// aFontSize.SetUnit( FUNIT_POINT );
-// MapMode aMode( MAP_POINT );
-// aFTPreview.SetMapMode( aMode );
aFontName.SetModifyHdl( LINK( this, FontOptions, FontNameChanged ) );
aFontStyle.SetModifyHdl( LINK( this, FontOptions, FontStyleChanged ) );
@@ -722,8 +717,7 @@ 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 = static_cast<sal_uIntPtr>((aFontSize.GetValue() + 5) / 10);
aFont.SetHeight( nFontSize );
aFTPreview.SetFont( aFont );
aFTPreview.SetText( aFontName.GetText() );
@@ -757,13 +751,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,10 +783,10 @@ 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->Insert( pGroup );
+ pGroups->push_back( pGroup );
}
return pGroups;
}
@@ -800,44 +794,42 @@ StringList* GenericOptions::GetAllGroups()
void GenericOptions::LoadData()
{
StringList* pGroups = GetAllGroups();
- String* pGroup;
- while ( (pGroup = pGroups->First()) != NULL )
+ for ( size_t i = 0, n = pGroups->size(); i < n; ++i )
{
- pGroups->Remove( pGroup );
+ String* pGroup = pGroups->at( i );
aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) );
if ( aConf.ReadKey( C_KEY_AKTUELL ).Len() > 0 )
- {
aCbArea.InsertEntry( *pGroup );
- }
delete pGroup;
}
+ pGroups->clear();
delete pGroups;
- aCbArea.SetText( aCbArea.GetEntry( 0 ) );
+ aCbArea.SetText( aCbArea.GetEntry( 0 ) );
CheckButtons( aCbArea, aPbNewArea, aPbDelArea );
// Add load the data
LINK( this, GenericOptions, LoadGroup ).Call( NULL );
}
-void GenericOptions::ShowSelectPath( const String aType )
+void GenericOptions::ShowSelectPath( const String &rType )
{
Point aNPos = aPbNewValue.GetPosPixel();
Point aDPos = aPbDelValue.GetPosPixel();
long nDelta = aDPos.Y() - aNPos.Y();
- if ( aType.EqualsIgnoreCaseAscii( "PATH" ) && !bShowSelectPath )
+ if ( rType.EqualsIgnoreCaseAscii( "PATH" ) && !bShowSelectPath )
{ // 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 ( !aType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath )
+ 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 );
}
}
@@ -890,7 +882,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 )
@@ -993,7 +985,7 @@ IMPL_LINK( GenericOptions, CheckButtonsHdl, ComboBox*, pCB )
void GenericOptions::Save( Config &aConfig )
{
- (void) aConfig; /* avoid warning about unused parameter */
+ (void) aConfig; /* avoid warning about unused parameter */
DBG_ASSERT( &aConfig == &aConf, "Saving to different Configuration" );
// Save changes
@@ -1008,16 +1000,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 )
@@ -1083,15 +1075,6 @@ DisplayHidDlg::DisplayHidDlg( Window * pParent )
{
FreeResource();
-/* ResMgr* pRM = CREATERESMGR( svt );
- ToolBox aOrig( this, ResId( 12345, pRM ) );
- delete pRM;
-
- aTbConf.CopyItem( aOrig, 4 );
- aTbConf.InsertSeparator();
- aTbConf.CopyItem( aOrig, 5 );
- aTbConf.CopyItem( aOrig, 6 );
- aTbConf.CopyItem( aOrig, 7 ); */
aTbConf.SetOutStyle( TOOLBOX_STYLE_FLAT );
#if OSL_DEBUG_LEVEL < 2
@@ -1099,8 +1082,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 );
@@ -1126,7 +1109,7 @@ DisplayHidDlg::~DisplayHidDlg()
IMPL_LINK( DisplayHidDlg, CopyToClipboard, void*, EMPTYARG )
{
String aSammel;
- USHORT i;
+ sal_uInt16 i;
for ( i=0 ; i < aMlbControls.GetSelectEntryCount() ; i++ )
{
@@ -1148,7 +1131,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++ )
@@ -1251,8 +1234,6 @@ void DisplayHidDlg::Resize()
}
else
{
-// SetUpdateMode( FALSE );
-
// Minimum size
Size aSize( GetOutputSizePixel() );
aSize.Width() = std::max( aSize.Width(), (long)(aOKClose.GetSizePixel().Width() * 3 ));
@@ -1306,9 +1287,6 @@ void DisplayHidDlg::Resize()
aPos.Move( nSpace, -aOKClose.GetSizePixel().Height() );
aPos.Move( pSplit->GetSizePixel().Width(), pSplit->GetSizePixel().Height() );
aOKClose.SetPosPixel( aPos );
-
-// SetUpdateMode( TRUE );
-// Invalidate();
}
FloatingWindow::Resize();
}
@@ -1348,9 +1326,6 @@ VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar )
else
aRadioButtonRID_RB_NEW_BOOL_F.Check();
break;
-// case SbxCURRENCY:
-// case SbxDATE:
-// break;
case SbxINTEGER:
aNumericFieldRID_NF_NEW_INTEGER.Show();
aNumericFieldRID_NF_NEW_INTEGER.SetText( pVar->GetString() );
@@ -1364,8 +1339,6 @@ VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar )
aNumericFieldRID_NF_NEW_LONG.SetMin( -aNumericFieldRID_NF_NEW_LONG.GetMax()-1 );
aNumericFieldRID_NF_NEW_LONG.SetFirst( -aNumericFieldRID_NF_NEW_LONG.GetLast()-1 );
break;
-// case SbxOBJECT: // cannot be edited
-// break;
case SbxSINGLE:
case SbxDOUBLE:
case SbxSTRING:
@@ -1386,67 +1359,26 @@ 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
+ (void) pButton; /* avoid warning about unused parameter */
+ sal_Bool bWasError = SbxBase::IsError(); // Probably an error is thrown
SbxDataType eType = pVar->GetType();
-/*
-Boolean
-Currency
-Date
-Double
-Integer
-Long
-Object
-Single
-String
-Variant
-
-
-atof
-
- ecvt
- f
- gcvt
-
-SvNumberformat::
- static double StringToDouble( const xub_Unicode* pStr,
- const International& rIntl,
- int& nErrno,
- const xub_Unicode** ppEnd = NULL );
- // Converts just as strtod a decimal string to a double.
- // Decimal and thousand separators come from International,
- // leading spaces are omitted.
- // If ppEnd!=NULL then *ppEnd is set after the parsed data.
- // If pStr contains only the String to be parsed, then if success:
- // **ppEnd=='\0' and *ppEnd-pStr==strlen(pStr).
- // If overflow fVal=+/-HUGE_VAL, if underflow 0,
- // nErrno is in this cases set to ERANGE otherwise 0.
- // "+/-1.#INF" are recognized as +/-HUGE_VAL.
-
- */
String aContent( aEditRID_ED_NEW_STRING.GetText() );
- BOOL bError = FALSE;
+ sal_Bool bError = sal_False;
switch ( eType )
{
case SbxBOOL:
pVar->PutBool( aRadioButtonRID_RB_NEW_BOOL_T.IsChecked() );
break;
-// case SbxCURRENCY:
-// pVar->PutCurrency( aContent );
-// break;
-// case SbxDATE:
-// 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:
@@ -1464,10 +1396,9 @@ SvNumberformat::
}
-// pVar->PutStringExt( aEditRID_ED_NEW_STRING.GetText() );
if ( !bWasError && SbxBase::IsError() )
{
- bError = TRUE;
+ bError = sal_True;
SbxBase::ResetError();
}
@@ -1477,12 +1408,6 @@ SvNumberformat::
return 1;
}
-// if ( aEditRID_ED_NEW_STRING.GetText().Compare( pVar->GetString() ) != COMPARE_EQUAL )
-// {
-// aFixedTextRID_FT_CONTENT_VALUE.SetText( pVar->GetString() );
-// aEditRID_ED_NEW_STRING.SetText( pVar->GetString() );
-// return 1;
-// }
Close();
return 0;
diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx
index 7e9c78bae3..d1fa15dd98 100644
--- a/basic/source/app/dialogs.hxx
+++ b/basic/source/app/dialogs.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -38,12 +38,12 @@
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <tools/config.hxx>
-#include <tools/list.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/toolbox.hxx>
#include <svtools/ctrltool.hxx>
#include <svtools/ctrlbox.hxx>
+#include <vector>
class SbxVariable;
@@ -81,7 +81,6 @@ public:
ReplaceDialog (Window*, const ResId&, String&, String&);
};
-////////////////////////////////////////////////////////////////////
class ConfEdit : public PushButton
{
@@ -93,8 +92,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 +109,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 +129,7 @@ private:
public:
OptionsDialog( Window* pParent, const ResId& );
~OptionsDialog();
- virtual BOOL Close();
+ virtual sal_Bool Close();
DECL_LINK( ActivatePageHdl, TabControl * );
@@ -239,8 +238,7 @@ public:
void Save( Config &aConfig );
};
-
-DECLARE_LIST( StringList, String * )
+typedef ::std::vector< String* > StringList;
#define C_KEY_ALLE CByteString("All")
#define C_KEY_AKTUELL CByteString("Current")
#define C_KEY_TYPE CByteString("Type")
@@ -262,7 +260,7 @@ class GenericOptions : public TabPage
PushButton aPbDelValue;
int nMoveButtons;
- BOOL bShowSelectPath;
+ sal_Bool bShowSelectPath;
AutoTimer aMoveTimer;
DECL_LINK( MoveButtons, AutoTimer* );
@@ -273,7 +271,7 @@ class GenericOptions : public TabPage
StringList* GetAllGroups();
void LoadData();
- void ShowSelectPath( const String aType );
+ void ShowSelectPath( const String& rType );
DECL_LINK( LoadGroup, ComboBox* );
DECL_LINK( DelGroup, Button* );
@@ -310,7 +308,7 @@ protected:
DockingWindow* pSlots;
SplitWindow *pSplit;
- ULONG nDisplayMode;
+ sal_uIntPtr nDisplayMode;
DECL_LINK( Select, void* );
DECL_LINK( SelectAll, PushButton* );
@@ -349,9 +347,6 @@ protected:
DECL_LINK( OKClick, Button * );
-// BOOL bCompare = FALSE;
-// String aCompareString;
-
public:
VarEditDialog( Window * pParent, SbxVariable *pPVar );
};
diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk
index e62b11c0be..e62b11c0be 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 2832e45a88..05ddf36042 100644
--- 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,13 +69,12 @@ 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 )
{
-// SetFont( aEditTree.GetDefaultFont( DEFAULTFONT_FIXED, aEditTree.GetSettings().GetLanguage(), 0, &aEditTree ) );
aEditTree.SetNodeBitmaps( Bitmap( SttResId (MBP_PLUS) ), Bitmap( SttResId (MBP_MINUS) ) );
aEditTree.SetSelectionMode( MULTIPLE_SELECTION );
if ( aEditTree.GetModel()->GetSortMode() != SortNone )
@@ -83,15 +82,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;
}
}
}
@@ -167,16 +166,16 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg )
case LOG_ASSERTION: AddAssertion( aUILogMsg, LogMsg->aDebugData ); break;
case LOG_ASSERTION_STACK: AddAssertionStack( aUILogMsg, LogMsg->aDebugData ); break;
case LOG_QA_ERROR: AddQAError( aUILogMsg, LogMsg->aDebugData ); break;
- default:DBG_ERROR("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust");
+ default:OSL_FAIL("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust");
}
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 +223,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 +234,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 +243,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 +264,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 +286,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 +297,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 +306,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 +328,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 +356,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 +380,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 +404,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 );
}
@@ -422,36 +421,6 @@ void MsgEdit::AddQAError( String aMsg, TTDebugData aDebugData )
aEditTree.InvalidateEntry( pThisEntry );
}
-/*
- SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return SvLBox::GetEntry(pParent,nPos); }
- SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return SvLBox::GetEntry(nRootPos);}
-
-
-
- SvLBoxEntry* FirstChild(SvLBoxEntry* pParent ) const { return (SvLBoxEntry*)(pModel->FirstChild(pParent)); }
- SvLBoxEntry* NextSibling(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->NextSibling( pEntry )); }
- SvLBoxEntry* PrevSibling(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->PrevSibling( pEntry )); }
-
- SvLBoxEntry* FirstSelected() const { return (SvLBoxEntry*)SvListView::FirstSelected(); }
- SvLBoxEntry* NextSelected( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(SvListView::NextSelected(pEntry)); }
- 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* 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;
- SvListEntry* GetParent( SvListEntry* pEntry ) const;
- SvListEntry* GetRootLevelParent( SvListEntry* pEntry ) const;
-*/
-
-//#define CHECK( pMemo ) if ( pMemo && !aEditTree.GetViewData( pMemo ) ) pMemo = NULL
#define CHECK( pMemo ) if ( pMemo && !aEditTree.GetModel()->IsInChildList( NULL, pMemo ) ) pMemo = NULL
void MsgEdit::Delete()
{
@@ -460,11 +429,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(); }
@@ -486,7 +455,7 @@ String MsgEdit::Impl_MakeText( SvLBoxEntry *pEntry ) const
case LOG_ASSERTION: break;
case LOG_ASSERTION_STACK:aRet.AppendAscii("--> "); break;
case LOG_QA_ERROR: break;
- default:DBG_ERROR("Unknown type in ResultWindow!");
+ default:OSL_FAIL("Unknown type in ResultWindow!");
}
aRet += aEditTree.GetEntryText( pEntry );
return aRet;
@@ -543,10 +512,9 @@ String MsgEdit::GetSelected()
TextSelection MsgEdit::GetSelection() const
{
- ULONG nStart=0,nEnd=0;
-
if ( aEditTree.FirstSelected() )
{
+ sal_uIntPtr nStart=0,nEnd=0;
nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() );
if ( aEditTree.LastSelected() )
nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() );
@@ -558,25 +526,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;
}
@@ -585,10 +553,10 @@ void MsgEdit::ReplaceSelected( const String& rStr )
{
(void) rStr; /* avoid warning about unused parameter */
Sound::Beep();
- DBG_ERROR("Not Implemented");
+ 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
@@ -609,19 +577,19 @@ void MsgEdit::SetText( const String& rStr )
{
(void) rStr; /* avoid warning about unused parameter */
Sound::Beep();
- DBG_ERROR("Not Implemented");
+ 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
@@ -631,11 +599,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;
}
/******************************************************************
@@ -648,17 +616,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 )
{
@@ -668,7 +636,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 )
@@ -678,9 +646,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
@@ -693,13 +661,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 )
@@ -707,16 +675,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() )
{
@@ -754,16 +722,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;
}
@@ -772,10 +740,9 @@ TTTreeListBox::TTTreeListBox( AppError* pParent, BasicFrame* pBF, WinBits nWinSt
: SvTreeListBox( pParent, nWinStyle )
, pBasicFrame(pBF)
, pAppError( pParent )
-//, nDeselectParent(0)
{}
-BOOL TTTreeListBox::JumpToSourcecode( SvLBoxEntry *pThisEntry )
+sal_Bool TTTreeListBox::JumpToSourcecode( SvLBoxEntry *pThisEntry )
{
if ( pThisEntry && pThisEntry->GetUserData() && ((TTDebugData*)pThisEntry->GetUserData())->aFilename.Len() > 0 )
{
@@ -811,57 +778,16 @@ 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 )
-{
- SvLBoxEntry *pEntry = FirstChild( pParent );
- ULONG nRet = 0;
- while ( pEntry )
- {
- nRet++;
- Select( pEntry, bSelect );
- pEntry = NextSibling( pEntry );
- }
- return nRet;
-}
-
-
-void TTTreeListBox::SelectHdl()
-{
- SvLBoxEntry* pHdlEntry = GetHdlEntry();
-
- SelectChildren( pHdlEntry, TRUE );
- Select( pHdlEntry, TRUE );
-// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // so that delete works correct
-}
-
-void TTTreeListBox::DeselectHdl()
-{
- SvLBoxEntry* pHdlEntry = GetHdlEntry();
- if ( GetParent( pHdlEntry ) )
- {
- nDeselectParent++;
- Select( GetParent( pHdlEntry ), FALSE );
- nDeselectParent--;
- }
- if ( !nDeselectParent )
- {
- SelectChildren( pHdlEntry, FALSE );
- Select( pHdlEntry, FALSE );
- }
- Invalidate();
-} */
-
-
void TTTreeListBox::KeyInput( const KeyEvent& rKEvt )
{
switch ( rKEvt.GetKeyCode().GetFunction() )
@@ -917,7 +843,7 @@ TTFeatures TTTreeListBox::GetFeatures( SvLBoxEntry* pEntry )
case LOG_QA_ERROR:
return HasQAError;
default:
- DBG_ERROR("Unknown type in ResultWindow");
+ OSL_FAIL("Unknown type in ResultWindow");
}
return HasNothing;
}
@@ -927,15 +853,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 );
@@ -959,7 +885,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 );
}
@@ -985,7 +911,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 7dc7117a8b..8d9c703746 100644
--- 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)
@@ -49,26 +49,21 @@ typedef USHORT TTFeatures; // Bitfield for features of the entries
class TTTreeListBox : public SvTreeListBox
{
protected:
-// virtual void Command( const CommandEvent& rCEvt );
-// USHORT 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 );
~TTTreeListBox(){}
-// 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 );
TTFeatures GetFeatures( SvLBoxEntry* );
};
@@ -80,20 +75,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 +103,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 22bf7f688c..c26bce8449 100644
--- a/basic/source/app/mybasic.cxx
+++ b/basic/source/app/mybasic.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -32,14 +32,6 @@
#include <vcl/msgbox.hxx>
#include <basic/sbx.hxx>
-// AB-Uno-Test
-//#define unotest
-#ifdef unotest
-#include <usr/uno.hxx>
-#include <basic/sbuno.hxx>
-#include <sbunoobj.hxx>
-#endif
-
#include "sbintern.hxx"
#include <basic/ttstrhlp.hxx>
@@ -60,7 +52,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 +60,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;
@@ -79,6 +71,7 @@ SbxBase* MyFactory::Create( UINT16 nSbxId, UINT32 nCr )
MyBasic::MyBasic() : StarBASIC()
{
nError = 0;
+ CurrentError = 0;
if( !nInst++ )
{
AddFactory( &aFac1 );
@@ -89,21 +82,6 @@ MyBasic::MyBasic() : StarBASIC()
p->SetName( CUniString("Objects") );
Insert( p );
- // AB-Uno-Test
-#ifdef unotest
- // Get Uno-Service-Manager and Reflection Service
- createAndSetDefaultServiceManager(); // done later
-
- // Get Uno-Test-Object
- UsrAny aObjAny = getIntrospectionTestObject();
-
- // Box object into SbUnoObject
- String aName( "UnoObject" );
- SbxObjectRef xSbUnoObj = GetSbUnoObject( aName, aObjAny );
- //SbxObjectRef xSbUnoObj = new SbUnoObject( aName, aObjAny );
- Insert( (SbxObject*)xSbUnoObj );
-#endif
-
pTestObject = NULL;
}
@@ -151,17 +129,17 @@ 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 */
+ (void) rSymbol; /* avoid warning about unused parameter */
+ (void) bWasTTControl; /* avoid warning about unused parameter */
return SB_SYMBOL; // Everything here is of type SB_SYMBOL and continues to be so
}
MyBasic::~MyBasic()
{
- aErrors.Clear();
+ Reset();
if( !--nInst )
{
RemoveFactory( &aFac1 );
@@ -172,17 +150,49 @@ MyBasic::~MyBasic()
void MyBasic::Reset()
{
- aErrors.Clear();
+ for ( size_t i = 0, n = aErrors.size(); i < n; ++i ) delete aErrors[ i ];
+ aErrors.clear();
nError = 0;
+ CurrentError = 0;
}
-BOOL MyBasic::Compile( SbModule* p )
+sal_Bool MyBasic::Compile( SbModule* p )
{
Reset();
return StarBASIC::Compile( p );
}
-BOOL MyBasic::ErrorHdl()
+BasicError* MyBasic::NextError()
+{
+ if ( CurrentError < ( aErrors.size() - 1 ) )
+ {
+ ++CurrentError;
+ return aErrors[ CurrentError ];
+ }
+ return NULL;
+}
+
+BasicError* MyBasic::PrevError()
+{
+ if ( !aErrors.empty() && CurrentError > 0 )
+ {
+ --CurrentError;
+ return aErrors[ CurrentError ];
+ }
+ return NULL;
+}
+
+BasicError* MyBasic::FirstError()
+{
+ if ( !aErrors.empty() )
+ {
+ CurrentError = 0;
+ return aErrors[ CurrentError ];
+ }
+ return NULL;
+}
+
+sal_Bool MyBasic::ErrorHdl()
{
AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() );
if( !pWin )
@@ -193,18 +203,19 @@ BOOL MyBasic::ErrorHdl()
pWin->ToTop();
if( IsCompilerError() )
{
- aErrors.Insert(
+ aErrors.push_back(
new BasicError
( pWin,
- 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ),
- LIST_APPEND );
+ 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() )
+ );
nError++;
- return BOOL( nError < 20 ); // Cancel after 20 errors
+ CurrentError = aErrors.size() - 1;
+ return sal_Bool( nError < 20 ); // Cancel after 20 errors
}
else
{
ReportRuntimeError( pWin );
- return FALSE;
+ return sal_False;
}
}
@@ -221,9 +232,9 @@ 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 */
+ (void) bDebugFindNoErrors; /* avoid warning about unused parameter */
}
const String MyBasic::GetSpechialErrorText()
@@ -231,7 +242,7 @@ const String MyBasic::GetSpechialErrorText()
return GetErrorText();
}
-USHORT MyBasic::BreakHdl()
+sal_uInt16 MyBasic::BreakHdl()
{
SbModule* pMod = GetActiveModule();
if( pMod )
@@ -248,8 +259,6 @@ USHORT MyBasic::BreakHdl()
if( IsBreak() ) // If Breakpoint (or "Run to Cursor")
{
-// if ( GetActiveModule()->IsBP(GetLine()) )
-// GetActiveModule()->ClearBP(GetLine());
return aBasicApp.pFrame->BreakHandler();
}
else
@@ -265,7 +274,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;
@@ -286,12 +295,12 @@ BasicError::BasicError
// to highlight a statement
void BasicError::Show()
{
- if( pWin && aBasicApp.pFrame->IsWinValid( pWin ) )
+ if( pWin && aBasicApp.pFrame->IsWinValid( pWin ) )
{
pWin->Highlight( nLine, nCol1, nCol2 );
aBasicApp.pFrame->pStatus->Message( aText );
- }
- else
+ }
+ else
MessBox( aBasicApp.pFrame, WB_OK, aBasicApp.pFrame->GetText(),
aText ).Execute();
}
diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx
index a1e8347b70..fce66defbf 100644
--- 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/process.cxx b/basic/source/app/process.cxx
index aedfa4e5ca..46b663e9d9 100644
--- a/basic/source/app/process.cxx
+++ b/basic/source/app/process.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -30,11 +30,6 @@
#include "precompiled_basic.hxx"
-#ifdef WNT
-#include <tools/prewin.h>
-#include "winbase.h"
-#include <tools/postwin.h>
-#endif
#include <tools/errcode.hxx>
#include <basic/sbxcore.hxx>
#include <tools/string.hxx>
@@ -42,14 +37,12 @@
#include <osl/process.h>
#include <basic/ttstrhlp.hxx>
-
-//#ifndef _BYTE_STRING_LIST
-//DECLARE_LIST( ByteStringList, ByteString * );
-//#define _BYTE_STRING_LIST
-//#endif
-
#include <basic/process.hxx>
+#ifdef WNT
+#include <windows.h>
+#endif
+
Process::Process()
: m_nArgumentCount( 0 )
, m_pArgumentList( NULL )
@@ -57,8 +50,8 @@ Process::Process()
, m_pEnvList( NULL )
, m_aProcessName()
, m_pProcess( NULL )
-, bWasGPF( FALSE )
-, bHasBeenStarted( FALSE )
+, bWasGPF( sal_False )
+, bHasBeenStarted( sal_False )
{
}
@@ -84,19 +77,20 @@ Process::~Process()
}
-BOOL Process::ImplIsRunning()
+sal_Bool Process::ImplIsRunning()
{
if ( m_pProcess && bHasBeenStarted )
{
oslProcessInfo aProcessInfo;
+ 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()
@@ -104,6 +98,7 @@ long Process::ImplGetExitCode()
if ( m_pProcess )
{
oslProcessInfo aProcessInfo;
+ aProcessInfo.Size = sizeof(oslProcessInfo);
osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo );
if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) )
SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
@@ -115,7 +110,6 @@ long Process::ImplGetExitCode()
}
-////////////////////////////////////////////////////////////////////////////
void Process::SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv )
{ // Set image file of executable
@@ -159,31 +153,30 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
while ( aIter != pEnv->end() )
{
::rtl::OUString aTemp = ::rtl::OUString( (*aIter).first );
- aTemp += ::rtl::OUString::createFromAscii( "=" );
+ aTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "=" ));
aTemp += ::rtl::OUString( (*aIter).second );
m_pEnvList[m_nEnvCount] = NULL;
rtl_uString_assign( &(m_pEnvList[m_nEnvCount]), aTemp.pData );
- m_nEnvCount++;
- aIter++;
+ ++m_nEnvCount;
+ ++aIter;
}
}
::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_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX);
try
{
@@ -205,7 +198,7 @@ BOOL Process::Start()
}
catch( ... )
{
- bWasGPF = TRUE;
+ bWasGPF = sal_True;
// TODO: Output debug message !!
}
nErrorMode = SetErrorMode(nErrorMode);
@@ -217,17 +210,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;
@@ -236,11 +229,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 6d2ffee3ab..9dbc6c2748 100644
--- 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 );
@@ -216,15 +216,13 @@ 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 +232,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 983f2662ac..e6b5db3fb5 100644
--- a/basic/source/app/processw.hxx
+++ b/basic/source/app/processw.hxx
@@ -39,12 +39,12 @@ class ProcessWrapper : public SbxObject
using SbxVariable::GetInfo;
// Definition of a table entry. This is done here because
// through this methods and property can declared as private.
-#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) || defined ( C52 )
+#if defined ( ICC ) || defined ( C50 ) || defined ( C52 )
public:
#endif
typedef void( ProcessWrapper::*pMeth )
- ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite );
-#if defined ( ICC ) || defined ( HPUX )
+ ( 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 115c88e769..115c88e769 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 2b1ee2a5b9..85a332e238 100644
--- a/basic/source/app/status.cxx
+++ b/basic/source/app/status.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -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,10 @@ IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB )
nFirstWinPos += pTTB->GetItemPos( pTTB->GetCurItemId() ) / 2;
- USHORT 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 +93,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 );
@@ -113,7 +109,7 @@ void StatusLine::LoadTaskToolBox()
Window* pWin = pFrame->FindWin( pWinMenu->GetItemId( nFirstWinPos ) );
if ( pWin )
- pTaskToolBox->UpdateTask( Image(), pWin->GetText(), pWin == pFrame->pList->Last() && !( pFrame->pList->Last()->GetWinState() & TT_WIN_STATE_HIDE ) );
+ pTaskToolBox->UpdateTask( Image(), pWin->GetText(), pWin == pFrame->pList->back() && !( pFrame->pList->back()->GetWinState() & TT_WIN_STATE_HIDE ) );
nFirstWinPos++;
}
diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src
index f280bc8cca..cde47830a8 100644
--- a/basic/source/app/svtmsg.src
+++ b/basic/source/app/svtmsg.src
@@ -24,13 +24,12 @@
* 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
-///////////////////////////////
// Error messages which go to the result file.
// *********************
// *** !!ATTENTION!! ***
@@ -38,7 +37,6 @@
// The numbers must NEVER(!) change,
// because they are saved in the result files and a renewed display
// would display new strings or no strings.
-///////////////////////////////
String S_GPF_ABORT
{
Text[ en-US ] = "Program aborted with GPF";
diff --git a/basic/source/app/testtool.src b/basic/source/app/testtool.src
index 5157e3ecb2..d42218ae81 100644
--- a/basic/source/app/testtool.src
+++ b/basic/source/app/testtool.src
@@ -24,12 +24,10 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include "testtool.hrc"
+#include "basic/testtool.hrc"
-///////////////////////////////
// Strings
-///////////////////////////////
String S_INVALID_KEYCODE
{
Text[ en-US ] = "Is an invalid KeyCode!";
diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx
index 1936e9fd3f..34d541db2f 100644
--- a/basic/source/app/textedit.cxx
+++ b/basic/source/app/textedit.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -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,16 +79,16 @@ 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;
}
void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
- (void) rBC; /* avoid warning about unused parameter */
+ (void) rBC; /* avoid warning about unused parameter */
if ( rHint.ISA( TextHint ) )
{
const TextHint& rTextHint = (const TextHint&)rHint;
@@ -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;
@@ -201,7 +201,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
if ( rLast.nStart > rLast.nEnd ) // Only up to the bug of MD repaired
{
#if OSL_DEBUG_LEVEL > 1
- DBG_ERROR( "MD-Bug is not repaired!" );
+ OSL_FAIL( "MD-Bug is not repaired!" );
#endif
nCount--;
aPortionList.Remove( nCount);
@@ -210,12 +210,11 @@ 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];
-// DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" );
if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired
continue;
@@ -229,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;
}
}
@@ -272,17 +271,16 @@ 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];
-// DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" );
if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired
continue;
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:
@@ -326,7 +324,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
default:
{
aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) );
- DBG_ERROR( "Unknown syntax color" );
+ OSL_FAIL( "Unknown syntax color" );
}
}
pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 );
@@ -335,15 +333,13 @@ 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
+ // paragraph does no longer exist
if ( nPara < pTextEngine->GetParagraphCount() )
{
// unfortunatly I don't know if exact this line Modified() ...
-// if ( pProgress )
-// pProgress->StepProgress();
pTextEngine->RemoveAttribs( nPara );
String aSource( pTextEngine->GetText( nPara ) );
ImpDoHighlight( aSource, nPara );
@@ -354,14 +350,12 @@ void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara )
{
// Paragraph is added to 'List', processed in TimerHdl.
// => Do not manipulate paragraphs while EditEngine is formatting
-// if ( pProgress )
-// pProgress->StepProgress();
if ( !bHighlightning && bDoSyntaxHighlight )
{
if ( bDelayHighlight )
{
- aSyntaxLineTable.Insert( nPara, (void*)(ULONG)1 );
+ aSyntaxLineTable.Insert( nPara, (void*)(sal_uIntPtr)1 );
aSyntaxIdleTimer.Start();
}
else
@@ -372,54 +366,36 @@ 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 );
-/* if ( Application::AnyInput() )
- {
- aSyntaxIdleTimer.Start(); // Launch if we are landing in a dialog
- pTextView->ShowCursor( TRUE, TRUE );
- pTextEngine->SetUpdateMode( TRUE );
- bHighlightning = FALSE;
- GetpApp()->Reschedule();
- bHighlightning = TRUE;
- pTextEngine->SetUpdateMode( FALSE );
- }*/
}
- 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
-// pTextView->ForceUpdate();
+ 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!
-// long nPrevTextWidth = nCurTextWidth;
-// nCurTextWidth = pTextEngine->CalcTextWidth();
-// if ( nCurTextWidth != nPrevTextWidth )
-// SetScrollBarRanges();
- bHighlightning = FALSE;
+ bHighlightning = sal_False;
if ( aSyntaxLineTable.First() )
aImplSyntaxIdleTimer.Start();
-// while ( Application::AnyInput() )
-// Application::Reschedule(); // Reschedule, because the UserEvent let pass no paints etc.
-
return 0;
}
@@ -429,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;
@@ -446,13 +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->QuickFormatDoc();
- pTextEngine->SetUpdateMode( TRUE );
- pTextView->ShowCursor(TRUE, TRUE );
+ pTextEngine->SetUpdateMode( sal_True );
+ pTextView->ShowCursor(sal_True, sal_True );
}
}
@@ -462,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 );
@@ -481,13 +456,15 @@ void TextEditImp::KeyInput( const KeyEvent& rKeyEvent )
pTextView->GetTextEngine()->SetModified( bWasModified );
}
-void TextEditImp::Paint( const Rectangle& rRect ){ pTextView->Paint( rRect );}
-void TextEditImp::MouseButtonUp( const MouseEvent& rMouseEvent ){ pTextView->MouseButtonUp( rMouseEvent );}
-//void TextEditImp::MouseButtonDown( const MouseEvent& rMouseEvent ){ pTextView->MouseButtonDown( rMouseEvent );}
-//void TextEditImp::MouseMove( const MouseEvent& rMouseEvent ){ pTextView->MouseMove( rMouseEvent );}
-//void TextEditImp::Command( const CommandEvent& rCEvt ){ pTextView->Command( rCEvt );}
-//BOOL TextEditImp::Drop( const DropEvent& rEvt ){ return FALSE /*pTextView->Drop( rEvt )*/;}
-//BOOL TextEditImp::QueryDrop( DropEvent& rEvt ){ return FALSE /*pTextView->QueryDrop( rEvt )*/;}
+void TextEditImp::Paint( const Rectangle& rRect )
+{
+ pTextView->Paint( rRect );
+}
+
+void TextEditImp::MouseButtonUp( const MouseEvent& rMouseEvent )
+{
+ pTextView->MouseButtonUp( rMouseEvent );
+}
void TextEditImp::Command( const CommandEvent& rCEvt )
@@ -542,17 +519,17 @@ SbxBase* TextEditImp::GetSbxAtMousePos( String &aWord )
Point aDocPos = pTextView->GetDocPos( aPos );
aWord = pTextEngine->GetWord( pTextEngine->GetPaM( aDocPos ) );
- if ( aWord.Len() /*&& !Application::GetAppInternational().IsNumeric( aWord )*/ )
+ if ( aWord.Len() )
{
xub_StrLen nLastChar = aWord.Len()-1;
String aSuffixes = CUniString( cSuffixes );
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();
@@ -643,12 +620,9 @@ Variant(Empty)
switch ( eType )
{
case SbxBOOL:
-// case SbxCURRENCY:
-// case SbxDATE:
case SbxDOUBLE:
case SbxINTEGER:
case SbxLONG:
-// case SbxOBJECT: // cannot be edited
case SbxSINGLE:
case SbxSTRING:
@@ -678,8 +652,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);
@@ -688,7 +662,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--;
@@ -714,7 +688,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 )
{
@@ -722,7 +696,7 @@ void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 )
if ( s.GetChar( nCol2 ) == ':' )
{
nCol2--;
- bColon = TRUE;
+ bColon = sal_True;
}
}
@@ -730,7 +704,7 @@ void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 )
aEdit.pTextView->SetSelection( TextSelection(TextPaM(nLine,nCol2+1), TextPaM(nLine,nCol1)) );
if ( aEdit.ViewMoved() )
{
- aEdit.pTextView->SetSelection( TextSelection(TextPaM(TEXT_PARA_ALL,1)) ); // fix #105169#
+ aEdit.pTextView->SetSelection( TextSelection(TextPaM(TEXT_PARA_ALL,1)) );
aEdit.pTextView->SetSelection( TextSelection(TextPaM((nLine>=2?nLine-2:0),nCol2+1)) );
aEdit.pTextView->SetSelection( TextSelection(TextPaM(nLine,nCol2+1), TextPaM(nLine,nCol1)) );
}
@@ -747,31 +721,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() )
@@ -785,23 +759,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;
@@ -811,29 +785,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() )
@@ -848,10 +822,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 de176f4a11..723f05f9c1 100644
--- 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,23 +90,20 @@ public:
TextView *pTextView;
void SetFont( const Font& rNewFont );
- BOOL IsModified();
+ sal_Bool IsModified();
void SetModifyHdl( Link l ){ ModifyHdl = l; }
void KeyInput( const KeyEvent& rKeyEvent );
void Paint( const Rectangle& rRect );
void MouseButtonUp( const MouseEvent& rMouseEvent );
void MouseButtonDown( const MouseEvent& rMouseEvent );
-// void MouseMove( const MouseEvent& rMouseEvent );
void Command( const CommandEvent& rCEvt );
- //BOOL Drop( const DropEvent& rEvt );
- //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 +113,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 +129,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/ttmsg.src b/basic/source/app/ttmsg.src
index dd75f7b1e0..22b447a754 100644
--- a/basic/source/app/ttmsg.src
+++ b/basic/source/app/ttmsg.src
@@ -24,13 +24,12 @@
* 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
-///////////////////////////////
// Error messages which go to the result file.
// *********************
// *** !!ATTENTION!! ***
@@ -38,7 +37,6 @@
// The numbers must NEVER(!) change,
// because they are saved in the result files and a renewed display
// would display new strings or no strings.
-///////////////////////////////
String S_NAME_NOT_THERE
{
@@ -140,22 +138,4 @@ String S_UNKNOWN_METHOD
{
Text[ en-US ] = "Unknown method on object :($Arg1).($Arg2)";
};
-/*
-String
-{
- Text[ en-US ] = ;
-};
-String
-{
- Text[ en-US ] = ;
-};
-String
-{
- Text[ en-US ] = ;
-};
-String
-{
- Text[ en-US ] = ;
-};
-*/
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index ff2d64fcfd..628f97eaaf 100644
--- 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;
}
@@ -285,11 +301,11 @@ namespace basic
if ( !aAppBasicDir.Len() )
aPathCFG.SetBasicPath( String::CreateFromAscii("$(prog)") );
- // #58293# soffice.new search only in user dir => first dir
+ // soffice.new search only in user dir => first dir
String aAppFirstBasicDir = aAppBasicDir.GetToken(1);
// Create basic and load it
- // MT: #47347# AppBasicDir is now a PATH
+ // AppBasicDir is now a PATH
INetURLObject aAppBasic( SvtPathOptions().SubstituteVariable( String::CreateFromAscii("$(progurl)") ) );
aAppBasic.insertName( Application::GetAppName() );
@@ -348,7 +364,7 @@ namespace basic
if ( pos != m_aCreationListeners.end() )
m_aCreationListeners.erase( pos );
else {
- DBG_ERROR( "ImplRepository::revokeCreationListener: listener is not registered!" );
+ OSL_FAIL( "ImplRepository::revokeCreationListener: listener is not registered!" );
}
}
@@ -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,28 +476,25 @@ 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 );
- // that's not needed anymore today. The containers will retrieve their associated
- // BasicManager from the BasicManagerRepository, when needed.
+ _out_rpBasicManager->SetLibraryContainerInfo( aInfo );
// initialize the containers
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 +502,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;
}
//--------------------------------------------------------------------
@@ -594,7 +612,7 @@ namespace basic
// a BasicManager which is still in our repository is being deleted.
// That's bad, since by definition, we *own* all instances in our
// repository.
- OSL_ENSURE( false, "ImplRepository::Notify: nobody should tamper with the managers, except ourself!" );
+ OSL_FAIL( "ImplRepository::Notify: nobody should tamper with the managers, except ourself!" );
m_aStore.erase( loop );
break;
}
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 882fa8b2d0..d1dd3572bc 100644
--- 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>
@@ -51,6 +53,7 @@
#include "sbintern.hxx"
#include <sb.hrc>
+#include <vector>
#define LIB_SEP 0x01
#define LIBINFO_SEP 0x02
@@ -74,6 +77,8 @@
#include <cppuhelper/implbase1.hxx>
using com::sun::star::uno::Reference;
+using ::std::vector;
+using ::std::advance;
using namespace com::sun::star::container;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -85,21 +90,21 @@ typedef WeakImplHelper1< XStarBasicModuleInfo > ModuleInfoHelper;
typedef WeakImplHelper1< XStarBasicDialogInfo > DialogInfoHelper;
typedef WeakImplHelper1< XStarBasicLibraryInfo > LibraryInfoHelper;
typedef WeakImplHelper1< XStarBasicAccess > StarBasicAccessHelper;
-
+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";
@@ -115,8 +120,6 @@ DBG_NAME( BasicManager );
StreamMode eStreamReadMode = STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL;
StreamMode eStorageReadMode = STREAM_READ | STREAM_SHARE_DENYWRITE;
-DECLARE_LIST( BasErrorLst, BasicError* )
-
//----------------------------------------------------------------------------
// BasicManager impl data
struct BasicManagerImpl
@@ -253,7 +256,7 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
}
}
- pLib->SetModified( FALSE );
+ pLib->SetModified( sal_False );
}
@@ -311,7 +314,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
}
else
pLib->MakeModule32( aName, aMod );
- pLib->SetModified( FALSE );
+ pLib->SetModified( sal_False );
}
}
}
@@ -345,7 +348,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent
else
pLib->MakeModule32( aName, aMod );
- pLib->SetModified( FALSE );
+ pLib->SetModified( sal_False );
}
}
@@ -365,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
@@ -376,7 +379,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const ContainerEvent&
if( pMod )
{
pLib->Remove( pMod );
- pLib->SetModified( FALSE );
+ pLib->SetModified( sal_False );
}
}
}
@@ -388,18 +391,24 @@ class BasicErrorManager
{
private:
BasErrorLst aErrorList;
+ size_t CurrentError;
public:
+ BasicErrorManager();
~BasicErrorManager();
- void Reset();
- void InsertError( const BasicError& rError );
+ void Reset();
+ void InsertError( const BasicError& rError );
- BOOL HasErrors() { return (BOOL)aErrorList.Count(); }
- BasicError* GetFirstError() { return aErrorList.First(); }
- BasicError* GetNextError() { return aErrorList.Next(); }
+ bool HasErrors() { return !aErrorList.empty(); }
+ BasicError* GetFirstError();
+ BasicError* GetNextError();
};
+BasicErrorManager::BasicErrorManager()
+ : CurrentError( 0 )
+{
+}
BasicErrorManager::~BasicErrorManager()
{
@@ -408,28 +417,44 @@ BasicErrorManager::~BasicErrorManager()
void BasicErrorManager::Reset()
{
- BasicError* pError = (BasicError*)aErrorList.First();
- while ( pError )
- {
- delete pError;
- pError = (BasicError*)aErrorList.Next();
- }
- aErrorList.Clear();
+ for ( size_t i = 0, n = aErrorList.size(); i < n; ++i )
+ delete aErrorList[ i ];
+ aErrorList.clear();
}
void BasicErrorManager::InsertError( const BasicError& rError )
{
- aErrorList.Insert( new BasicError( rError ), LIST_APPEND );
+ aErrorList.push_back( new BasicError( rError ) );
+}
+
+BasicError* BasicErrorManager::GetFirstError()
+{
+ CurrentError = 0;
+ return aErrorList.empty() ? NULL : aErrorList[ CurrentError ];
+}
+
+BasicError* BasicErrorManager::GetNextError()
+{
+ if ( !aErrorList.empty()
+ && CurrentError < ( aErrorList.size() - 1)
+ )
+ {
+ ++CurrentError;
+ return aErrorList[ CurrentError ];
+ }
+ return NULL;
}
+//=====================================================================
+
BasicError::BasicError()
{
nErrorId = 0;
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;
@@ -444,6 +469,8 @@ BasicError::BasicError( const BasicError& rErr ) :
}
+//=====================================================================
+
class BasicLibInfo
{
private:
@@ -453,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;
@@ -465,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; }
@@ -491,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 )
@@ -512,20 +539,117 @@ public:
{ mxScriptCont = xScriptCont; }
};
-DECLARE_LIST( BasicLibsBase, BasicLibInfo* )
-class BasicLibs : public BasicLibsBase
+//=====================================================================
+
+class BasicLibs
{
+private:
+ vector< BasicLibInfo* > aList;
+ size_t CurrentLib;
+
public:
- String aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
+ ~BasicLibs();
+ String aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
+ BasicLibInfo* GetObject( size_t i );
+ BasicLibInfo* First();
+ BasicLibInfo* Last();
+ BasicLibInfo* Prev();
+ BasicLibInfo* Next();
+ size_t GetPos( BasicLibInfo* LibInfo );
+ size_t Count() const { return aList.size(); };
+ size_t GetCurPos() const { return CurrentLib; };
+ void Insert( BasicLibInfo* LibInfo );
+ BasicLibInfo* Remove( BasicLibInfo* LibInfo );
};
+BasicLibs::~BasicLibs() {
+ for ( size_t i = 0, n = aList.size(); i < n; ++i )
+ delete aList[ i ];
+ aList.clear();
+}
+
+BasicLibInfo* BasicLibs::GetObject( size_t i )
+{
+ if ( aList.empty()
+ || aList.size() <= i
+ )
+ return NULL;
+ CurrentLib = i;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::First()
+{
+ if ( aList.empty() )
+ return NULL;
+ CurrentLib = 0;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::Last()
+{
+ if ( aList.empty() )
+ return NULL;
+ CurrentLib = aList.size() - 1;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::Prev()
+{
+ if ( aList.empty()
+ || CurrentLib == 0
+ )
+ return NULL;
+ --CurrentLib;
+ return aList[ CurrentLib ];
+}
+
+BasicLibInfo* BasicLibs::Next()
+{
+ if ( aList.empty()
+ || CurrentLib >= ( aList.size() - 1 )
+ )
+ return NULL;
+ ++CurrentLib;
+ return aList[ CurrentLib ];
+}
+
+size_t BasicLibs::GetPos( BasicLibInfo* LibInfo )
+{
+ for ( size_t i = 0, n = aList.size(); i < n; ++i )
+ if ( aList[ i ] == LibInfo )
+ return i;
+ return size_t( -1 );
+}
+
+void BasicLibs::Insert( BasicLibInfo* LibInfo )
+{
+ aList.push_back( LibInfo );
+ CurrentLib = aList.size() - 1;
+}
+
+BasicLibInfo* BasicLibs::Remove( BasicLibInfo* LibInfo )
+{
+ size_t i = GetPos( LibInfo );
+ if ( i < aList.size() )
+ {
+ vector< BasicLibInfo* >::iterator it = aList.begin();
+ advance( it , i );
+ it = aList.erase( it );
+ }
+ return 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);
@@ -533,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;
@@ -560,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_;
@@ -613,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;
@@ -624,7 +748,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
if( nId == LIBINFO_ID )
{
// Reload?
- BOOL bDoLoad;
+ sal_Bool bDoLoad;
rSStream >> bDoLoad;
pInfo->bDoLoad = bDoLoad;
@@ -645,7 +769,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
if ( nVer >= 2 )
{
- BOOL bReferenz;
+ sal_Bool bReferenz;
rSStream >> bReferenz;
pInfo->IsReference() = bReferenz;
}
@@ -668,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 );
@@ -680,11 +804,6 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA
String aStorName( rStorage.GetName() );
maStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
- // #91251: Storage name not longer available for documents < 5.0
- // Should be no real problem, because only relative storage names
- // (links) can be affected.
- // DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
- // DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name");
// If there is no Manager Stream, no further actions are necessary
if ( rStorage.IsStream( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)) ) )
@@ -705,24 +824,23 @@ 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 )
{
-// pBasic->SetParent( pStdLib );
pStdLib->Insert( pBasic );
pBasic->SetFlag( SBX_EXTSEARCH );
}
}
// Modified through insert
- pStdLib->SetModified( FALSE );
+ pStdLib->SetModified( sal_False );
}
// #91626 Save all stream data to save it unmodified if basic isn't modified
@@ -733,12 +851,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?!" );
@@ -757,7 +875,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA
LoadOldBasicManager( rStorage );
}
- bBasMgrModified = FALSE;
+ bBasMgrModified = sal_False;
}
void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInfo )
@@ -776,8 +894,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!" );
@@ -831,7 +949,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
{
Any aLibAny = xScriptCont->getByName( *pScriptLibName );
- if ( pScriptLibName->equalsAscii( "Standard" ) )
+ if ( pScriptLibName->equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Standard")) )
xScriptCont->loadLibrary( *pScriptLibName );
BasMgrContainerListenerImpl::insertLibraryImpl
@@ -841,14 +959,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();
}
@@ -877,7 +995,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();
@@ -894,8 +1012,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()
@@ -920,7 +1038,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 );
}
@@ -935,11 +1053,10 @@ 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 );
-// StreamMode eStreamMode = STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE;
SotStorageStreamRef xManagerStream = rStorage.OpenSotStream
( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)), eStreamReadMode );
@@ -958,8 +1075,6 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
String aRealStorageName = maStorageName; // for relative paths, can be modified through BaseURL
- // If loaded from template, only BaseURL is used:
- //String aBaseURL = INetURLObject::GetBaseURL();
if ( rBaseURL.Len() )
{
INetURLObject aObj( rBaseURL );
@@ -973,7 +1088,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 )
@@ -981,7 +1096,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 );
@@ -991,13 +1106,10 @@ 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
- /* if ( SfxContentHelper::Exists( aObj.GetMainURL() ) )
- pInfo->SetStorageName( aObj.GetMainURL() );
- else */
//*** TODO-End
if ( pLibs->aBasicLibPath.Len() )
{
@@ -1007,12 +1119,12 @@ 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 );
}
}
}
- pLibs->Insert( pInfo, LIST_APPEND );
+ pLibs->Insert( pInfo );
// Libs from external files should be loaded only when necessary.
// But references are loaded at once, otherwise some big customers get into trouble
if ( bLoadLibs && pInfo->DoLoad() &&
@@ -1031,7 +1143,6 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
{
DBG_CHKTHIS( BasicManager, 0 );
-// StreamMode eStreamMode = STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE;
SotStorageStreamRef xManagerStream = rStorage.OpenSotStream
( String::CreateFromAscii(szOldManagerStream), eStreamReadMode );
@@ -1056,8 +1167,6 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
xManagerStream->Seek( nBasicStartOff );
if( !ImplLoadBasic( *xManagerStream, pLibs->GetObject(0)->GetLibRef() ) )
{
-// String aErrorText( BasicResId( IDS_SBERR_MGROPEN ) );
-// aErrorText.SearchAndReplace( "XX", aStorName );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, aStorName, ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_OPENMGRSTREAM, aStorName ) );
// and it proceeds ...
@@ -1072,8 +1181,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
@@ -1085,7 +1194,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!" );
@@ -1094,18 +1203,16 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
xStorageRef = &rStorage;
else
{
- xStorageRef = new SotStorage( FALSE, aLibAbsStorage.GetMainURL
- ( INetURLObject::NO_DECODE ), eStorageReadMode, TRUE );
+ xStorageRef = new SotStorage( sal_False, aLibAbsStorage.GetMainURL
+ ( INetURLObject::NO_DECODE ), eStorageReadMode, sal_True );
if ( xStorageRef->GetError() != ERRCODE_NONE )
- xStorageRef = new SotStorage( FALSE, aLibRelStorage.
- GetMainURL( INetURLObject::NO_DECODE ), eStorageReadMode, TRUE );
+ xStorageRef = new SotStorage( sal_False, aLibRelStorage.
+ GetMainURL( INetURLObject::NO_DECODE ), eStorageReadMode, sal_True );
}
if ( xStorageRef.Is() )
- AddLib( *xStorageRef, aLibName, FALSE );
+ AddLib( *xStorageRef, aLibName, sal_False );
else
{
-// String aErrorText( BasicResId( IDS_SBERR_LIBLOAD ) );
-// aErrorText.SearchAndReplace( "XX", aLibName );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_STORAGENOTFOUND, aStorName ) );
}
@@ -1122,13 +1229,6 @@ BasicManager::~BasicManager()
// Destroy Basic-Infos...
// In reverse order
- BasicLibInfo* pInf = pLibs->Last();
- while ( pInf )
- {
- delete pInf;
- pInf = pLibs->Prev();
- }
- pLibs->Clear();
delete pLibs;
delete pErrorMgr;
delete mpImpl;
@@ -1147,8 +1247,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 )
@@ -1163,7 +1263,7 @@ void BasicManager::Init()
{
DBG_CHKTHIS( BasicManager, 0 );
- bBasMgrModified = FALSE;
+ bBasMgrModified = sal_False;
pErrorMgr = new BasicErrorManager;
pLibs = new BasicLibs;
mpImpl = new BasicManagerImpl();
@@ -1174,11 +1274,11 @@ BasicLibInfo* BasicManager::CreateLibInfo()
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = new BasicLibInfo;
- pLibs->Insert( pInf, LIST_APPEND );
+ pLibs->Insert( pInf );
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 );
@@ -1206,10 +1306,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() )
{
@@ -1227,7 +1327,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 )
@@ -1240,7 +1340,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
@@ -1249,7 +1349,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 )
@@ -1276,20 +1376,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();
}
@@ -1298,11 +1398,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) ) )
@@ -1321,15 +1421,8 @@ BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con
// Fill new libray container (5.2 -> 6.0)
copyToLibraryContainer( pNew, mpImpl->maContainerInfo );
-/*
- if( rOldBasic->GetParent() )
- {
- rOldBasic->GetParent()->Insert( rOldBasic );
- rOldBasic->SetFlag( SBX_EXTSEARCH );
- }
-*/
- pNew->SetModified( FALSE );
- bLoaded = TRUE;
+ pNew->SetModified( sal_False );
+ bLoaded = sal_True;
}
}
if ( bProtected )
@@ -1337,14 +1430,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!" );
@@ -1356,12 +1449,12 @@ void BasicManager::CheckModules( StarBASIC* pLib, BOOL bReference ) const
// cause modified
if( !bModified && bReference )
{
- DBG_ERROR( "Per Reference eingebundene Basic-Library ist nicht compiliert!" );
- pLib->SetModified( FALSE );
+ OSL_FAIL( "Per Reference eingebundene Basic-Library ist nicht compiliert!" );
+ 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 );
@@ -1379,12 +1472,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 = GetLibId( rLibName );
- 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 )
{
@@ -1393,21 +1485,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->CalcRelStorageName( GetStorageName() );
- pLibInfo->IsReference() = TRUE;
+ pLibInfo->IsReference() = sal_True;
}
else
{
- pLibInfo->GetLib()->SetModified( TRUE ); // Must be saved after Add!
+ pLibInfo->GetLib()->SetModified( sal_True ); // Must be saved after Add!
pLibInfo->SetStorageName( String::CreateFromAscii(szImbedded) ); // Save in BasicManager-Storage
}
- bBasMgrModified = TRUE;
+ bBasMgrModified = sal_True;
}
else
{
- RemoveLib( nLibId, FALSE );
+ RemoveLib( nLibId, sal_False );
pLibInfo = 0;
}
@@ -1417,7 +1508,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 );
@@ -1426,16 +1517,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!" );
@@ -1445,10 +1536,9 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage )
if ( !pLibInfo || !nLib )
{
-// 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,
@@ -1458,18 +1548,17 @@ 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() )
{
-// String aErrorText( BasicResId( IDS_SBERR_REMOVELIB ) );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, String(), ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_OPENLIBSTORAGE, pLibInfo->GetLibName() ) );
}
@@ -1503,20 +1592,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 );
@@ -1548,7 +1637,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 );
@@ -1556,14 +1645,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 );
@@ -1571,14 +1660,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 );
@@ -1591,15 +1680,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 );
@@ -1610,11 +1699,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 )
@@ -1628,11 +1717,10 @@ BOOL BasicManager::LoadLib( USHORT nLib )
}
else
{
- bDone = ImpLoadLibary( pLibInfo, NULL, FALSE );
+ bDone = ImpLoadLibary( pLibInfo, NULL, sal_False );
StarBASIC* pLib = GetLib( nLib );
if ( pLib )
{
- // pLib->SetParent( GetStdLib() );
GetStdLib()->Insert( pLib );
pLib->SetFlag( SBX_EXTSEARCH );
}
@@ -1640,8 +1728,6 @@ BOOL BasicManager::LoadLib( USHORT nLib )
}
else
{
-// String aErrorText( BasicResId( IDS_SBERR_LIBLOAD ) );
-// aErrorText.SearchAndReplace( "XX", "" );
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, String(), ERRCODE_BUTTON_OK );
pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_LIBNOTFOUND, String::CreateFromInt32(nLib) ) );
}
@@ -1674,20 +1760,11 @@ 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 );
-
- //if( !pLibInfo )
- //pLibInfo = FindLibInfo( pLib );
- //pLibInfo->SetStorageName( LinkTargetURL );
- //pLibInfo->GetLib()->SetModified( FALSE ); // Then don't save
- //pLibInfo->SetRelStorageName( String() );
- //pLibInfo->IsReference() = TRUE;
+ pLib = AddLib( *xStorage, rLibName, sal_True );
}
- //else
- //Message?
DBG_ASSERT( pLib, "XML Import: Linked basic library could not be loaded");
}
@@ -1740,16 +1817,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 );
@@ -1757,17 +1834,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?!" );
@@ -1782,7 +1859,7 @@ void BasicManager::SetFlagToAllLibs( short nFlag, BOOL bSet ) const
}
}
-BOOL BasicManager::HasErrors()
+sal_Bool BasicManager::HasErrors()
{
DBG_CHKTHIS( BasicManager, 0 );
return pErrorMgr->HasErrors();
@@ -1850,7 +1927,7 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequen
const ::rtl::OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
for ( ; pNames != pNamesEnd; ++pNames )
{
- if( /*pLib->mbSharedIndexFile ||*/ !xPassword->isLibraryPasswordProtected( *pNames ) )
+ if( !xPassword->isLibraryPasswordProtected( *pNames ) )
continue;
StarBASIC* pBasicLib = GetLib( *pNames );
@@ -1888,6 +1965,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 && ( pRet != pMethod ) )
+ *i_retValue = *pRet;
+ return SbxBase::GetError();
+}
+
//=====================================================================
class ModuleInfo_Impl : public ModuleInfoHelper
@@ -2041,10 +2228,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() );
@@ -2371,10 +2558,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 ) );
}
@@ -2411,7 +2598,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 e08e9cc753..615a8e8465 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 100644
index 0000000000..1ab94fa248
--- /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 30003917ea..ba60d25ca3 100644
--- a/basic/source/classes/disas.cxx
+++ b/basic/source/classes/disas.cxx
@@ -36,7 +36,6 @@
#include "sb.hxx"
#include "iosys.hxx"
#include "disas.hxx"
-#include "sbtrace.hxx"
static const char* pOp1[] = {
@@ -237,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 )
@@ -245,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 )
@@ -279,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 )
@@ -303,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 )
@@ -352,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[] = {
@@ -362,11 +361,7 @@ BOOL SbiDisas::DisasLine( String& rText )
"%08" SAL_PRIXUINT32 " %02X %08X %08X " };
rText.Erase();
if( !Fetch() )
- return FALSE;
-
-#ifdef DBG_TRACE_BASIC
- String aTraceStr_STMNT;
-#endif
+ return sal_False;
// New line?
if( eOp == _STMNT && nOp1 != nLine )
@@ -374,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;
@@ -384,26 +379,20 @@ 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;
rText.AppendAscii( "; " );
rText += s;
rText.AppendAscii( _crlf() );
-
-#ifdef DBG_TRACE_BASIC
- aTraceStr_STMNT = s;
-#endif
}
}
@@ -413,7 +402,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 )
@@ -443,7 +432,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 );
@@ -463,17 +452,13 @@ BOOL SbiDisas::DisasLine( String& rText )
rText += aPCodeStr;
-#ifdef DBG_TRACE_BASIC
- dbg_RegisterTraceTextForPC( pMod, nPC, aTraceStr_STMNT, aPCodeStr );
-#endif
-
- 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 )
@@ -485,7 +470,7 @@ void SbiDisas::StrOp( String& rText )
else
{
rText.AppendAscii( "?String? " );
- rText += (USHORT)nOp1;
+ rText += (sal_uInt16)nOp1;
}
}
@@ -539,7 +524,7 @@ void SbiDisas::ResumeOp( String& rText )
}
// print Prompt
-// FALSE/TRUE
+// sal_False/TRUE
void SbiDisas::PromptOp( String& rText )
{
if( nOp1 )
@@ -571,16 +556,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 )
@@ -590,7 +575,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;
@@ -603,7 +588,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 )
@@ -611,13 +596,6 @@ void SbiDisas::OffOp( String& rText )
}
// Data type
-#ifdef HP9000 // TODO: remove this!
-static char* SbiDisas_TypeOp_pTypes[13] = {
- "Empty","Null","Integer","Long","Single","Double",
- "Currency","Date","String","Object","Error","Boolean",
- "Variant" };
-#define pTypes SbiDisas_TypeOp_pTypes
-#endif
void SbiDisas::TypeOp( String& rText )
{
// From 1996-01-19: type can contain flag for BYVAL (StepARGTYP)
@@ -628,25 +606,21 @@ void SbiDisas::TypeOp( String& rText )
}
if( nOp1 < 13 )
{
-#ifndef HP9000
static char pTypes[][13] = {
"Empty","Null","Integer","Long","Single","Double",
"Currency","Date","String","Object","Error","Boolean",
"Variant" };
-#endif
+
rText.AppendAscii( pTypes[ nOp1 ] );
}
else
{
rText.AppendAscii( "type " );
- rText += (USHORT)nOp1;
+ rText += (sal_uInt16)nOp1;
}
}
-#ifdef HP9000
-#undef pTypes
-#endif
-// TRUE-Label, condition Opcode
+// sal_True-Label, condition Opcode
void SbiDisas::CaseOp( String& rText )
{
LblOp( rText );
@@ -659,8 +633,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 8174a87feb..3e6784c836 100644
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -175,7 +175,7 @@ void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const u
throw (uno::RuntimeException)
{
if ( !Number.hasValue() )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Missing Required Paramater")), uno::Reference< uno::XInterface >() );
Number >>= m_nNumber;
Description >>= m_sDescription;
Source >>= m_sSource;
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 4703647b7a..aa3a972f30 100644
--- 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",
@@ -262,8 +214,6 @@ void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeExc
void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
{
- //Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
- //{
if( aScriptEvent.ScriptType.compareToAscii( "StarBasic" ) == 0 )
{
// Full qualified name?
@@ -346,7 +296,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 +326,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 +436,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 +515,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 285deaba69..d3f611f7b5 100644
--- 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,43 +113,42 @@ 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 )
{
- short i;
r >> nSign >> nLen >> nCount;
nNext += nLen + 8;
@@ -158,24 +157,21 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
{
case B_NAME:
r.ReadByteString( aName, eCharSet );
- //r >> aName;
break;
case B_COMMENT:
r.ReadByteString( aComment, eCharSet );
- //r >> aComment;
break;
case B_SOURCE:
{
String aTmp;
r.ReadByteString( aTmp, eCharSet );
aOUSource = aTmp;
- //r >> aSource;
break;
}
#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 );
@@ -192,10 +188,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();
@@ -217,23 +213,24 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
case B_STRINGPOOL:
if( bBadVer ) break;
MakeStrings( nCount );
+ short i;
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 ) );
}
@@ -250,14 +247,12 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
}
done:
r.Seek( nLast );
- //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,30 +263,29 @@ 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 ) )
{
nPos = SbiOpenRecord( r, B_NAME, 1 );
r.WriteByteString( aName, eCharSet );
- //r << aName;
SbiCloseRecord( r, nPos );
}
// Comment?
@@ -299,7 +293,6 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
{
nPos = SbiOpenRecord( r, B_COMMENT, 1 );
r.WriteByteString( aComment, eCharSet );
- //r << aComment;
SbiCloseRecord( r, nPos );
}
// Source?
@@ -314,16 +307,15 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
else
aTmp = aOUSource;
r.WriteByteString( aTmp, eCharSet );
- //r << aSource;
SbiCloseRecord( r, nPos );
#ifdef EXTENDED_BINARY_MODULES
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 +334,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 +349,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 +372,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 +389,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 +405,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,15 +424,14 @@ 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 )
{
pStringOff[ nStringIdx++ ] = nStringOff;
- //ByteString aByteStr( r, eCharSet );
memcpy( pStrings + nStringOff, r.GetBuffer(), len * sizeof( sal_Unicode ) );
nStringOff = nStringOff + len;
// Last String? The update the size of the buffer
@@ -454,7 +445,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 +479,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 +509,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 +526,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 e00ed4674c..e00ed4674c 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 1094508a86..90532e1f77 100644
--- 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 c74e996895..454108938d 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -37,7 +37,6 @@
#include <tools/stream.hxx>
#include <tools/errinf.hxx>
#include <basic/sbx.hxx>
-#include <tools/list.hxx>
#include <tools/shl.hxx>
#include <tools/rc.hxx>
#include <vcl/svapp.hxx>
@@ -54,9 +53,12 @@
#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 <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
@@ -68,20 +70,160 @@ 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 )
- {
+ {
Any aThisDoc;
if ( GetUNOConstant("ThisComponent", aThisDoc) )
{
Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY );
- if ( xDocFac.is() )
+ if ( xDocFac.is() )
{
try
{
@@ -114,11 +256,11 @@ 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;
};
-const SFX_VB_ErrorItem __FAR_DATA SFX_VB_ErrorTab[] =
+const SFX_VB_ErrorItem SFX_VB_ErrorTab[] =
{
{ 1, SbERR_BASIC_EXCEPTION }, // #87844 Map exception to error code 1
{ 2, SbERR_SYNTAX },
@@ -250,7 +392,7 @@ const SFX_VB_ErrorItem __FAR_DATA 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 )
{
@@ -299,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;
@@ -324,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;
@@ -342,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();
}
}
@@ -361,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 );
@@ -375,25 +528,25 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
SbxBase* pParObj = pVar->GetObject();
SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
- INT32 lb = 0;
- INT32 ub = 0;
pDest->setHasFixedSize( pSource->hasFixedSize() );
if ( pSource->GetDims() && pSource->hasFixedSize() )
{
- 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
+ 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 )
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
pNewProp->PutObject( pDest );
pNewProp->SetFlags( nSavFlags );
}
@@ -416,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;
@@ -445,6 +598,7 @@ SbxObject* createUserTypeImpl( const String& rClassName )
return pRetObj;
}
+
TYPEINIT1(SbClassModuleObject,SbModule)
SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
@@ -464,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 );
@@ -477,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 );
@@ -485,12 +639,12 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
pNewMethod->pMod = this;
pNewMethod->SetParent( this );
pMethods->PutDirect( pNewMethod, i );
- StartListening( pNewMethod->GetBroadcaster(), TRUE );
+ StartListening( pNewMethod->GetBroadcaster(), sal_True );
}
}
}
- // Copy SbIfaceMapperMethod in a second step to ensure that
+ // Copy SbIfaceMapperMethod in a second step to ensure that
// the corresponding base methods have already been copied
for( i = 0 ; i < nMethodCount ; i++ )
{
@@ -502,7 +656,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbMethod* pImplMethod = pIfaceMethod->getImplMethod();
if( !pImplMethod )
{
- DBG_ERROR( "No ImplMethod" );
+ OSL_FAIL( "No ImplMethod" );
continue;
}
@@ -512,10 +666,10 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbMethod* pImplMethodCopy = p ? PTR_CAST(SbMethod,p) : NULL;
if( !pImplMethodCopy )
{
- DBG_ERROR( "Found no ImplMethod copy" );
+ OSL_FAIL( "Found no ImplMethod copy" );
continue;
}
- SbIfaceMapperMethod* pNewIfaceMethod =
+ SbIfaceMapperMethod* pNewIfaceMethod =
new SbIfaceMapperMethod( pIfaceMethod->GetName(), pImplMethodCopy );
pMethods->PutDirect( pNewIfaceMethod, i );
}
@@ -523,30 +677,29 @@ 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() );
- // ( pProcedureProp->GetName(), pProcedureProp->GetType(), this );
pNewProp->SetFlags( nFlags_ ); // Copy flags
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 );
@@ -560,7 +713,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
if( pObj != NULL )
{
String aObjClass = pObj->GetClassName();
- (void)aObjClass;
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
if( pClassModuleObj != NULL )
@@ -595,10 +747,14 @@ 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
+ // Must be deleted by base class dtor because this data
// is not owned by the SbClassModuleObject object
pImage = NULL;
pBreaks = NULL;
@@ -607,7 +763,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 )
@@ -669,7 +825,7 @@ SbClassData::SbClassData( void )
void SbClassData::clear( void )
{
- mxIfaces->Clear();
+ mxIfaces->Clear();
maRequiredTypes.clear();
}
@@ -684,8 +840,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 );
}
@@ -694,7 +856,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;
@@ -702,12 +864,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;
}
@@ -719,21 +888,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;
@@ -742,23 +909,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 );
@@ -787,18 +962,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
@@ -806,7 +993,6 @@ void* StarBASIC::operator new( size_t n )
{
if( n < sizeof( StarBASIC ) )
{
-// DBG_ASSERT( FALSE, "Warnung: inkompatibler BASIC-Stand!" );
n = sizeof( StarBASIC );
}
return ::operator new( n );
@@ -817,6 +1003,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
@@ -861,7 +1068,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;
}
@@ -871,14 +1078,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 );
}
}
@@ -896,17 +1103,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()
@@ -917,7 +1124,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 ) )
@@ -932,7 +1139,6 @@ struct ClassModuleRunInitItem
SbModule* m_pModule;
bool m_bProcessing;
bool m_bRunInitDone;
- //ModuleVector m_vModulesDependingOnThisModule;
ClassModuleRunInitItem( void )
: m_pModule( NULL )
@@ -946,18 +1152,17 @@ struct ClassModuleRunInitItem
{}
};
-typedef std::hash_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;
SbModule* pModule = rItem.m_pModule;
if( pModule->pClassData != NULL )
{
@@ -969,19 +1174,19 @@ 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 )
{
// TODO: raise error?
- DBG_ERROR( "Cyclic module dependency detected" );
+ OSL_FAIL( "Cyclic module dependency detected" );
continue;
}
if( !rParentItem.m_bRunInitDone )
- implProcessModuleRunInit( rParentItem );
+ implProcessModuleRunInit( rMap, rParentItem );
}
}
}
@@ -995,22 +1200,23 @@ 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() )
pModule->Compile();
}
- // compile modules first then RunInit ( otherwise there is
+ // compile modules first then RunInit ( otherwise there is
// can be order dependency, e.g. classmodule A has a member
// of of type classmodule B and classmodule B hasn't been compiled yet )
// 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();
@@ -1022,12 +1228,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() )
@@ -1036,7 +1241,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);
@@ -1050,14 +1255,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);
@@ -1070,13 +1275,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,
@@ -1107,7 +1312,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() )
@@ -1124,12 +1329,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 );
@@ -1145,9 +1350,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();
@@ -1170,7 +1375,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;
@@ -1188,7 +1393,7 @@ SbxVariable* StarBASIC::FindVarInCurrentScopy
void StarBASIC::QuitAndExitApplication()
{
Stop();
- bQuit = TRUE;
+ bQuit = sal_True;
}
void StarBASIC::Stop()
@@ -1201,9 +1406,9 @@ void StarBASIC::Stop()
}
}
-BOOL StarBASIC::IsRunning()
+sal_Bool StarBASIC::IsRunning()
{
- return BOOL( pINST != NULL );
+ return sal_Bool( pINST != NULL );
}
/**************************************************************************
@@ -1214,7 +1419,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 )
{
@@ -1229,7 +1434,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 )
@@ -1246,7 +1451,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 );
@@ -1262,41 +1467,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 __EXPORT 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;
@@ -1323,9 +1528,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() )
{
@@ -1350,7 +1555,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;
@@ -1365,7 +1570,7 @@ USHORT StarBASIC::GetVBErrorCode( SbError nError )
return nRet;
}
-SbError StarBASIC::GetSfxFromVBError( USHORT nError )
+SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
{
SbError nRet = 0L;
@@ -1397,7 +1602,7 @@ SbError StarBASIC::GetSfxFromVBError( USHORT nError )
}
}
const SFX_VB_ErrorItem* pErrItem;
- USHORT nIndex = 0;
+ sal_uInt16 nIndex = 0;
do
{
pErrItem = SFX_VB_ErrorTab + nIndex;
@@ -1417,7 +1622,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;
@@ -1433,26 +1638,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;
}
@@ -1468,11 +1673,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() )
{
@@ -1480,7 +1685,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 )
{
@@ -1501,8 +1706,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;
@@ -1512,39 +1717,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;
@@ -1558,7 +1763,7 @@ BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1,
{
// very confusing, even though MakeErrorText sets up the error text
// seems that this is not used ( if rMsg already has content )
- // In the case of VBA MakeErrorText also formats the error to be alittle more
+ // In the case of VBA MakeErrorText also formats the error to be alittle more
// like vba ( adds an error number etc )
if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
{
@@ -1566,15 +1771,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();
}
@@ -1619,7 +1824,7 @@ String StarBASIC::GetErrorMsg()
return String();
}
-USHORT StarBASIC::GetErl()
+sal_uInt16 StarBASIC::GetErl()
{
if( pINST )
return pINST->GetErl();
@@ -1627,10 +1832,10 @@ USHORT StarBASIC::GetErl()
return 0;
}
-BOOL __EXPORT 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()
@@ -1668,16 +1873,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++ )
{
@@ -1693,14 +1898,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
@@ -1723,26 +1928,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 )
@@ -1758,6 +1963,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
@@ -1767,7 +2020,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;
@@ -1811,18 +2064,18 @@ void BasicCollection::Initialize()
p->SetFlag( SBX_DONTSTORE );
p = Make( String::CreateFromAscii( pRemoveStr ), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
- if ( !xAddInfo.Is() )
+ if ( !xAddInfo.Is() )
{
xAddInfo = new SbxInfo;
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Item") ), SbxVARIANT, SBX_READ );
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Key") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Before") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
- xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("After") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
+ xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Item") ), SbxVARIANT, SBX_READ );
+ xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Key") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
+ xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Before") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
+ xAddInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("After") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL );
}
- if ( !xItemInfo.Is() )
+ if ( !xItemInfo.Is() )
{
xItemInfo = new SbxInfo;
- xItemInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Index") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL);
+ xItemInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("Index") ), SbxVARIANT, SBX_READ | SBX_OPTIONAL);
}
}
@@ -1838,10 +2091,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() );
@@ -1876,9 +2129,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
@@ -1886,12 +2139,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 &&
@@ -1906,7 +2159,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 );
@@ -1932,7 +2185,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 );
@@ -1942,7 +2195,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 );
@@ -1991,8 +2244,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 );
@@ -2009,8 +2262,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 632148acc0..acc2f2352a 100644
--- a/basic/source/classes/sb.src
+++ b/basic/source/classes/sb.src
@@ -47,17 +47,14 @@ Resource RID_BASIC_START
};
String SbERR_BAD_ARGUMENT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Prozeduraufruf : Ungltiger Prozeduraufruf */
Text [ en-US ] = "Invalid procedure call." ;
};
String SbERR_MATH_OVERFLOW & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? šberlauf : Überlauf */
Text [ en-US ] = "Overflow." ;
};
String SbERR_NO_MEMORY & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Nicht gen³gend Speicher : Nicht gengend Speicher */
Text [ en-US ] = "Not enough memory." ;
};
String SbERR_ALREADY_DIM & ERRCODE_RES_MASK
@@ -66,7 +63,6 @@ Resource RID_BASIC_START
};
String SbERR_OUT_OF_RANGE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Index au˜erhalb des definierten Bereichs : Index auÿerhalb des definierten Bereichs */
Text [ en-US ] = "Index out of defined range." ;
};
String SbERR_DUPLICATE_DEF & ERRCODE_RES_MASK
@@ -83,12 +79,10 @@ Resource RID_BASIC_START
};
String SbERR_CONVERSION & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Datentypen unvertrõglich : Datentypen unvertr§glich */
Text [ en-US ] = "Data type mismatch." ;
};
String SbERR_BAD_PARAMETER & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Parameter : Ungltiger Parameter */
Text [ en-US ] = "Invalid parameter." ;
};
String SbERR_USER_ABORT & ERRCODE_RES_MASK
@@ -101,7 +95,6 @@ Resource RID_BASIC_START
};
String SbERR_STACK_OVERFLOW & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Nicht gen³gend Stapelspeicher : Nicht gengend Stapelspeicher */
Text [ en-US ] = "Not enough stack memory." ;
};
String SbERR_PROC_UNDEFINED & ERRCODE_RES_MASK
@@ -134,12 +127,10 @@ Resource RID_BASIC_START
};
String SbERR_FILE_ALREADY_OPEN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Datei bereits ge÷ffnet : Datei bereits ge”ffnet */
Text [ en-US ] = "File already open." ;
};
String SbERR_IO_ERROR & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Gerõte-E/A-Fehler : Ger§te-E/A-Fehler */
Text [ en-US ] = "Device I/O error." ;
};
String SbERR_FILE_EXISTS & ERRCODE_RES_MASK
@@ -148,7 +139,6 @@ Resource RID_BASIC_START
};
String SbERR_BAD_RECORD_LENGTH & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Falsche Datensatzlõnge : Falsche Datensatzl§nge */
Text [ en-US ] = "Incorrect record length." ;
};
String SbERR_DISK_FULL & ERRCODE_RES_MASK
@@ -157,7 +147,6 @@ Resource RID_BASIC_START
};
String SbERR_READ_PAST_EOF & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Lesen ³ber das Ende der Datei hinaus : Lesen ber das Ende der Datei hinaus */
Text [ en-US ] = "Reading exceeds EOF." ;
};
String SbERR_BAD_RECORD_NUMBER & ERRCODE_RES_MASK
@@ -170,7 +159,6 @@ Resource RID_BASIC_START
};
String SbERR_NO_DEVICE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Gerõt nicht verf³gbar : Ger§t nicht verfgbar */
Text [ en-US ] = "Device not available." ;
};
String SbERR_ACCESS_DENIED & ERRCODE_RES_MASK
@@ -187,7 +175,6 @@ Resource RID_BASIC_START
};
String SbERR_DIFFERENT_DRIVE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Umbenennen auf verschiedenen Laufwerken nicht m÷glich : Umbenennen auf verschiedenen Laufwerken nicht m”glich */
Text [ en-US ] = "Renaming on different drives impossible." ;
};
String SbERR_ACCESS_ERROR & ERRCODE_RES_MASK
@@ -204,12 +191,10 @@ Resource RID_BASIC_START
};
String SbERR_BAD_PATTERN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Zeichenfolgenmuster unzulõssig : Zeichenfolgenmuster unzul§ssig */
Text [ en-US ] = "Invalid string pattern." ;
};
String SBERR_IS_NULL & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Verwendung von Null unzulõssig : Verwendung von Null unzul§ssig */
Text [ en-US ] = "Use of zero not permitted." ;
};
String SbERR_DDE_ERROR & ERRCODE_RES_MASK
@@ -222,7 +207,6 @@ Resource RID_BASIC_START
};
String SbERR_DDE_OUTOFCHANNELS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Keine freien DDE-Kanõle : Keine freien DDE-Kan§le */
Text [ en-US ] = "No DDE channels available." ;
};
String SbERR_DDE_NO_RESPONSE & ERRCODE_RES_MASK
@@ -239,17 +223,14 @@ Resource RID_BASIC_START
};
String SbERR_DDE_NOTPROCESSED & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fremdapplikation kann DDE-Operation nicht ausf³hren : Fremdapplikation kann DDE-Operation nicht ausfhren */
Text [ en-US ] = "External application cannot execute DDE operation." ;
};
String SbERR_DDE_TIMEOUT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Zeit³berschreitung wõhrend des Wartens auf DDE-Antwort : Zeitberschreitung w§hrend des Wartens auf DDE-Antwort */
Text [ en-US ] = "Timeout while waiting for DDE response." ;
};
String SbERR_DDE_USER_INTERRUPT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Benutzer dr³ckte ESCAPE wõhrend der DDE-Operation : Benutzer drckte ESCAPE w§hrend der DDE-Operation */
Text [ en-US ] = "User pressed ESCAPE during DDE operation." ;
};
String SbERR_DDE_BUSY & ERRCODE_RES_MASK
@@ -270,7 +251,6 @@ Resource RID_BASIC_START
};
String SbERR_DDE_CONV_CLOSED & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? DDE-Verbindung ist unterbrochen oder geõndert worden : DDE-Verbindung ist unterbrochen oder ge§ndert worden */
Text [ en-US ] = "DDE connection interrupted or modified." ;
};
String SbERR_DDE_NO_CHANNEL & ERRCODE_RES_MASK
@@ -279,7 +259,6 @@ Resource RID_BASIC_START
};
String SbERR_DDE_INVALID_LINK & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges DDE-Linkformat : Ungltiges DDE-Linkformat */
Text [ en-US ] = "Invalid DDE link format." ;
};
String SbERR_DDE_QUEUE_OVERFLOW & ERRCODE_RES_MASK
@@ -288,52 +267,42 @@ Resource RID_BASIC_START
};
String SbERR_DDE_LINK_ALREADY_EST & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Paste Link bereits durchgef³hrt : Paste Link bereits durchgefhrt */
Text [ en-US ] = "Paste link already performed." ;
};
String SbERR_DDE_LINK_INV_TOPIC & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? LinkMode kann wegen ung³ltigen Link-Topics nicht gesetzt werden : LinkMode kann wegen ungltigen Link-Topics nicht gesetzt werden */
Text [ en-US ] = "Link mode cannot be set due to invalid link topic." ;
};
String SbERR_DDE_DLL_NOT_FOUND & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? F³r DDE wird DDEML.DLL ben÷tigt : Fr DDE wird DDEML.DLL ben”tigt */
Text [ en-US ] = "DDE requires the DDEML.DLL file." ;
};
String SbERR_CANNOT_LOAD & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Das Modul kann nicht geladen werden, ung³ltiges Format : Das Modul kann nicht geladen werden, ungltiges Format */
Text [ en-US ] = "Module cannot be loaded; invalid format." ;
};
String SbERR_BAD_INDEX & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Objektindex : Ungltiger Objektindex */
Text [ en-US ] = "Invalid object index." ;
};
String SbERR_NO_ACTIVE_OBJECT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Objekt ist nicht verf³gbar : Objekt ist nicht verfgbar */
Text [ en-US ] = "Object is not available." ;
};
String SbERR_BAD_PROP_VALUE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Falscher Wert f³r Eigenschaft : Falscher Wert fr Eigenschaft */
Text [ en-US ] = "Incorrect property value." ;
};
String SbERR_PROP_READONLY & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist schreibgesch³tzt : Eigenschaft ist schreibgeschtzt */
Text [ en-US ] = "This property is read-only." ;
};
String SbERR_PROP_WRITEONLY & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist lesegesch³tzt : Eigenschaft ist lesegeschtzt */
Text [ en-US ] = "This property is write only." ;
};
String SbERR_INVALID_OBJECT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltige Objektreferenz : Ungltige Objektreferenz */
Text [ en-US ] = "Invalid object reference." ;
};
String SbERR_NO_METHOD & ERRCODE_RES_MASK
@@ -350,12 +319,10 @@ Resource RID_BASIC_START
};
String SbERR_NO_OLE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? OLE-Automatisierung wird von diesem Objekt nicht unterst³tzt : OLE-Automatisierung wird von diesem Objekt nicht untersttzt */
Text [ en-US ] = "OLE Automation is not supported by this object." ;
};
String SbERR_BAD_METHOD & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Objekt unterst³tzt diese Eigenschaft oder Methode nicht : Objekt untersttzt diese Eigenschaft oder Methode nicht */
Text [ en-US ] = "This property or method is not supported by the object." ;
};
String SbERR_OLE_ERROR & ERRCODE_RES_MASK
@@ -364,17 +331,14 @@ Resource RID_BASIC_START
};
String SbERR_BAD_ACTION & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Diese Aktion wird vom angegebenen Objekt nicht unterst³tzt : Diese Aktion wird vom angegebenen Objekt nicht untersttzt */
Text [ en-US ] = "This action is not supported by given object." ;
};
String SbERR_NO_NAMED_ARGS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Benannte Argumente werden vom angegebenen Objekt nicht unterst³tzt : Benannte Argumente werden vom angegebenen Objekt nicht untersttzt */
Text [ en-US ] = "Named arguments are not supported by given object." ;
};
String SbERR_BAD_LOCALE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht unterst³tzt : Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht untersttzt */
Text [ en-US ] = "The current locale setting is not supported by the given object." ;
};
String SbERR_NAMED_NOT_FOUND & ERRCODE_RES_MASK
@@ -395,7 +359,6 @@ Resource RID_BASIC_START
};
String SbERR_BAD_ORDINAL & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ordnungszahl ung³ltig : Ordnungszahl ungltig */
Text [ en-US ] = "Invalid ordinal number." ;
};
String SbERR_DLLPROC_NOT_FOUND & ERRCODE_RES_MASK
@@ -404,7 +367,6 @@ Resource RID_BASIC_START
};
String SbERR_BAD_CLIPBD_FORMAT & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges Clipboard-Format : Ungltiges Clipboard-Format */
Text [ en-US ] = "Invalid clipboard format." ;
};
String SbERR_PROPERTY_NOT_FOUND & ERRCODE_RES_MASK
@@ -421,12 +383,10 @@ Resource RID_BASIC_START
};
String SbERR_BAD_NUMBER_OF_ARGS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltige Anzahl von Argumenten : Ungltige Anzahl von Argumenten */
Text [ en-US ] = "Invalid number of arguments." ;
};
String SbERR_METHOD_FAILED & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fehler in Ausf³hrung einer Methode : Fehler in Ausfhrung einer Methode */
Text [ en-US ] = "Error executing a method." ;
};
String SbERR_SETPROP_FAILED & ERRCODE_RES_MASK
@@ -516,12 +476,10 @@ Resource RID_BASIC_START
};
String SbERR_BAD_CHAR_IN_NUMBER & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges Zeichen in Zahl : Ungltiges Zeichen in Zahl */
Text [ en-US ] = "Invalid character in number." ;
};
String SbERR_MUST_HAVE_DIMS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Array mu˜ dimensioniert werden : Array muÿ dimensioniert werden */
Text [ en-US ] = "Array must be dimensioned." ;
};
String SbERR_NO_IF & ERRCODE_RES_MASK
@@ -530,12 +488,10 @@ Resource RID_BASIC_START
};
String SbERR_NOT_IN_SUBR & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) innerhalb einer Prozedur unzulõssig : $(ARG1) innerhalb einer Prozedur unzul§ssig */
Text [ en-US ] = "$(ARG1) not allowed within a procedure." ;
};
String SbERR_NOT_IN_MAIN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) au˜erhalb einer Prozedur unzulõssig : $(ARG1) auÿerhalb einer Prozedur unzul§ssig */
Text [ en-US ] = "$(ARG1) not allowed outside a procedure." ;
};
String SbERR_WRONG_DIMS & ERRCODE_RES_MASK
@@ -552,12 +508,10 @@ Resource RID_BASIC_START
};
String SbERR_PROG_TOO_LARGE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Programm ist zu gro˜ : Programm ist zu groÿ */
Text [ en-US ] = "Program too large." ;
};
String SbERR_NO_STRINGS_ARRAYS & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Strings oder Arrays unzulõssig : Strings oder Arrays unzul§ssig */
Text [ en-US ] = "Strings or arrays not permitted." ;
};
String ERRCODE_BASIC_EXCEPTION & ERRCODE_RES_MASK
@@ -604,26 +558,14 @@ String IDS_SBERR_STOREREF
};
String ERRCODE_BASMGR_LIBLOAD & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */
Text [ en-US ] = "Error loading library '$(ARG1)'." ;
};
String ERRCODE_BASMGR_LIBSAVE & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */
- /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */
Text [ en-US ] = "Error saving library: '$(ARG1)'." ;
};
String ERRCODE_BASMGR_MGROPEN & ERRCODE_RES_MASK
{
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
- /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */
Text [ en-US ] = "The BASIC from the file '$(ARG1)' could not be initialized." ;
};
String ERRCODE_BASMGR_MGRSAVE & ERRCODE_RES_MASK
diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx
index 039bdddf5f..fa9b2f3c65 100644
--- 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 8765132162..8a079a6360 100644
--- 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>
@@ -94,7 +98,7 @@ using namespace cppu;
#include<runtime.hxx>
#include<math.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
#include <com/sun/star/reflection/XConstantsTypeDescription.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 )
{
@@ -564,22 +605,11 @@ SbxDataType unoToSbxType( TypeClass eType )
case TypeClass_STRUCT:
case TypeClass_EXCEPTION: eRetType = SbxOBJECT; break;
- /* first we leave the following types out
- case TypeClass_SERVICE: break;
- case TypeClass_CLASS: break;
- case TypeClass_TYPEDEF: break;
- case TypeClass_UNION: break;
- case TypeClass_ARRAY: break;
- */
case TypeClass_ENUM: eRetType = SbxLONG; break;
case TypeClass_SEQUENCE:
eRetType = (SbxDataType) ( SbxOBJECT | SbxARRAY );
break;
- /*
- case TypeClass_VOID: break;
- case TypeClass_UNKNOWN: break;
- */
case TypeClass_ANY: eRetType = SbxVARIANT; break;
case TypeClass_BOOLEAN: eRetType = SbxBOOL; break;
@@ -587,18 +617,13 @@ SbxDataType unoToSbxType( TypeClass eType )
case TypeClass_STRING: eRetType = SbxSTRING; break;
case TypeClass_FLOAT: eRetType = SbxSINGLE; break;
case TypeClass_DOUBLE: eRetType = SbxDOUBLE; break;
- //case TypeClass_OCTET: break;
case TypeClass_BYTE: eRetType = SbxINTEGER; break;
- //case TypeClass_INT: eRetType = SbxINT; break;
case TypeClass_SHORT: eRetType = SbxINTEGER; break;
case TypeClass_LONG: eRetType = SbxLONG; break;
case TypeClass_HYPER: eRetType = SbxSALINT64; break;
- //case TypeClass_UNSIGNED_OCTET: break;
case TypeClass_UNSIGNED_SHORT: eRetType = SbxUSHORT; break;
case TypeClass_UNSIGNED_LONG: eRetType = SbxULONG; break;
case TypeClass_UNSIGNED_HYPER: eRetType = SbxSALUINT64;break;
- //case TypeClass_UNSIGNED_INT: eRetType = SbxUINT; break;
- //case TypeClass_UNSIGNED_BYTE: eRetType = SbxUSHORT; break;
default: break;
}
return eRetType;
@@ -620,7 +645,6 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
Type aType = aValue.getValueType();
TypeClass eTypeClass = aType.getTypeClass();
- sal_Int32 indicesIndex = indices.getLength() -1;
sal_Int32 dimCopy = dimension;
if ( eTypeClass == TypeClass_SEQUENCE )
@@ -635,7 +659,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 )
{
@@ -645,7 +669,6 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
sizes.realloc( sizes.getLength() + 1 );
sizes[ sizes.getLength() - 1 ] = nLen;
indices.realloc( indices.getLength() + 1 );
- indicesIndex = indices.getLength() - 1;
}
}
@@ -738,6 +761,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
if( eTypeClass == TypeClass_STRUCT )
{
ArrayWrapper aWrap;
+ NativeObjectWrapper aNativeObjectWrapper;
if ( (aValue >>= aWrap) )
{
SbxDimArray* pArray = NULL;
@@ -748,7 +772,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 );
@@ -757,6 +781,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;
@@ -781,13 +817,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
oleautomation::Currency aCurrency;
if( (aValue >>= aCurrency) )
{
- sal_Int64 nValue64 = aCurrency.Value;
- SbxINT64 aInt64;
- aInt64.nHigh =
- sal::static_int_cast< INT32 >(
- nValue64 >> 32);
- aInt64.nLow = (UINT32)( nValue64 & 0xffffffff );
- pVar->PutCurrency( aInt64 );
+ pVar->PutCurrency( aCurrency.Value );
break;
}
}
@@ -823,14 +853,6 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
break;
- /* folgende Typen lassen wir erstmal weg
- case TypeClass_SERVICE: break;
- case TypeClass_CLASS: break;
- case TypeClass_TYPEDEF: break;
- case TypeClass_UNION: break;
- case TypeClass_ENUM: break;
- case TypeClass_ARRAY: break;
- */
case TypeClass_ENUM:
{
@@ -864,7 +886,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 );
@@ -878,29 +900,14 @@ 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 );
- // The parameter mustn't deleted here
- //pVar->SetParameters( NULL );
}
break;
- /*
- case TypeClass_VOID: break;
- case TypeClass_UNKNOWN: break;
-
- case TypeClass_ANY:
- {
- // get Any and convert it
- //Any* pAny = (Any*)aValue.get();
- //if( pAny )
- //unoToSbxValue( pVar, *pAny );
- }
- break;
- */
case TypeClass_BOOLEAN: pVar->PutBool( *(sal_Bool*)aValue.getValue() ); break;
case TypeClass_CHAR:
@@ -911,18 +918,13 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
case TypeClass_STRING: { ::rtl::OUString val; aValue >>= val; pVar->PutString( String( val ) ); } break;
case TypeClass_FLOAT: { float val = 0; aValue >>= val; pVar->PutSingle( val ); } break;
case TypeClass_DOUBLE: { double val = 0; aValue >>= val; pVar->PutDouble( val ); } break;
- //case TypeClass_OCTET: break;
case TypeClass_BYTE: { sal_Int8 val = 0; aValue >>= val; pVar->PutInteger( val ); } break;
- //case TypeClass_INT: break;
case TypeClass_SHORT: { sal_Int16 val = 0; aValue >>= val; pVar->PutInteger( val ); } break;
case TypeClass_LONG: { sal_Int32 val = 0; aValue >>= val; pVar->PutLong( val ); } break;
case TypeClass_HYPER: { sal_Int64 val = 0; aValue >>= val; pVar->PutInt64( val ); } break;
- //case TypeClass_UNSIGNED_OCTET:break;
case TypeClass_UNSIGNED_SHORT: { sal_uInt16 val = 0; aValue >>= val; pVar->PutUShort( val ); } break;
case TypeClass_UNSIGNED_LONG: { sal_uInt32 val = 0; aValue >>= val; pVar->PutULong( val ); } break;
case TypeClass_UNSIGNED_HYPER: { sal_uInt64 val = 0; aValue >>= val; pVar->PutUInt64( val ); } break;
- //case TypeClass_UNSIGNED_INT: break;
- //case TypeClass_UNSIGNED_BYTE: break;
default: pVar->PutEmpty(); break;
}
}
@@ -933,7 +935,6 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
Type aRetType = getCppuVoidType();
switch( eType )
{
- //case SbxEMPTY: eRet = TypeClass_VOID; break;
case SbxNULL: aRetType = ::getCppuType( (const Reference< XInterface > *)0 ); break;
case SbxINTEGER: aRetType = ::getCppuType( (sal_Int16*)0 ); break;
case SbxLONG: aRetType = ::getCppuType( (sal_Int32*)0 ); break;
@@ -949,31 +950,16 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
aRetType = ::getCppuType( (oleautomation::Date*)0 );
}
break;
- // case SbxDATE: aRetType = ::getCppuType( (double*)0 ); break;
case SbxSTRING: aRetType = ::getCppuType( (::rtl::OUString*)0 ); break;
- //case SbxOBJECT: break;
- //case SbxERROR: break;
case SbxBOOL: aRetType = ::getCppuType( (sal_Bool*)0 ); break;
case SbxVARIANT: aRetType = ::getCppuType( (Any*)0 ); break;
- //case SbxDATAOBJECT: break;
case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break;
case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break;
case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break;
case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
- //case SbxLONG64: break;
- //case SbxULONG64: break;
// map machine-dependent ones on hyper for secureness
case SbxINT: aRetType = ::getCppuType( (sal_Int32*)0 ); break;
case SbxUINT: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
- //case SbxVOID: break;
- //case SbxHRESULT: break;
- //case SbxPOINTER: break;
- //case SbxDIMARRAY: break;
- //case SbxCARRAY: break;
- //case SbxUSERDEF: break;
- //case SbxLPSTR: break;
- //case SbxLPWSTR: break;
- //case SbxCoreSTRING: break;
default: break;
}
return aRetType;
@@ -993,8 +979,6 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
SbxBaseRef xObj = (SbxBase*)pVal->GetObject();
if( !xObj )
{
- // #109936 No error any more
- // StarBASIC::Error( SbERR_INVALID_OBJECT );
aRetType = getCppuType( static_cast<Reference<XInterface> *>(0) );
return aRetType;
}
@@ -1018,9 +1002,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 );
@@ -1028,7 +1012,6 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
{
if( aType.getTypeClass() == TypeClass_VOID )
{
- // #88522
// if only first element is void: different types -> []any
// if all elements are void: []void is not allowed -> []any
aElementType = getCppuType( (Any*)0 );
@@ -1056,10 +1039,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 );
@@ -1103,7 +1086,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
// Otherwise it is a No-Uno-Basic-Object -> default==deliver void
}
- // No objekt, convert basic type
+ // No object, convert basic type
else
{
aRetType = getUnoTypeForSbxBaseType( eBaseType );
@@ -1133,6 +1116,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;
+ }
+ }
}
}
@@ -1192,6 +1189,7 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
aType = ::getCppuType( (sal_uInt16*)0 );
break;
}
+ // TODO: need to add hyper types ?
default: break;
}
}
@@ -1268,6 +1266,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 )
{
@@ -1324,13 +1345,8 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
else if( rType == ::getCppuType( (oleautomation::Currency*)0 ) )
{
- SbxINT64 aInt64 = pVar->GetCurrency();
- oleautomation::Currency aCurrency;
- sal_Int64& rnValue64 = aCurrency.Value;
- rnValue64 = aInt64.nHigh;
- rnValue64 <<= 32;
- rnValue64 |= aInt64.nLow;
- aRetVal <<= aCurrency;
+ // assumes per previous code that ole Currency is Int64
+ aRetVal <<= (sal_Int64)( pVar->GetInt64() );
break;
}
else if( rType == ::getCppuType( (oleautomation::Date*)0 ) )
@@ -1358,16 +1374,40 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
break;
- /* we leave out the following types
- case TypeClass_SERVICE: break;
- case TypeClass_CLASS: break;
- case TypeClass_TYPEDEF: break;
- case TypeClass_UNION: break;
- case TypeClass_ENUM: break;
- case TypeClass_ARRAY: 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;
+
- // Array -> Sequence
case TypeClass_ENUM:
{
aRetVal = int2enum( pVar->GetLong(), rType );
@@ -1402,7 +1442,6 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
typelib_typedescription_getByName( &pSeqTD, aClassName.pData );
OSL_ASSERT( pSeqTD );
Type aElemType( ((typelib_IndirectTypeDescription *)pSeqTD)->pType );
- // Reference< XIdlClass > xElementClass = TypeToIdlClass( aElemType );
// convert all array member and register them
sal_Int32 nIdx = nLower;
@@ -1482,10 +1521,6 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
break;
- /*
- case TypeClass_VOID: break;
- case TypeClass_UNKNOWN: break;
- */
// Use for Any the class indipendent converting routine
case TypeClass_ANY:
@@ -1509,7 +1544,6 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break;
case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break;
case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break;
- //case TypeClass_OCTET: break;
case TypeClass_BYTE:
{
@@ -1532,23 +1566,19 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
aRetVal <<= nByteVal;
break;
}
- //case TypeClass_INT: break;
case TypeClass_SHORT: aRetVal <<= (sal_Int16)( pVar->GetInteger() ); break;
case TypeClass_LONG: aRetVal <<= (sal_Int32)( pVar->GetLong() ); break;
case TypeClass_HYPER: aRetVal <<= (sal_Int64)( pVar->GetInt64() ); break;
- //case TypeClass_UNSIGNED_OCTET:break;
case TypeClass_UNSIGNED_SHORT: aRetVal <<= (sal_uInt16)( pVar->GetUShort() ); break;
case TypeClass_UNSIGNED_LONG: aRetVal <<= (sal_uInt32)( pVar->GetULong() ); break;
case TypeClass_UNSIGNED_HYPER: aRetVal <<= (sal_uInt64)( pVar->GetUInt64() ); break;
- //case TypeClass_UNSIGNED_INT: break;
- //case TypeClass_UNSIGNED_BYTE: break;
default: break;
}
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 )
@@ -1557,7 +1587,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();
@@ -1565,7 +1595,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 );
@@ -1588,7 +1618,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 );
}
}
@@ -1600,9 +1630,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;
@@ -1627,30 +1657,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();
@@ -1669,8 +1699,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 ) )
@@ -1751,15 +1781,15 @@ 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];
Reference<XIdlClass> xClass = TypeToIdlClass( rType );
if( !xClass.is() )
{
- DBG_ERROR("failed to get XIdlClass for type");
+ OSL_FAIL("failed to get XIdlClass for type");
break;
}
::rtl::OUString sClassName = xClass->getName();
@@ -1830,8 +1860,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];
@@ -1855,7 +1885,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
else if( xClassProvider.is() )
{
- DBG_ERROR( "XClassProvider not supported in UNO3" );
+ OSL_FAIL( "XClassProvider not supported in UNO3" );
}
}
return aRet;
@@ -1888,8 +1918,6 @@ String Dbg_SbxDataType2String( SbxDataType eType )
case SbxBYTE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxBYTE") ); break;
case SbxUSHORT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUSHORT") ); break;
case SbxULONG: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxULONG") ); break;
- case SbxLONG64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLONG64") ); break;
- case SbxULONG64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxULONG64") ); break;
case SbxSALINT64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINT64") ); break;
case SbxSALUINT64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUINT64") ); break;
case SbxINT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINT") ); break;
@@ -1931,13 +1959,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 )
@@ -1950,7 +1978,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 ];
@@ -1960,7 +1988,7 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
{
eType = unoToSbxType( rProp.Type.getTypeClass() );
- bMaybeVoid = TRUE;
+ bMaybeVoid = sal_True;
}
if( eType == SbxOBJECT )
{
@@ -2011,14 +2039,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 )
@@ -2046,12 +2074,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;
@@ -2098,7 +2126,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
@@ -2149,7 +2177,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 )
@@ -2222,18 +2250,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 )
@@ -2271,19 +2299,18 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
const ParamInfo& rInfo = pParamInfos[i];
const Reference< XIdlClass >& rxClass = rInfo.aType;
- //const XIdlClassRef& rxClass = pUnoParams[i];
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;
}
}
}
@@ -2295,7 +2322,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() )
@@ -2314,13 +2341,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 ] );
}
}
}
@@ -2328,7 +2355,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
@@ -2339,7 +2366,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
@@ -2355,8 +2382,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;
@@ -2388,10 +2415,6 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
if( mxInvocation.is() )
{
- // #94670: This is WRONG because then the MaterialHolder doesn't refer
- // to the object implementing XInvocation but to the object passed to
- // the invocation service!!!
- // mxMaterialHolder = Reference< XMaterialHolder >::query( mxInvocation );
// get the ExactName
mxExactNameInvocation = Reference< XExactName >::query( mxInvocation );
@@ -2399,7 +2422,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;
}
@@ -2407,34 +2430,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 );
@@ -2444,14 +2467,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;
}
}
}
@@ -2482,7 +2505,7 @@ void SbUnoObject::doIntrospection( void )
if( !bNeedIntrospection )
return;
- bNeedIntrospection = FALSE;
+ bNeedIntrospection = sal_False;
if( !xIntrospection.is() )
{
@@ -2490,10 +2513,9 @@ void SbUnoObject::doIntrospection( void )
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
if ( xFactory.is() )
{
- Reference< XInterface > xI = xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") );
+ Reference< XInterface > xI = xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) );
if (xI.is())
xIntrospection = Reference< XIntrospection >::query( xI );
- //xI->queryInterface( ::getCppuType( (const Reference< XIntrospection > *)0 ), xIntrospection );
}
}
if( !xIntrospection.is() )
@@ -2531,6 +2553,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;
@@ -2547,10 +2610,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;
@@ -2586,16 +2651,15 @@ 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_ );
}
}
@@ -2618,7 +2682,7 @@ SbUnoProperty::SbUnoProperty
const String& aName_,
SbxDataType eSbxType,
const Property& aUnoProp_,
- INT32 nId_,
+ sal_Int32 nId_,
bool bInvocation
)
: SbxProperty( aName_, eSbxType )
@@ -2651,7 +2715,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() )
{
@@ -2752,6 +2816,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 )
{
@@ -2811,11 +2886,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() )
@@ -2823,10 +2898,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 ];
@@ -2849,7 +2924,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++ )
{
@@ -2909,7 +2984,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;
@@ -2942,7 +3017,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;
@@ -2967,7 +3042,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;
@@ -3021,7 +3096,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;
@@ -3079,7 +3154,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;
@@ -3103,13 +3178,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 );
@@ -3118,7 +3193,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();
@@ -3137,7 +3212,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();
@@ -3155,10 +3230,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;
@@ -3172,7 +3247,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 );
@@ -3184,11 +3259,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;
@@ -3201,7 +3276,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 );
@@ -3216,7 +3291,6 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
return;
Reference< XInterface > x1;
aAny1 >>= x1;
- //XInterfaceRef x1 = *(XInterfaceRef*)aAny1.get();
SbxVariableRef xParam2 = rPar.Get( 2 );
if( !xParam2->IsObject() )
@@ -3230,13 +3304,12 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
return;
Reference< XInterface > x2;
aAny2 >>= x2;
- //XInterfaceRef x2 = *(XInterfaceRef*)aAny2.get();
if( x1 == x2 )
- refVar->PutBool( TRUE );
+ refVar->PutBool( sal_True );
}
-typedef std::hash_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash;
+typedef boost::unordered_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash;
// helper wrapper function to interact with TypeProvider and
@@ -3263,7 +3336,7 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
return xEnum;
}
-typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+typedef boost::unordered_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
VBAConstantHelper&
VBAConstantHelper::instance()
@@ -3325,7 +3398,7 @@ VBAConstantHelper::isVBAConstantType( const String& rName )
::rtl::OUString sKey( rName );
VBAConstantsVector::const_iterator it = aConstCache.begin();
- for( ; it != aConstCache.end(); it++ )
+ for( ; it != aConstCache.end(); ++it )
{
if( sKey.equalsIgnoreAsciiCase( *it ) )
{
@@ -3506,7 +3579,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;
@@ -3590,14 +3663,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;
@@ -3615,8 +3688,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 )
{
@@ -3627,8 +3700,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 )
@@ -3655,9 +3728,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;
@@ -3679,7 +3752,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( !bOutParams )
{
if( xParam->isOut() )
- bOutParams = TRUE;
+ bOutParams = sal_True;
}
}
else
@@ -3724,14 +3797,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 ] );
}
}
}
@@ -3816,8 +3889,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 )
@@ -3859,8 +3932,6 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
//========================================================================
-//========================================================================
-//========================================================================
// Implementation of an EventAttacher-drawn AllListener, which
// solely transmits several events to an general AllListener
@@ -3875,9 +3946,6 @@ public:
BasicAllListener_Impl( const ::rtl::OUString& aPrefixName );
~BasicAllListener_Impl();
- // Methods of XInterface
- //virtual BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut );
-
// Methods of XAllListener
virtual void SAL_CALL firing(const AllEventObject& Event) throw ( RuntimeException );
virtual Any SAL_CALL approveFiring(const AllEventObject& Event) throw ( RuntimeException );
@@ -3922,13 +3990,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 );
@@ -3940,7 +4008,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 );
@@ -4135,7 +4203,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;
@@ -4168,7 +4236,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
// From 1999-11-30: get the InvocationAdapterFactory
Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = Reference< XInvocationAdapterFactory >(
- xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY );
+ xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.InvocationAdapterFactory")) ), UNO_QUERY );
BasicAllListener_Impl * p;
Reference< XAllListener > xAllLst = p = new BasicAllListener_Impl( aPrefixName );
@@ -4199,7 +4267,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;
@@ -4227,11 +4295,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 )
{
@@ -4243,6 +4313,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;
@@ -4268,28 +4373,6 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
Any aVal = sbxToUnoValueImpl( pVal );
Any aConvertedVal = convertAny( aVal, aDestType );
- /*
- // Convert
- Reference< XTypeConverter > xConverter = getTypeConverter_Impl();
- try
- {
- aConvertedVal = xConverter->convertTo( aVal, aDestType );
- }
- catch( IllegalArgumentException& e1 )
- {
- StarBASIC::Error( ERRCODE_BASIC_EXCEPTION,
- implGetExceptionMsg( ::cppu::getCaughtException() ) );
- return;
- }
- catch( CannotConvertException& e2 )
- {
- String aCannotConvertExceptionName
- ( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.IllegalArgumentException" ) );
- StarBASIC::Error( ERRCODE_BASIC_EXCEPTION,
- implGetExceptionMsg( e2, aCannotConvertExceptionName ) );
- return;
- }
- */
SbxVariableRef refVar = rPar.Get(0);
SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aConvertedVal );
@@ -4298,14 +4381,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()
@@ -4325,11 +4420,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;
}
@@ -4369,14 +4470,11 @@ void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty,
SbxVariableRef xValue = new SbxVariable;
pMeth->SetParameters( xArray );
pMeth->Call( xValue );
- //aRet = sbxToUnoValue( xValue );
pMeth->SetParameters( NULL );
// TODO: OutParameter?
- // throw InvocationTargetException();
- //return aRet;
}
@@ -4426,13 +4524,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 )
{
@@ -4452,7 +4564,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) );
}
}
@@ -4464,11 +4576,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 )
{
@@ -4498,6 +4637,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 )
{
@@ -4518,8 +4748,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();
@@ -4551,6 +4781,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;
}
@@ -4560,4 +4807,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 52bdddfef5..15c698951a 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -36,6 +36,7 @@
#include <svl/brdcst.hxx>
#include <tools/shl.hxx>
#include <basic/sbx.hxx>
+#include "sbdiagnose.hxx"
#include "sb.hxx"
#include <sbjsmeth.hxx>
#include "sbjsmod.hxx"
@@ -45,19 +46,22 @@
#include "runtime.hxx"
#include "token.hxx"
#include "sbunoobj.hxx"
-#include "sbtrace.hxx"
#include <svtools/syntaxhighlight.hxx>
#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;
@@ -179,7 +183,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
}
catch( Exception& )
{
- OSL_ENSURE( false, "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
+ OSL_FAIL( "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
}
}
@@ -264,7 +268,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 )
@@ -288,7 +292,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 )
@@ -300,9 +304,8 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
// call method
SbxVariableRef xReturn = new SbxVariable;
- ErrCode nErr = SbxERR_OK;
- nErr = pMethod->Call( xReturn );
+ pMethod->Call( xReturn );
Any aReturn;
// get output parameters
if ( xSbxParams.Is() )
@@ -311,7 +314,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 )
@@ -409,7 +412,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 );
@@ -424,7 +427,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 );
@@ -443,11 +446,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 )
{
@@ -499,38 +498,25 @@ 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::createFromAscii( "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;
}
-/////////////////////////////////////////////////////////////////////////////
// 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 )
{
@@ -566,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
@@ -587,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(); )
{
@@ -618,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 );
@@ -646,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;
}
@@ -664,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;
}
@@ -683,7 +669,7 @@ SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod
pMapperMethod->SetFlags( SBX_READ );
pMethods->Put( pMapperMethod, pMethods->Count() );
}
- pMapperMethod->bInvalid = FALSE;
+ pMapperMethod->bInvalid = sal_False;
return pMapperMethod;
}
@@ -696,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 )
@@ -714,7 +700,7 @@ void SbModule::EndDefinitions( BOOL bNewState )
else
i++;
}
- SetModified( TRUE );
+ SetModified( sal_True );
}
void SbModule::Clear()
@@ -779,8 +765,6 @@ const String& SbModule::GetSource() const
void SbModule::SetParent( SbxObject* p )
{
- // #118083: Assertion is not valid any more
- // DBG_ASSERT( !p || p->IsA( TYPE(StarBASIC) ), "Register SbModules only in BASIC" );
pParent = p;
}
@@ -810,12 +794,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 );
@@ -897,7 +881,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;
@@ -955,7 +939,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 );
}
@@ -967,7 +951,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() );
@@ -977,7 +961,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;
@@ -997,18 +981,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 )
@@ -1022,14 +1006,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) ) )
@@ -1037,7 +1021,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();
@@ -1074,8 +1058,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 );
@@ -1099,32 +1083,29 @@ 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 )
{
-#ifdef DBG_TRACE_BASIC
- dbg_InitTrace();
-#endif
// #32779: Hold Basic during the execution
xBasic = (StarBASIC*) GetParent();
@@ -1140,7 +1121,6 @@ USHORT SbModule::Run( SbMethod* pMeth )
#ifdef UNX
struct rlimit rl;
getrlimit ( RLIMIT_STACK, &rl );
- // printf( "RLIMIT_STACK = %ld\n", rl.rlim_cur );
#endif
#if defined LINUX
// Empiric value, 900 = needed bytes/Basic call level
@@ -1165,7 +1145,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 )
{
@@ -1181,27 +1161,18 @@ USHORT SbModule::Run( SbMethod* pMeth )
pMOD = this;
SbiRuntime* pRt = new SbiRuntime( this, pMeth, pMeth->nStart );
-#ifdef DBG_TRACE_BASIC
- dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl );
-#endif
-
pRt->pNext = pINST->pRun;
if( pRt->pNext )
pRt->pNext->block();
pINST->pRun = pRt;
if ( mbVBACompat )
{
- pINST->EnableCompatibility( TRUE );
+ pINST->EnableCompatibility( sal_True );
}
while( pRt->Step() ) {}
if( pRt->pNext )
pRt->pNext->unblock();
-#ifdef DBG_TRACE_BASIC
- bool bLeave = true;
- dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl, bLeave );
-#endif
-
// #63710 It can happen by an another thread handling at events,
// that the show call returns to an dialog (by closing the
// dialog per UI), before a by an event triggered further call returned,
@@ -1216,7 +1187,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
GetpApp()->Yield();
}
- nRes = TRUE;
+ nRes = sal_True;
pINST->pRun = pRt->pNext;
pINST->nCallLvl--; // Call-Level down again
@@ -1228,29 +1199,34 @@ 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();
+
+#ifdef DBG_UTIL
+ ResetCapturedAssertions();
+#endif
+
+ // VBA always ensures screenupdating is enabled after completing
+ if ( mbVBACompat )
+ VBAUnlockDocuments( PTR_CAST( StarBASIC, GetParent() ) );
+
+#ifdef DBG_TRACE_BASIC
+ dbg_DeInitTrace();
+#endif
}
}
else
@@ -1262,10 +1238,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,
@@ -1295,39 +1268,25 @@ 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 );
- // if( bDelInst )
- // pINST = new SbiInstance( (StarBASIC*) GetParent() );
SbModule* pOldMod = pMOD;
pMOD = this;
// The init code starts always here
SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 );
-#ifdef DBG_TRACE_BASIC
- dbg_traceNotifyCall( this, NULL, 0 );
-#endif
-
pRt->pNext = pINST->pRun;
pINST->pRun = pRt;
while( pRt->Step() ) {}
-#ifdef DBG_TRACE_BASIC
- bool bLeave = true;
- dbg_traceNotifyCall( this, NULL, 0, bLeave );
-#endif
-
pINST->pRun = pRt->pNext;
delete pRt;
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;
}
}
@@ -1361,7 +1320,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 )
@@ -1372,50 +1331,91 @@ 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();
- pj->SetFlags( (nFlags | SBX_WRITE) & (~SBX_FIXED) );
- pj->PutEmpty();
- pj->SetFlags( nFlags );
- */
}
}
}
else
{
p->SbxValue::Clear();
- /*
- USHORT nFlags = p->GetFlags();
- p->SetFlags( (nFlags | SBX_WRITE) & (~SBX_FIXED) );
- p->PutEmpty();
- p->SetFlags( nFlags );
- */
}
}
}
}
-// 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 )
@@ -1425,8 +1425,8 @@ void SbModule::GlobalRunInit( BOOL bBasicStart )
// Initialise GlobalInitErr-Flag for Compiler-Error
// 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 occured. Then it will not be launched.
- GetSbData()->bGlobalInitErr = FALSE;
+ // an error occurred. Then it will not be launched.
+ GetSbData()->bGlobalInitErr = sal_False;
// Parent of the module is a Basic
StarBASIC *pBasic = PTR_CAST(StarBASIC,GetParent());
@@ -1473,15 +1473,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++ );
@@ -1489,20 +1489,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 )
@@ -1518,67 +1518,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 )
@@ -1587,24 +1583,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;
@@ -1612,7 +1608,8 @@ BOOL SbModule::ClearBP( USHORT nLine )
void SbModule::ClearAllBP()
{
- delete pBreaks; pBreaks = NULL;
+ delete pBreaks;
+ pBreaks = NULL;
}
void
@@ -1620,39 +1617,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 )
@@ -1680,24 +1677,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
@@ -1714,12 +1711,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();
@@ -1776,17 +1773,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 );
@@ -1797,7 +1794,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
@@ -1812,9 +1809,8 @@ 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 );
@@ -1823,10 +1819,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 ) );
@@ -1840,42 +1836,131 @@ 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 )
:SbModule( 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;
}
@@ -1884,14 +1969,14 @@ 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 =
nLine2 = 0;
refStatics = new SbxArray;
mCaller = 0;
- // From: 1996-07.02: HACK due to 'Referenz could not be saved'
+ // HACK due to 'Referenz could not be saved'
SetFlag( SBX_NO_MODIFY );
}
@@ -1931,35 +2016,34 @@ 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;
- // nDebugFlags = n; // From 1996-01-16: no longer take over
+ sal_Int16 nTempStart = (sal_Int16)nStart;
if( nVer == 2 )
rStrm >> nLine1 >> nLine2 >> nTempStart >> bInvalid;
- // From: 1996-07-02: HACK ue to 'Referenz could not be saved'
+ // 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;
}
@@ -1972,7 +2056,7 @@ SbxInfo* SbMethod::GetInfo()
}
// Interface to execute a method of the applications
-// #34191# With special RefCounting, damit so that the Basic was not fired of by CloseDocument()
+// With special RefCounting, so that the Basic was not fired of by CloseDocument()
// The return value will be delivered as string.
ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
{
@@ -2014,7 +2098,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() )
{
@@ -2046,7 +2130,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() );
@@ -2055,7 +2139,6 @@ void SbMethod::Broadcast( ULONG nHintId )
}
}
-/////////////////////////////////////////////////////////////////////////
// Implementation of SbJScriptMethod (method class as a wrapper for JavaScript-functions)
@@ -2068,18 +2151,22 @@ SbJScriptMethod::~SbJScriptMethod()
{}
-/////////////////////////////////////////////////////////////////////////
SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible )
: SbModule( rName, bIsVbaCompatible )
{
SetModuleType( mInfo.ModuleType );
if ( mInfo.ModuleType == script::ModuleType::FORM )
{
- SetClassName( rtl::OUString::createFromAscii( "Form" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Form" )) );
}
else if ( mInfo.ModuleObject.is() )
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
}
+
+SbObjModule::~SbObjModule()
+{
+}
+
void
SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
{
@@ -2089,13 +2176,13 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException
pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
+ if( xServiceInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Worksheet" )) ) )
{
- SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Worksheet" )) );
}
- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Workbook" ) ) )
+ else if( xServiceInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Workbook" )) ) )
{
- SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Workbook" )) );
}
}
@@ -2107,7 +2194,6 @@ SbObjModule::GetObject()
SbxVariable*
SbObjModule::Find( const XubString& rName, SbxClassType t )
{
- //OSL_TRACE("SbObjectModule find for %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
SbxVariable* pVar = NULL;
if ( pDocObject)
pVar = pDocObject->Find( rName, t );
@@ -2116,22 +2202,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() )
@@ -2148,6 +2246,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()
@@ -2174,6 +2281,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)
@@ -2279,13 +2396,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)
}
};
@@ -2301,9 +2430,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();
}
@@ -2333,7 +2462,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 )
@@ -2346,7 +2475,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 );
}
@@ -2415,10 +2544,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;
}
@@ -2489,11 +2618,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 )
@@ -2505,8 +2635,15 @@ void SbUserFormModule::InitObject()
aArgs[ 0 ] <<= m_xModel;
rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
- if ( this->GetParent()->GetName().Len() )
- sProjectName = this->GetParent()->GetName();
+
+ try
+ {
+ Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
+ sProjectName = xVBAMode->getProjectName();
+ }
+ catch( Exception& /*e*/) {}
+
sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
@@ -2519,11 +2656,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();
}
@@ -2541,18 +2694,16 @@ SbUserFormModule::Find( const XubString& rName, SbxClassType t )
InitObject();
return SbObjModule::Find( rName, t );
}
-/////////////////////////////////////////////////////////////////////////
SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p )
: SbxProperty( r, t ), pMod( p )
{
- bInvalid = FALSE;
+ bInvalid = sal_False;
}
SbProperty::~SbProperty()
{}
-/////////////////////////////////////////////////////////////////////////
SbProcedureProperty::~SbProcedureProperty()
{}
diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx
index 8150466b4c..3539cd2b04 100644
--- a/basic/source/comp/buffer.cxx
+++ b/basic/source/comp/buffer.cxx
@@ -33,11 +33,11 @@
#include "buffer.hxx"
#include <string.h>
-const static UINT32 UP_LIMIT=0xFFFFFF00L;
+const static sal_uInt32 UP_LIMIT=0xFFFFFF00L;
-// Der SbiBuffer wird in Inkrements von mindestens 16 Bytes erweitert.
-// Dies ist notwendig, da viele Klassen von einer Pufferlaenge
-// von x*16 Bytes ausgehen.
+// The SbiBuffer will be expanded in increments of at least 16 Bytes.
+// This is necessary, because many classes emanate from a buffer length
+// of x*16 Bytes.
SbiBuffer::SbiBuffer( SbiParser* p, short n )
{
@@ -56,8 +56,8 @@ SbiBuffer::~SbiBuffer()
delete[] pBuf;
}
-// Rausreichen des Puffers
-// Dies fuehrt zur Loeschung des Puffers!
+// Reach out the buffer
+// This lead to the deletion of the buffer!
char* SbiBuffer::GetBuffer()
{
@@ -67,27 +67,27 @@ char* SbiBuffer::GetBuffer()
return p;
}
-// Test, ob der Puffer n Bytes aufnehmen kann.
-// Im Zweifelsfall wird er vergroessert
+// 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;
}
-// Angleich des Puffers auf die uebergebene Byte-Grenze
+// 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;
@@ -120,15 +120,15 @@ void SbiBuffer::Align( INT32 n )
}
}
-// Patch einer Location
+// 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 );
@@ -136,22 +136,22 @@ void SbiBuffer::Patch( UINT32 off, UINT32 val )
}
}
-// Forward References auf Labels und Prozeduren
-// bauen eine Kette auf. Der Anfang der Kette ist beim uebergebenen
-// Parameter, das Ende der Kette ist 0.
+// Forward References upon label und procedures
+// 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 c12962f796..edbbcc44bc 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -33,100 +33,101 @@
#include "sbcomp.hxx"
#include "image.hxx"
#include <limits>
+#include <algorithm>
#include <com/sun/star/script/ModuleType.hpp>
-// nInc ist die Inkrementgroesse der Puffer
+// nInc is the increment size of the buffers
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();
}
-// Statement merken
+// memorize the statement
void SbiCodeGen::Statement()
{
- bStmnt = TRUE;
+ bStmnt = sal_True;
nLine = pParser->GetLine();
nCol = pParser->GetCol1();
- // #29955 Information der for-Schleifen-Ebene
- // in oberen Byte der Spalte speichern
+ // #29955 Store the information of the for-loop-layer
+ // in the uppper Byte of the column
nCol = (nCol & 0xff) + 0x100 * nForLevel;
}
-// Anfang eines Statements markieren
+// Mark the beginning of a statement
void SbiCodeGen::GenStmnt()
{
if( bStmnt )
{
- bStmnt = FALSE;
+ bStmnt = sal_False;
Gen( _STMNT, nLine, nCol );
}
}
-// Die Gen-Routinen returnen den Offset des 1. Operanden,
-// damit Jumps dort ihr Backchain versenken koennen
+// 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;
}
-// Abspeichern des erzeugten Images im Modul
+// Storing of the created image in the module
void SbiCodeGen::Save()
{
SbiImage* p = new SbiImage;
rMod.StartDefinitions();
- // OPTION BASE-Wert:
+ // OPTION BASE-Value:
p->nDimBase = pParser->nBase;
- // OPTION EXPLICIT-Flag uebernehmen
+ // OPTION take over the EXPLICIT-Flag
if( pParser->bExplicit )
p->SetFlag( SBIMG_EXPLICIT );
@@ -177,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 =
@@ -205,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;
@@ -236,27 +237,24 @@ void SbiCodeGen::Save()
ePropType = SbxOBJECT;
break;
case PROPERTY_MODE_NONE:
- DBG_ERROR( "Illegal PropertyMode PROPERTY_MODE_NONE" );
+ OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
break;
}
String aPropName = pProc->GetPropName();
if( nPass == 1 )
aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
- SbProcedureProperty* pProcedureProperty = NULL;
- OSL_TRACE("*** getProcedureProperty for thing %s",
+ OSL_TRACE("*** getProcedureProperty for thing %s",
rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
- pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
+ rMod.GetProcedureProperty( aPropName, ePropType );
}
if( nPass == 1 )
{
- SbIfaceMapperMethod* pMapperMeth = NULL;
- pMapperMeth = rMod.GetIfaceMapperMethod( aProcName, pMeth );
+ rMod.GetIfaceMapperMethod( aProcName, pMeth );
}
else
{
pMeth = rMod.GetMethod( aProcName, pProc->GetType() );
- // #110004
if( !pProc->IsPublic() )
pMeth->SetFlag( SBX_PRIVATE );
@@ -267,23 +265,23 @@ void SbiCodeGen::Save()
pMeth->nStart = pProc->GetAddr();
pMeth->nLine1 = pProc->GetLine1();
pMeth->nLine2 = pProc->GetLine2();
- // Die Parameter:
+ // The parameter:
SbxInfo* pInfo = pMeth->GetInfo();
String aHelpFile, aComment;
- ULONG nHelpId = 0;
+ sal_uIntPtr nHelpId = 0;
if( pInfo )
{
- // Die Zusatzdaten retten
+ // Rescue the additional data
aHelpFile = pInfo->GetHelpFile();
aComment = pInfo->GetComment();
nHelpId = pInfo->GetHelpId();
}
- // Und die Parameterliste neu aufbauen
+ // And reestablish the parameter list
pInfo = new SbxInfo( aHelpFile, nHelpId );
pInfo->SetComment( aComment );
SbiSymPool* pPool = &pProc->GetParams();
- // Das erste Element ist immer der Funktionswert!
- for( USHORT i = 1; i < pPool->GetSize(); i++ )
+ // The first element is always the value of the function!
+ for( sal_uInt16 i = 1; i < pPool->GetSize(); i++ )
{
SbiSymDef* pPar = pPool->Get( i );
SbxDataType t = pPar->GetType();
@@ -291,15 +289,15 @@ void SbiCodeGen::Save()
t = (SbxDataType) ( t | SbxBYREF );
if( pPar->GetDims() )
t = (SbxDataType) ( t | SbxARRAY );
- // #33677 Optional-Info durchreichen
- USHORT nFlags = SBX_READ;
+ // #33677 hand-over an Optional-Info
+ 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() )
@@ -316,19 +314,19 @@ void SbiCodeGen::Save()
} // for( iPass...
}
}
- // Der Code
+ // The code
p->AddCode( aCode.GetBuffer(), aCode.GetSize() );
- // Der globale StringPool. 0 ist nicht belegt.
+ // 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 ) );
- // Typen einfuegen
- USHORT nCount = pParser->rTypeArray->Count();
+ // Insert types
+ sal_uInt16 nCount = pParser->rTypeArray->Count();
for (i = 0; i < nCount; i++)
p->AddType((SbxObject *)pParser->rTypeArray->Get(i));
@@ -351,7 +349,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;
@@ -367,8 +365,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;
@@ -377,15 +375,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; )
@@ -427,7 +425,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; }
@@ -437,10 +435,7 @@ public:
T result = 0 ;
static const S max = std::numeric_limits< S >::max();
result = m_nNumOp0 + ( ( sizeof(S) + 1 ) * m_nNumSingleParams ) + ( (( sizeof(S) * 2 )+ 1 ) * m_nNumDoubleParams );
- if ( result > max )
- return max;
-
- return static_cast<S>(result);
+ return std::min(static_cast<T>(max), result);
}
virtual bool processParams(){ return false; }
};
@@ -451,18 +446,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:
@@ -487,7 +482,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) );
@@ -504,7 +499,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;
@@ -513,16 +508,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>
@@ -532,11 +527,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 2c972ad6ff..8fae1a4654 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -35,12 +35,12 @@
SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
-// Deklaration einer Variablen
-// Bei Fehlern wird bis zum Komma oder Newline geparst.
-// Returnwert: eine neue Instanz, die eingefuegt und dann geloescht wird.
-// Array-Indexe werden als SbiDimList zurueckgegeben
+// Declaration of a variable
+// If there are errors it will be parsed up to the comma or the newline.
+// 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 )
@@ -52,7 +52,7 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
SbxDataType t = eScanType;
SbiSymDef* pDef = bConst ? new SbiConstDef( aSym ) : new SbiSymDef( aSym );
SbiDimList* pDim = NULL;
- // Klammern?
+ // Brackets?
if( Peek() == LPAREN )
pDim = new SbiDimList( this );
pDef->SetType( t );
@@ -72,15 +72,15 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
return pDef;
}
-// Aufloesen einer AS-Typdeklaration
-// Der Datentyp wird in die uebergebene Variable eingetragen
+// 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();
- short nSize = 0;
if( bAsNewAlreadyParsed || Peek() == AS )
{
+ short nSize = 0;
if( !bAsNewAlreadyParsed )
Next();
rDef.SetDefinedAs();
@@ -127,14 +127,14 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
}
}
break;
- case SYMBOL: // kann nur ein TYPE oder eine Objektklasse sein!
+ case SYMBOL: // can only be a TYPE or a object class!
if( eScanType != SbxVARIANT )
Error( SbERR_SYNTAX );
else
{
String aCompleteName = aSym;
- // #52709 DIM AS NEW fuer Uno mit voll-qualifizierten Namen
+ // #52709 DIM AS NEW for Uno with full-qualified name
if( Peek() == DOT )
{
String aDotStr( '.' );
@@ -162,7 +162,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
break;
}
- // In den String-Pool uebernehmen
+ // Take over in the String pool
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
if( rDef.IsNew() && pProc == NULL )
@@ -178,7 +178,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
Error( SbERR_UNEXPECTED, eTok );
Next();
}
- // Die Variable koennte mit Suffix deklariert sein
+ // The variable could have been declared with a suffix
if( rDef.GetType() != SbxVARIANT )
{
if( rDef.GetType() != eType )
@@ -191,39 +191,39 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
}
}
-// Hier werden Variable, Arrays und Strukturen definiert.
+// Here variables, arrays and structures were definied.
// DIM/PRIVATE/PUBLIC/GLOBAL
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; // im richtigen Moment auf globalen Pool schalten
+ 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;
- // PRIVATE ist Synonym fuer DIM
+ 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 )
@@ -275,13 +275,13 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
#define tmpSHARED
#undef SHARED
#endif
- // SHARED wird ignoriert
+ // SHARED were ignored
if( Peek() == SHARED ) Next();
#ifdef tmpSHARED
#define SHARED
#undef tmpSHARED
#endif
- // PRESERVE nur bei REDIM
+ // PRESERVE only at REDIM
if( Peek() == PRESERVE )
{
Next();
@@ -293,29 +293,29 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
SbiSymDef* pDef;
SbiDimList* pDim;
- // AB 9.7.97, #40689, Statics -> Modul-Initialisierung, in Sub ueberspringen
- UINT32 nEndOfStaticLbl = 0;
+ // #40689, Statics -> Modul-Initialising, skip in Sub
+ sal_uInt32 nEndOfStaticLbl = 0;
if( !bVBASupportOn && bStatic )
{
nEndOfStaticLbl = aGen.Gen( _JUMP, 0 );
- aGen.Statement(); // bei static hier nachholen
+ aGen.Statement(); // catch up on static here
}
- BOOL bDefined = FALSE;
+ sal_Bool bDefined = sal_False;
while( ( pDef = VarDecl( &pDim, bStatic, bConst ) ) != NULL )
{
EnableErrors();
- // Variable suchen:
+ // search variable:
if( bSwitchPool )
pPool = &aGlobals;
SbiSymDef* pOld = pPool->Find( pDef->GetName() );
- // AB 31.3.1996, #25651#, auch in Runtime-Library suchen
- BOOL bRtlSym = FALSE;
+ // search also in the Runtime-Library
+ 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,11 +324,11 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
}
if( pOld )
{
- bDefined = TRUE;
- // Bei RTL-Symbol immer Fehler
+ bDefined = sal_True;
+ // always an error at a RTL-S
if( !bRtlSym && (eOp == _REDIM || eOp == _REDIMP) )
{
- // Bei REDIM die Attribute vergleichen
+ // compare the attributes at a REDIM
SbxDataType eDefType;
bool bError_ = false;
if( pOld->IsStatic() )
@@ -350,19 +350,19 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
else
pPool->Add( pDef );
- // #36374: Variable vor Unterscheidung IsNew() anlegen
- // Sonst Error bei Dim Identifier As New Type und option explicit
+ // #36374: Create the variable in front of the distinction IsNew()
+ // Otherwise error at Dim Identifier As New Type and option explicit
if( !bDefined && !(eOp == _REDIM || eOp == _REDIMP)
&& ( !bConst || pDef->GetScope() == SbGLOBAL ) )
{
- // Variable oder globale Konstante deklarieren
+ // Declare variable or global constant
SbiOpcode eOp2;
switch ( pDef->GetScope() )
{
case SbGLOBAL: eOp2 = bPersistantGlobal ? _GLOBAL_P : _GLOBAL;
goto global;
case SbPUBLIC: eOp2 = bPersistantGlobal ? _PUBLIC_P : _PUBLIC;
- // AB 9.7.97, #40689, kein eigener Opcode mehr
+ // #40689, no own Opcode anymore
if( bVBASupportOn && bStatic )
{
eOp2 = _STATIC;
@@ -370,23 +370,26 @@ 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 );
}
- // Initialisierung fuer selbstdefinierte Datentypen
- // und per NEW angelegte Variable
+ // Initialising for self-defined daty types
+ // and per NEW created variable
if( pDef->GetType() == SbxOBJECT
&& pDef->GetTypeId() )
{
@@ -439,7 +442,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
{
if( bConst )
{
- // Konstanten-Definition
+ // Definition of the constants
if( pDim )
{
Error( SbERR_SYNTAX );
@@ -447,13 +450,13 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
}
SbiExpression aVar( this, *pDef );
if( !TestToken( EQ ) )
- goto MyBreak; // AB 24.6.1996 (s.u.)
+ goto MyBreak; // (see below)
SbiConstExpression aExpr( this );
if( !bDefined && aExpr.IsValid() )
{
if( pDef->GetScope() == SbGLOBAL )
{
- // Nur Code fuer globale Konstante erzeugen!
+ // Create code only for the global constant!
aVar.Gen();
aExpr.Gen();
aGen.Gen( _PUTC );
@@ -467,8 +470,8 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
}
else if( pDim )
{
- // Die Variable dimensionieren
- // Bei REDIM die Var vorher loeschen
+ // Dimension the variable
+ // Delete the var at REDIM beforehand
if( eOp == _REDIM )
{
SbiExpression aExpr( this, *pDef, NULL );
@@ -490,48 +493,46 @@ 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 );
}
}
if( !TestComma() )
- goto MyBreak; // AB 24.6.1996 (s.u.)
-
- // #27963# AB, 24.6.1996
- // Einfuehrung bSwitchPool (s.o.): pPool darf beim VarDecl-Aufruf
- // noch nicht auf &aGlobals gesetzt sein.
- // Ansonsten soll das Verhalten aber absolut identisch bleiben,
- // d.h. pPool muss immer am Schleifen-Ende zurueckgesetzt werden.
- // auch bei break
+ goto MyBreak;
+
+ // Implementation of bSwitchPool (see above): pPool must not be set to &aGlobals
+ // at the VarDecl-Call.
+ // Apart from that the behavior should be absolutely identical,
+ // i.e., pPool had to be reset always at the end of the loop.
+ // also at a break
pPool = pOldPool;
- continue; // MyBreak überspingen
+ continue; // Skip MyBreak
MyBreak:
pPool = pOldPool;
break;
}
- // AB 9.7.97, #40689, Sprung ueber Statics-Deklaration abschliessen
+ // #40689, finalize the jump over statics declarations
if( !bVBASupportOn && bStatic )
{
- // globalen Chain pflegen
+ // maintain the global chain
nGblChain = aGen.Gen( _JUMP, 0 );
- bGblDefs = bNewGblDefs = TRUE;
+ bGblDefs = bNewGblDefs = sal_True;
- // fuer Sub Sprung auf Ende der statics eintragen
+ // Register for Sub a jump to the end of statics
aGen.BackChain( nEndOfStaticLbl );
}
- //pPool = pOldPool;
}
-// Hier werden Arrays redimensioniert.
+// Here were Arrays redimensioned.
void SbiParser::ReDim()
{
- DefVar( _REDIM, ( pProc && bVBASupportOn ) ? pProc->IsStatic() : FALSE );
+ DefVar( _REDIM, ( pProc && bVBASupportOn ) ? pProc->IsStatic() : sal_False );
}
// ERASE array, ...
@@ -547,19 +548,19 @@ void SbiParser::Erase()
}
}
-// Deklaration eines Datentyps
+// Declaration of a data type
void SbiParser::Type()
{
- DefType( FALSE );
+ DefType( sal_False );
}
-void SbiParser::DefType( BOOL bPrivate )
+void SbiParser::DefType( sal_Bool bPrivate )
{
// TODO: Use bPrivate
(void)bPrivate;
- // Neues Token lesen, es muss ein Symbol sein
+ // Read the new Token lesen. It had to be a symbol
if (!TestSymbol())
return;
@@ -573,7 +574,7 @@ void SbiParser::DefType( BOOL bPrivate )
SbiSymDef* pElem;
SbiDimList* pDim = NULL;
- BOOL bDone = FALSE;
+ sal_Bool bDone = sal_False;
while( !bDone && !IsEof() )
{
@@ -581,7 +582,7 @@ void SbiParser::DefType( BOOL bPrivate )
{
case ENDTYPE :
pElem = NULL;
- bDone = TRUE;
+ bDone = sal_True;
Next();
break;
@@ -593,9 +594,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 occured
+ bDone = sal_True; // Error occurred
}
if( pElem )
{
@@ -616,8 +617,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 +637,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 +647,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,12 +677,12 @@ void SbiParser::DefType( BOOL bPrivate )
void SbiParser::Enum()
{
- DefEnum( FALSE );
+ DefEnum( sal_False );
}
-void SbiParser::DefEnum( BOOL bPrivate )
+void SbiParser::DefEnum( sal_Bool bPrivate )
{
- // Neues Token lesen, es muss ein Symbol sein
+ // Read a the new Token. It had to be a symbol
if (!TestSymbol())
return;
@@ -698,7 +699,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 +709,7 @@ void SbiParser::DefEnum( BOOL bPrivate )
{
case ENDENUM :
pElem = NULL;
- bDone = TRUE;
+ bDone = sal_True;
Next();
break;
@@ -721,20 +722,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 occured
+ bDone = sal_True; // Error occurred
break;
}
else if( pDim )
{
delete pDim;
Error( SbERR_SYNTAX );
- bDone = TRUE; // Error occured
+ bDone = sal_True; // Error occurred
break;
}
@@ -764,7 +765,7 @@ void SbiParser::DefEnum( BOOL bPrivate )
if( pOld )
{
Error( SbERR_VAR_DEFINED, pElem->GetName() );
- bDone = TRUE; // Error occured
+ bDone = sal_True; // Error occurred
break;
}
@@ -775,13 +776,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 );
}
@@ -808,14 +809,14 @@ void SbiParser::DefEnum( BOOL bPrivate )
}
-// Prozedur-Deklaration
-// das erste Token ist bereits eingelesen (SUB/FUNCTION)
+// Procedure-Declaration
+// 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;
@@ -843,28 +844,28 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
}
if( !bDecl )
{
- // CDECL, LIB und ALIAS sind unzulaessig
+ // CDECL, LIB and ALIAS are invalid
if( pDef->GetLib().Len() )
Error( SbERR_UNEXPECTED, LIB );
if( pDef->GetAlias().Len() )
Error( SbERR_UNEXPECTED, ALIAS );
if( pDef->IsCdecl() )
Error( SbERR_UNEXPECTED, _CDECL_ );
- pDef->SetCdecl( FALSE );
+ pDef->SetCdecl( sal_False );
pDef->GetLib().Erase();
pDef->GetAlias().Erase();
}
else if( !pDef->GetLib().Len() )
{
- // ALIAS und CDECL nur zusammen mit LIB
+ // ALIAS and CDECL only together with LIB
if( pDef->GetAlias().Len() )
Error( SbERR_UNEXPECTED, ALIAS );
if( pDef->IsCdecl() )
Error( SbERR_UNEXPECTED, _CDECL_ );
- pDef->SetCdecl( FALSE );
+ pDef->SetCdecl( sal_False );
pDef->GetAlias().Erase();
}
- // Klammern?
+ // Brackets?
if( Peek() == LPAREN )
{
Next();
@@ -872,23 +873,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 +902,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 +919,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
eTok = Next();
if( eTok == COMMA || eTok == RPAREN )
- bError2 = FALSE;
+ bError2 = sal_False;
}
if( bError2 )
{
@@ -933,9 +934,6 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
TypeDecl( *pDef );
if( eType != SbxVARIANT && pDef->GetType() != eType )
Error( SbERR_BAD_DECLARATION, aName );
-// if( pDef->GetType() == SbxOBJECT )
-// pDef->SetType( SbxVARIANT ),
-// Error( SbERR_SYNTAX );
if( pDef->GetType() == SbxVARIANT && !( bFunc || bProp ) )
pDef->SetType( SbxEMPTY );
return pDef;
@@ -945,10 +943,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,19 +955,19 @@ void SbiParser::DefDeclare( BOOL bPrivate )
{
bool bFunction = (eCurTok == FUNCTION);
- SbiProcDef* pDef = ProcDecl( TRUE );
+ SbiProcDef* pDef = ProcDecl( sal_True );
if( pDef )
{
if( !pDef->GetLib().Len() )
Error( SbERR_EXPECTED, LIB );
- // gibts den schon?
+ // Is it already there?
SbiSymDef* pOld = aPublics.Find( pDef->GetName() );
if( pOld )
{
SbiProcDef* p = pOld->GetProcDef();
if( !p )
{
- // Als Variable deklariert
+ // Declared as a variable
Error( SbERR_BAD_DECLARATION, pDef->GetName() );
delete pDef;
pDef = NULL;
@@ -990,39 +988,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 +1030,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 );
@@ -1066,7 +1064,7 @@ void SbiParser::Attribute()
// Don't generate any code - just discard it.
}
-// Aufruf einer SUB oder FUNCTION
+// Call of a SUB or a FUNCTION
void SbiParser::Call()
{
@@ -1079,18 +1077,18 @@ void SbiParser::Call()
void SbiParser::SubFunc()
{
- DefProc( FALSE, FALSE );
+ DefProc( sal_False, sal_False );
}
-// Einlesen einer Prozedur
+// 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,12 +1104,12 @@ 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 );
- // Ist die Proc bereits deklariert?
+ // Is the Proc already declared?
SbiSymDef* pOld = aPublics.Find( pDef->GetName() );
if( pOld )
{
@@ -1120,7 +1118,7 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate )
pProc = pOld->GetProcDef();
if( !pProc )
{
- // Als Variable deklariert
+ // Declared as a variable
Error( SbERR_BAD_DECLARATION, pDef->GetName() );
delete pDef;
pProc = NULL;
@@ -1153,22 +1151,22 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate )
return;
pProc->SetPublic( !bPrivate );
- // Nun setzen wir die Suchhierarchie fuer Symbole sowie die aktuelle
- // Prozedur.
+ // Now we set the search hierarchy for symbols as well as the
+ // current procedure.
aPublics.SetProcId( pProc->GetId() );
pProc->GetParams().SetParent( &aPublics );
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 );
}
- // Normalfall: Lokale Variable->Parameter->Globale Variable
+ // Normal case: Local variable->parameter->global variable
pProc->GetLocals().SetParent( &pProc->GetParams() );
pPool = &pProc->GetLocals();
@@ -1180,7 +1178,7 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate )
pProc->SetLine2( l2 );
pPool = &aPublics;
aPublics.SetProcId( 0 );
- // Offene Labels?
+ // Open labels?
pProc->GetLabels().CheckRefs();
CloseBlock();
aGen.Gen( _LEAVE );
@@ -1191,10 +1189,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,18 +1204,18 @@ 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 )
Error( SbERR_NOT_IN_SUBR );
- // Pool umsetzen, damit STATIC-Deklarationen im globalen
- // Pool landen
+ // 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 664655e22b..99855d6c94 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -32,7 +32,7 @@
#include "sbcomp.hxx"
#include "expr.hxx"
-// Umsetztabelle fuer Token-Operatoren und Opcodes
+// Transform table for token operators and opcodes
typedef struct {
SbiToken eTok; // Token
@@ -65,7 +65,7 @@ static OpTable aOpTable [] = {
{ IS, _IS },
{ NIL, _NOP }};
-// Ausgabe eines Elements
+// Output of an element
void SbiExprNode::Gen( RecursiveMode eRecMode )
{
if( IsConstant() )
@@ -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 );
}
}
@@ -109,10 +109,10 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
eOp = aVar.pDef->IsGlobal() ? _FIND_G : _FIND;
}
}
- // AB: 17.12.1995, Spezialbehandlung fuer WITH
+ // special treatment for WITH
else if( (pWithParent_ = GetWithParent()) != NULL )
{
- eOp = _ELEM; // .-Ausdruck in WITH
+ eOp = _ELEM; // .-Term in in WITH
}
else
{
@@ -163,7 +163,7 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
}
}
-// Ausgabe eines Operanden-Elements
+// Output of an operand element
void SbiExprNode::GenElement( SbiOpcode eOp )
{
@@ -172,18 +172,18 @@ void SbiExprNode::GenElement( SbiOpcode eOp )
pGen->GetParser()->Error( SbERR_INTERNAL_ERROR, "Opcode" );
#endif
SbiSymDef* pDef = aVar.pDef;
- // Das ID ist entweder die Position oder das String-ID
- // Falls das Bit 0x8000 gesetzt ist, hat die Variable
- // eine Parameterliste.
- USHORT nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId();
- // Parameterliste aufbauen
+ // The ID is either the position or the String-ID
+ // If the bit Bit 0x8000 is set, the variable have
+ // a parameter list.
+ sal_uInt16 nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId();
+ // Build a parameter list
if( aVar.pPar && aVar.pPar->GetSize() )
{
nId |= 0x8000;
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 )
{
@@ -198,36 +198,36 @@ void SbiExprNode::GenElement( SbiOpcode eOp )
}
}
-// Erzeugen einer Argv-Tabelle
-// Das erste Element bleibt immer frei fuer Returnwerte etc.
-// Siehe auch SbiProcDef::SbiProcDef() in symtbl.cxx
+// Create an Argv-Table
+// The first element remain available for return value etc.
+// See as well SbiProcDef::SbiProcDef() in symtbl.cxx
void SbiExprList::Gen()
{
if( pFirst )
{
pParser->aGen.Gen( _ARGC );
- // AB 10.1.96: Typ-Anpassung bei DECLARE
- USHORT nCount = 1 /*, nParAnz = 0*/;
-// SbiSymPool* pPool = NULL;
+ // Type adjustment at DECLARE
+ sal_uInt16 nCount = 1;
+
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
{
pExpr->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
- // AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
+ // From 1996-01-10: Type adjustment at named -> search suitable parameter
if( pProc )
{
- // Vorerst: Error ausloesen
+ // For the present: trigger an error
pParser->Error( SbERR_NO_NAMED_ARGS );
- // Spaeter, wenn Named Args bei DECLARE moeglich
- //for( USHORT i = 1 ; i < nParAnz ; i++ )
+ // Later, if Named Args at DECLARE is posible
+ //for( sal_uInt16 i = 1 ; i < nParAnz ; i++ )
//{
// SbiSymDef* pDef = pPool->Get( i );
// const String& rName = pDef->GetName();
@@ -254,14 +254,14 @@ void SbiExprList::Gen()
void SbiExpression::Gen( RecursiveMode eRecMode )
{
- // AB: 17.12.1995, Spezialbehandlung fuer WITH
- // Wenn pExpr == .-Ausdruck in With, zunaechst Gen fuer Basis-Objekt
+ // special treatment for WITH
+ // If pExpr == .-term in With, approximately Gen for Basis-Object
pExpr->Gen( eRecMode );
if( bByVal )
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 ec8ad8ae7f..61bc6faaa2 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -35,7 +35,6 @@
#include "sbcomp.hxx"
#include "expr.hxx"
-//////////////////////////////////////////////////////////////////////////
SbiExprNode::SbiExprNode( void )
{
@@ -52,9 +51,9 @@ SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, SbiToken t, SbiExprNode*
pRight = r;
eTok = t;
nVal = 0;
- eType = SbxVARIANT; // Nodes sind immer Variant
+ eType = SbxVARIANT; // Nodes are always Variant
eNodeType = SbxNODE;
- bComposite= TRUE;
+ bComposite= sal_True;
}
SbiExprNode::SbiExprNode( SbiParser* p, double n, SbxDataType t )
@@ -86,12 +85,12 @@ SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiEx
aVar.pvMorePar = NULL;
aVar.pNext= NULL;
- // Funktionsergebnisse sind nie starr
- bComposite= BOOL( aVar.pDef->GetProcDef() != NULL );
+ // Results of functions are at no time fixed
+ 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 +101,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 );
@@ -111,7 +110,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, USHORT nId )
nTypeStrId = nId;
}
-// AB: 17.12.95, Hilfsfunktion fuer Ctor fuer einheitliche Initialisierung
+// From 1995-12-17, auxiliary function for Ctor for the uniform initialisation
void SbiExprNode::BaseInit( SbiParser* p )
{
pGen = &p->aGen;
@@ -119,8 +118,8 @@ void SbiExprNode::BaseInit( SbiParser* p )
pLeft = NULL;
pRight = NULL;
pWithParent = NULL;
- bComposite = FALSE;
- bError = FALSE;
+ bComposite = sal_False;
+ bError = sal_False;
}
SbiExprNode::~SbiExprNode()
@@ -159,7 +158,7 @@ SbiSymDef* SbiExprNode::GetRealVar()
return NULL;
}
-// AB: 18.12.95
+// From 1995-12-18
SbiExprNode* SbiExprNode::GetRealNode()
{
if( eNodeType == SbxVARVAL )
@@ -173,9 +172,9 @@ SbiExprNode* SbiExprNode::GetRealNode()
return NULL;
}
-// Diese Methode setzt den Typ um, falls er in den Integer-Bereich hineinpasst
+// This method transform the type, if it fits into the Integer range
-BOOL SbiExprNode::IsIntConst()
+sal_Bool SbiExprNode::IsIntConst()
{
if( eNodeType == SbxNUMVAL )
{
@@ -186,34 +185,34 @@ 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();
}
-// Ermitteln der Tiefe eines Baumes
+// Identify of the depth of a tree
short SbiExprNode::GetDepth()
{
@@ -227,11 +226,11 @@ short SbiExprNode::GetDepth()
}
-// Abgleich eines Baumes:
+// Adjustment of a tree:
// 1. Constant Folding
-// 2. Typabgleich
-// 3. Umwandlung der Operanden in Strings
-// 4. Hochziehen der Composite- und Error-Bits
+// 2. Type-Adjustment
+// 3. Conversion of the operans into Strings
+// 4. Lifting of the composite- and error-bits
void SbiExprNode::Optimize()
{
@@ -239,7 +238,7 @@ void SbiExprNode::Optimize()
CollectBits();
}
-// Hochziehen der Composite- und Fehlerbits
+// Lifting of the composite- and error-bits
void SbiExprNode::CollectBits()
{
@@ -257,8 +256,8 @@ void SbiExprNode::CollectBits()
}
}
-// Kann ein Zweig umgeformt werden, wird TRUE zurueckgeliefert. In diesem
-// Fall ist das Ergebnis im linken Zweig.
+// If a twig can be converted, True will be returned. In this case
+// the result is in the left twig.
void SbiExprNode::FoldConstants()
{
@@ -273,10 +272,10 @@ void SbiExprNode::FoldConstants()
{
CollectBits();
if( eTok == CAT )
- // CAT verbindet auch zwei Zahlen miteinander!
+ // CAT affiliate also two numbers!
eType = SbxSTRING;
if( pLeft->eType == SbxSTRING )
- // Kein Type Mismatch!
+ // No Type Mismatch!
eType = SbxSTRING;
if( eType == SbxSTRING )
{
@@ -284,11 +283,11 @@ 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;
- // Verkettung:
+ // Linking:
aStrVal = rl;
aStrVal += rr;
eType = SbxSTRING;
@@ -321,7 +320,7 @@ void SbiExprNode::FoldConstants()
break;
default:
pGen->GetParser()->Error( SbERR_CONVERSION );
- bError = TRUE;
+ bError = sal_True;
}
}
}
@@ -334,51 +333,51 @@ void SbiExprNode::FoldConstants()
if( ( eTok >= AND && eTok <= IMP )
|| eTok == IDIV || eTok == MOD )
{
- // Integer-Operationen
- BOOL err = FALSE;
- if( nl > SbxMAXLNG ) err = TRUE, nl = SbxMAXLNG;
+ // Integer operations
+ 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 +401,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:
@@ -428,12 +427,11 @@ void SbiExprNode::FoldConstants()
if( !::rtl::math::isFinite( nVal ) )
pGen->GetParser()->Error( SbERR_MATH_OVERFLOW );
- // Den Datentyp wiederherstellen, um Rundungsfehler
- // zu killen
+ // Recover the data type to kill rounding error
if( bCheckType && bBothInt
&& nVal >= SbxMINLNG && nVal <= SbxMAXLNG )
{
- // NK-Stellen weg
+ // Decimal place away
long n = (long) nVal;
nVal = n;
eType = ( n >= SbxMININT && n <= SbxMAXINT )
@@ -449,21 +447,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;
+ // Integer operation!
+ 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;
@@ -473,7 +471,7 @@ void SbiExprNode::FoldConstants()
}
if( eNodeType == SbxNUMVAL )
{
- // Evtl auf INTEGER falten (wg. besserem Opcode)?
+ // Potentially convolve in INTEGER (because of better opcode)?
if( eType == SbxSINGLE || eType == SbxDOUBLE )
{
double x;
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 1c835fbf70..61918088d6 100644
--- 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,16 +404,10 @@ 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;
- }
- */
+
if( bError )
return NULL;
@@ -442,7 +436,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 +445,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
{
// Name%. geht wirklich nicht!
pParser->Error( SbERR_BAD_DECLARATION, aSym );
- bError = TRUE;
+ bError = sal_True;
}
}
@@ -473,7 +467,6 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
// Falls wir etwas mit Punkt einscannen, muss der
// Typ SbxOBJECT sein
- // AB, 3.1.96
// Es kann sein, dass pDef ein Objekt beschreibt, das bisher
// nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern
if( pDef->GetType() == SbxVARIANT )
@@ -482,7 +475,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 +552,7 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
}
}
nParenLevel--;
- pRes->bComposite = TRUE;
+ pRes->bComposite = sal_True;
break;
default:
// Zur Zeit sind Keywords hier OK!
@@ -583,13 +576,19 @@ SbiExprNode* SbiExpression::Unary()
{
case MINUS:
eTok = NEG;
- case NOT:
pParser->Next();
- // process something like "Do While Not "foo"="" "
+ pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
+ break;
+ case NOT:
if( pParser->IsVBASupportOn() )
- pNd = new SbiExprNode( pParser, Like(), eTok, NULL );
+ {
+ pNd = Operand();
+ }
else
+ {
+ pParser->Next();
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
+ }
break;
case PLUS:
pParser->Next();
@@ -603,7 +602,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;
}
@@ -612,7 +611,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;
}
@@ -734,9 +733,114 @@ SbiExprNode* SbiExpression::Comp()
return pNd;
}
+
+SbiExprNode* SbiExpression::VBA_Not()
+{
+ SbiExprNode* pNd = NULL;
+
+ SbiToken eTok = pParser->Peek();
+ if( eTok == NOT )
+ {
+ pParser->Next();
+ pNd = new SbiExprNode( pParser, VBA_Not(), eTok, NULL );
+ }
+ else
+ {
+ pNd = Comp();
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_And()
+{
+ SbiExprNode* pNd = VBA_Not();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != AND )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Not() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Or()
+{
+ SbiExprNode* pNd = VBA_And();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != OR )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_And() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Xor()
+{
+ SbiExprNode* pNd = VBA_Or();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != XOR )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Or() );
+ }
+ }
+ return pNd;
+
+}
+
+SbiExprNode* SbiExpression::VBA_Eqv()
+{
+ SbiExprNode* pNd = VBA_Xor();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != EQV )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Xor() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Imp()
+{
+ SbiExprNode* pNd = VBA_Eqv();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != IMP )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Eqv() );
+ }
+ }
+ return pNd;
+
+}
+
SbiExprNode* SbiExpression::Like()
{
- SbiExprNode* pNd = Comp();
+ SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp();
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
short nCount = 0;
@@ -748,7 +852,7 @@ SbiExprNode* SbiExpression::Like()
if( nCount > 1 && !pParser->IsVBASupportOn() )
{
pParser->Error( SbERR_SYNTAX );
- bError = TRUE;
+ bError = sal_True;
}
}
return pNd;
@@ -798,28 +902,27 @@ 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;
@@ -871,7 +974,7 @@ SbiExprList::SbiExprList( SbiParser* p )
nExpr =
nDim = 0;
bError =
- bBracket = FALSE;
+ bBracket = sal_False;
}
SbiExprList::~SbiExprList()
@@ -919,8 +1022,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 )
@@ -940,7 +1043,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
}
else
{
- bBracket = TRUE;
+ bBracket = sal_True;
pParser->Next();
eTok = pParser->Peek();
}
@@ -963,8 +1066,6 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
if( eTok == COMMA )
{
pExpr = new SbiExpression( pParser, 0, SbxEMPTY );
- //if( bConst )
- // pParser->Error( SbERR_SYNTAX ), bError = TRUE;
}
// Benannte Argumente: entweder .name= oder name:=
else
@@ -980,25 +1081,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 );
@@ -1011,8 +1112,6 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
if( bByVal && pExpr->IsLvalue() )
pExpr->SetByVal();
- //pExpr = bConst ? new SbiConstExpression( pParser )
- // : new SbiExpression( pParser );
if( !bAssumeArrayMode )
{
if( pParser->Peek() == ASSIGN )
@@ -1023,8 +1122,6 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
delete pExpr;
pParser->Next();
pExpr = new SbiExpression( pParser );
- //if( bConst )
- // pParser->Error( SbERR_SYNTAX ), bError = TRUE;
}
pExpr->GetName() = aName;
}
@@ -1049,7 +1146,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
pParser->Error( bBracket
? SbERR_BAD_BRACKETS
: SbERR_EXPECTED, COMMA );
- bError = TRUE;
+ bError = sal_True;
}
else
{
@@ -1067,7 +1164,7 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
if( !bBracket )
{
pParser->Error( SbERR_BAD_BRACKETS );
- bError = TRUE;
+ bError = sal_True;
}
}
nDim = nExpr;
@@ -1086,12 +1183,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 3c750dac00..0fea281126 100644
--- 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,28 +144,8 @@ void SbiParser::Line()
void SbiParser::LineInput()
{
- Channel( TRUE );
- // BOOL bChan = Channel( TRUE );
+ Channel( sal_True );
SbiExpression* pExpr = new SbiExpression( this, SbOPERAND );
- /* AB 15.1.96: Keinen allgemeinen Ausdruck mehr zulassen
- SbiExpression* pExpr = new SbiExpression( this );
- if( !pExpr->IsVariable() )
- {
- SbiToken eTok = Peek();
- if( eTok == COMMA || eTok == SEMICOLON ) Next();
- else Error( SbERR_EXPECTED, COMMA );
- // mit Prompt
- if( !bChan )
- {
- pExpr->Gen();
- aGen.Gen( _PROMPT );
- }
- else
- Error( SbERR_VAR_EXPECTED );
- delete pExpr;
- pExpr = new SbiExpression( this, SbOPERAND );
- }
- */
if( !pExpr->IsVariable() )
Error( SbERR_VAR_EXPECTED );
if( pExpr->GetType() != SbxVARIANT && pExpr->GetType() != SbxSTRING )
@@ -181,14 +161,8 @@ void SbiParser::LineInput()
void SbiParser::Input()
{
aGen.Gen( _RESTART );
- Channel( TRUE );
- // BOOL bChan = Channel( TRUE );
+ Channel( sal_True );
SbiExpression* pExpr = new SbiExpression( this, SbOPERAND );
- /* ALT: Jetzt keinen allgemeinen Ausdruck mehr zulassen
- SbiExpression* pExpr = new SbiExpression( this );
- ...
- siehe LineInput
- */
while( !bAbort )
{
if( !pExpr->IsVariable() )
@@ -235,7 +209,7 @@ void SbiParser::Open()
{
Next();
eTok = Next();
- // #27964# Nur STREAM_READ,STREAM_WRITE-Flags in nMode beeinflussen
+ // Nur STREAM_READ,STREAM_WRITE-Flags in nMode beeinflussen
nMode &= ~(STREAM_READ | STREAM_WRITE); // loeschen
if( eTok == READ )
{
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index 10284fb580..e8ad5bb5af 100644
--- 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 );
@@ -43,12 +43,12 @@ void SbiParser::If()
TestToken( THEN );
if( IsEoln( Next() ) )
{
- // AB 13.5.1996: #27720# Am Ende jeden Blocks muss ein Jump zu ENDIF
+ // Am Ende jeden Blocks muss ein Jump zu ENDIF
// 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,16 +59,15 @@ 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?
while( eTok == ELSEIF )
{
- // #27720# Bei erfolgreichem IF/ELSEIF auf ENDIF springen
+ // 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 +87,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 );
@@ -105,7 +104,7 @@ void SbiParser::If()
else if( eTok == ENDIF )
Next();
- // #27720# Jmp-Tabelle abarbeiten
+ // Jmp-Tabelle abarbeiten
while( iJmp > 0 )
{
iJmp--;
@@ -115,7 +114,7 @@ void SbiParser::If()
else
{
// single line IF
- bSingleLineIf = TRUE;
+ bSingleLineIf = sal_True;
nEndLbl = aGen.Gen( _JUMPF, 0 );
Push( eCurTok );
while( !bAbort )
@@ -128,7 +127,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 +138,7 @@ void SbiParser::If()
break;
}
}
- bSingleLineIf = FALSE;
+ bSingleLineIf = sal_False;
}
aGen.BackChain( nEndLbl );
}
@@ -157,7 +156,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 +183,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 +197,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 +248,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 +305,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,14 +313,13 @@ void SbiParser::OnGoto()
eTok = GOTO;
}
// Label-Tabelle einlesen:
- UINT32 nLbl = 0;
+ sal_uInt32 nLbl = 0;
do
{
- SbiToken eTok2 = NIL;
- eTok2 = Next(); // Label holen
+ Next(); // Label holen
if( MayBeLabel() )
{
- UINT32 nOff = pProc->GetLabels().Reference( aSym );
+ sal_uInt32 nOff = pProc->GetLabels().Reference( aSym );
aGen.Gen( _JUMP, nOff );
nLbl++;
}
@@ -341,7 +339,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 );
@@ -354,7 +352,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 );
@@ -370,9 +368,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 )
{
@@ -383,13 +381,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 )
{
@@ -408,7 +406,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
@@ -429,7 +427,7 @@ void SbiParser::Select()
}
if( Peek() == COMMA ) Next();
- else TestEoln(), bDone = TRUE;
+ else TestEoln(), bDone = sal_True;
}
// Alle Cases abgearbeitet
if( !bElse )
@@ -474,7 +472,6 @@ void SbiParser::On()
SbiToken eTok = Peek();
String aString = SbiTokenizer::Symbol(eTok);
if (aString.EqualsIgnoreCaseAscii("ERROR"))
- //if (!aString.ICompare("ERROR"))
eTok = _ERROR_; // Error kommt als SYMBOL
if( eTok != _ERROR_ && eTok != LOCAL ) OnGoto();
else
@@ -494,7 +491,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 );
}
}
@@ -526,7 +523,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 5fe64ceae0..5fe64ceae0 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 1e8e7b2cee..a606a1ac64 100644
--- 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,13 +189,12 @@ SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
// Globale Chainkette schliessen
-BOOL SbiParser::HasGlobalCode()
+sal_Bool SbiParser::HasGlobalCode()
{
if( bGblDefs && nGblChain )
{
aGen.BackChain( nGblChain );
aGen.Gen( _LEAVE );
- // aGen.Gen( _STOP );
nGblChain = 0;
}
return bGblDefs;
@@ -254,49 +253,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 +321,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 +346,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 +366,7 @@ BOOL SbiParser::Parse()
// Leerstatement?
if( IsEoln( eCurTok ) )
{
- Next(); return TRUE;
+ Next(); return sal_True;
}
}
@@ -380,13 +379,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 +441,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 +472,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
@@ -515,7 +514,6 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
if( aRtlName.EqualsIgnoreCaseAscii("Mid") )
{
SbiExprNode* pExprNode = aVar.GetExprNode();
- // SbiNodeType eNodeType;
if( pExprNode && pExprNode->GetNodeType() == SbxVARVAL )
{
SbiExprList* pPar = pExprNode->GetParameters();
@@ -549,7 +547,6 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
SbiExpression aExpr( this );
aExpr.Gen();
SbiOpcode eOp = _PUT;
- // SbiSymDef* pDef = aVar.GetRealVar();
if( pDef )
{
if( pDef->GetConstDef() )
@@ -578,7 +575,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,10 +606,9 @@ 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 );
aGen.Gen( _CREATE, pDef->GetId(), pTypeDef->GetTypeId() );
aGen.Gen( _SETCLASS, pDef->GetTypeId() );
}
@@ -641,7 +637,6 @@ void SbiParser::Set()
aGen.Gen( _SET );
}
}
- // aGen.Gen( _SET );
}
// JSM 07.10.95
@@ -695,7 +690,6 @@ void SbiParser::DefXXX()
else
{
ch2 = aSym.ToUpperAscii().GetBuffer()[0];
- //ch2 = aSym.Upper();
if( ch2 < ch1 ) Error( SbERR_SYNTAX ), ch2 = 0;
}
}
@@ -761,7 +755,7 @@ void SbiParser::EnableCompatibility()
{
if( !bCompatible )
AddConstants();
- bCompatible = TRUE;
+ bCompatible = sal_True;
}
// OPTION
@@ -771,7 +765,7 @@ void SbiParser::Option()
switch( Next() )
{
case EXPLICIT:
- bExplicit = TRUE; break;
+ bExplicit = sal_True; break;
case BASE:
if( Next() == NUMBER )
{
@@ -794,9 +788,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 +800,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 638d320da1..729ec8390c 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -32,385 +32,216 @@
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
#include "image.hxx"
-#include "sbtrace.hxx"
-
-
-//==========================================================================
-// Tracing, for debugging only
+#include <basic/sbobjmod.hxx>
// To activate tracing enable in sbtrace.hxx
#ifdef DBG_TRACE_BASIC
-#include <hash_map>
+// Trace Settings, used if no ini file / not found in ini file
+static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt";
+static char* GpTraceFileName = GpTraceFileNameDefault;
-// Trace Settings
-static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt";
-static const bool GbIncludePCodes = false;
-static const int GnIndentPerCallLevel = 4;
-static const int GnIndentForPCode = 2;
+// 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;
-struct TraceTextData
-{
- rtl::OString m_aTraceStr_STMNT;
- rtl::OString m_aTraceStr_PCode;
-};
-typedef std::hash_map< sal_Int32, TraceTextData > PCToTextDataMap;
-typedef std::hash_map< ::rtl::OUString, PCToTextDataMap*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTraceMap;
+// GbIncludePCodes:
+// true = PCodes are written to trace, default = false, correspondents
+// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below
+static bool GbIncludePCodes = false;
-ModuleTraceMap GaModuleTraceMap;
-ModuleTraceMap& rModuleTraceMap = GaModuleTraceMap;
+static int GnIndentPerCallLevel = 4;
+static int GnIndentForPCode = 2;
-static void lcl_PrepareTraceForModule( SbModule* pModule )
-{
- String aModuleName = pModule->GetName();
- ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
- if( it != rModuleTraceMap.end() )
- {
- PCToTextDataMap* pInnerMap = it->second;
- delete pInnerMap;
- rModuleTraceMap.erase( it );
- }
+/*
+ With trace enabled the runtime function TraceCommand
+ can be used to influence the trace functionality
+ from within the running Basic macro.
- String aDisassemblyStr;
- pModule->Disassemble( aDisassemblyStr );
-}
+ Format: TraceCommand( command as String [, param as Variant] )
-static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL )
-{
- const char* pPrintFirst = (pPreStr != NULL) ? pPreStr : "";
- FILE* pFile = fopen( pFileName, "a+" );
- if( pFile != NULL )
- {
- fprintf( pFile, "%s%s\n", pPrintFirst, pStr );
- fclose( pFile );
- }
-}
-
-const char* lcl_getSpaces( int nSpaceCount )
-{
- static sal_Char Spaces[] = " "
- " "
- " ";
- static int nAvailableSpaceCount = strlen( Spaces );
- static sal_Char* pSpacesEnd = Spaces + nAvailableSpaceCount;
+ Supported commands (command is NOT case sensitive):
+ TraceCommand "TraceOn" sets GbTraceOn = true
+ TraceCommand "TraceOff" sets GbTraceOn = false
- if( nSpaceCount > nAvailableSpaceCount )
- nSpaceCount = nAvailableSpaceCount;
+ TraceCommand "PCodeOn" sets GbIncludePCodes = true
+ TraceCommand "PCodeOff" sets GbIncludePCodes = false
- return pSpacesEnd - nSpaceCount;
-}
+ TraceCommand "Print", aVal writes aVal into the trace file as
+ long as it can be converted to string
+*/
-static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
+static void lcl_skipWhites( char*& rpc )
{
- static sal_Char Buffer[1000];
-
- rtl::OString aOStr = OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US );
- const sal_Char* pStr = aOStr.getStr();
-
- // Skip whitespace
- sal_Char c = *pStr;
- while( c == ' ' || c == '\t' )
- {
- pStr++;
- c = *pStr;
- }
-
- int nLen = strlen( pStr );
- strncpy( Buffer, pStr, nLen );
- Buffer[nLen] = 0;
-
- rtl::OString aORetStr( Buffer );
- return aORetStr;
+ while( *rpc == ' ' || *rpc == '\t' )
+ ++rpc;
}
-String dumpMethodParameters( SbMethod* pMethod )
+inline void lcl_findNextLine( char*& rpc, char* pe )
{
- String aStr;
- if( pMethod == NULL )
- return aStr;
-
- SbxError eOld = SbxBase::GetError();
-
- SbxArray* pParams = pMethod->GetParameters();
- SbxInfo* pInfo = pMethod->GetInfo();
- if ( pParams )
- {
- aStr += '(';
- // 0 is sub itself
- for ( USHORT nParam = 1; nParam < pParams->Count(); nParam++ )
- {
- SbxVariable* pVar = pParams->Get( nParam );
- DBG_ASSERT( pVar, "Parameter?!" );
- if ( pVar->GetName().Len() )
- aStr += pVar->GetName();
- else if ( pInfo )
- {
- const SbxParamInfo* pParam = pInfo->GetParam( nParam );
- if ( pParam )
- aStr += pParam->aName;
- }
- aStr += '=';
- if( pVar->GetType() & SbxARRAY )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
- else
- aStr += pVar->GetString();
- if ( nParam < ( pParams->Count() - 1 ) )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
- }
- aStr += ')';
- }
+ // Find line end
+ while( rpc < pe && *rpc != 13 && *rpc != 10 )
+ ++rpc;
- SbxBase::ResetError();
- if( eOld != SbxERR_OK )
- SbxBase::SetError( eOld );
-
- return aStr;
-}
+ // Read all
+ while( rpc < pe && (*rpc == 13 || *rpc == 10) )
+ ++rpc;
+}
-// Public functions
-void dbg_InitTrace( void )
+inline bool lcl_isAlpha( char c )
{
- FILE* pFile = fopen( GpTraceFileName, "w" );
- if( pFile != NULL )
- fclose( pFile );
+ bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ return bRet;
}
-void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
+static void lcl_ReadIniFile( const char* pIniFileName )
{
- SbModule* pTraceMod = pModule;
- if( pTraceMod->ISA(SbClassModuleObject) )
- {
- SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
- pTraceMod = pClassModuleObj->getClassModule();
- }
-
- String aModuleName = pTraceMod->GetName();
- ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
- if( it == rModuleTraceMap.end() )
- {
- const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
- char Buffer[200];
- sprintf( Buffer, "TRACE ERROR: Unknown module \"%s\"", pModuleNameStr );
- lcl_lineOut( GpTraceFileName, Buffer );
+ 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;
- }
- PCToTextDataMap* pInnerMap = it->second;
- if( pInnerMap == NULL )
- {
- lcl_lineOut( GpTraceFileName, "TRACE INTERNAL ERROR: No inner map" );
- return;
- }
+ size_t nRead = fread( Buffer, 1, BUF_SIZE, pFile );
- PCToTextDataMap::iterator itInner = pInnerMap->find( nPC );
- if( itInner == pInnerMap->end() )
+ // Scan
+ char* pc = Buffer;
+ char* pe = Buffer + nRead;
+ while( pc < pe )
{
- const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
- char Buffer[200];
- sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr );
- lcl_lineOut( GpTraceFileName, Buffer );
- return;
- }
-
- //nCallLvl--;
- //if( nCallLvl < 0 )
- // nCallLvl = 0;
- int nIndent = nCallLvl * GnIndentPerCallLevel;
-
- const TraceTextData& rTraceTextData = itInner->second;
- const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
- if( rStr_STMNT.getLength() )
- lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ) );
-
- if( !GbIncludePCodes )
- return;
+ 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';
- nIndent += GnIndentForPCode;
- const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
- if( rStr_PCode.getLength() )
- lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ) );
+ // 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 dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave )
+void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
{
- static const char* pSeparator = "' ================================================================================";
+ (void)pBasic;
+ (void)bWrite;
- SbModule* pTraceMod = pModule;
- SbClassModuleObject* pClassModuleObj = NULL;
- if( pTraceMod->ISA(SbClassModuleObject) )
+ if ( rPar.Count() < 2 )
{
- pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
- pTraceMod = pClassModuleObj->getClassModule();
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
}
- if( nCallLvl > 0 )
- nCallLvl--;
- int nIndent = nCallLvl * GnIndentPerCallLevel;
- if( !bLeave )
- {
- lcl_lineOut( GpTraceFileName, "" );
- lcl_lineOut( GpTraceFileName, pSeparator, lcl_getSpaces( nIndent ) );
- }
+ String aCommand = rPar.Get(1)->GetString();
- String aStr;
- if( bLeave )
- {
- lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) );
- aStr.AppendAscii( "' Leaving " );
- }
+ if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) )
+ GbTraceOn = true;
else
- {
- aStr.AppendAscii( "Entering " );
- }
- String aModuleName = pTraceMod->GetName();
- aStr += aModuleName;
- if( pMethod != NULL )
- {
- aStr.AppendAscii( "::" );
- String aMethodName = pMethod->GetName();
- aStr += aMethodName;
- }
+ if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) )
+ GbTraceOn = false;
else
- {
- aStr.AppendAscii( "/RunInit" );
- }
-
- if( pClassModuleObj != NULL )
- {
- aStr.AppendAscii( "[this=" );
- aStr += pClassModuleObj->GetName();
- aStr.AppendAscii( "]" );
- }
- if( !bLeave )
- aStr += dumpMethodParameters( pMethod );
-
- lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
- if( !bLeave )
- lcl_lineOut( GpTraceFileName, "{", lcl_getSpaces( nIndent ) );
-
- if( bLeave )
- lcl_lineOut( GpTraceFileName, "" );
-}
-
-void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl )
-{
- rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
-
- char Buffer[200];
- const char* pHandledStr = bTraceErrHandled ? " / HANDLED" : "";
- sprintf( Buffer, "*** ERROR%s, Id = %d, Msg = \"%s\" ***", pHandledStr, (int)nTraceErr, aOTraceErrMsg.getStr() );
- int nIndent = nCallLvl * GnIndentPerCallLevel;
- lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
-}
-
-void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
- const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
-{
- String aModuleName = pModule->GetName();
- ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
- PCToTextDataMap* pInnerMap;
- if( it == rModuleTraceMap.end() )
- {
- pInnerMap = new PCToTextDataMap();
- rModuleTraceMap[ aModuleName ] = pInnerMap;
- }
+ if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) )
+ GbIncludePCodes = true;
else
+ if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) )
+ GbIncludePCodes = false;
+ else
+ if( aCommand.EqualsIgnoreCaseAscii( "Print" ) )
{
- pInnerMap = it->second;
- }
-
- TraceTextData aData;
-
- rtl::OString aOTraceStr_STMNT = lcl_toOStringSkipLeadingWhites( aTraceStr_STMNT );
- aData.m_aTraceStr_STMNT = aOTraceStr_STMNT;
-
- rtl::OString aOTraceStr_PCode = lcl_toOStringSkipLeadingWhites( aTraceStr_PCode );
- aData.m_aTraceStr_PCode = aOTraceStr_PCode;
-
- (*pInnerMap)[nPC] = aData;
-}
-
-#endif
-
-
-//==========================================================================
-// For debugging only
-//#define DBG_SAVE_DISASSEMBLY
-
-#ifdef DBG_SAVE_DISASSEMBLY
-static bool dbg_bDisassemble = true;
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
-#include <com/sun/star/io/XTextOutputStream.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-
-using namespace comphelper;
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::ucb;
-using namespace com::sun::star::io;
-
-void dbg_SaveDisassembly( SbModule* pModule )
-{
- bool bDisassemble = dbg_bDisassemble;
- if( bDisassemble )
- {
- Reference< XSimpleFileAccess3 > xSFI;
- Reference< XTextOutputStream > xTextOut;
- Reference< XOutputStream > xOut;
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( xSMgr.is() )
+ if ( rPar.Count() < 3 )
{
- Reference< XSimpleFileAccess3 > xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
- if( xSFI.is() )
- {
- String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/zBasic.Asm/Asm_") );
- StarBASIC* pBasic = (StarBASIC*)pModule->GetParent();
- if( pBasic )
- {
- aFile += pBasic->GetName();
- aFile.AppendAscii( "_" );
- }
- aFile += pModule->GetName();
- aFile.AppendAscii( ".txt" );
-
- // String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/BasicAsm.txt") );
- if( xSFI->exists( aFile ) )
- xSFI->kill( aFile );
- xOut = xSFI->openFileWrite( aFile );
- Reference< XInterface > x = xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.io.TextOutputStream" ) );
- Reference< XActiveDataSource > xADS( x, UNO_QUERY );
- xADS->setOutputStream( xOut );
- xTextOut = Reference< XTextOutputStream >( x, UNO_QUERY );
- }
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
}
- if( xTextOut.is() )
+ SbxError eOld = SbxBase::GetError();
+ if( eOld != SbxERR_OK )
+ SbxBase::ResetError();
+
+ String aValStr = rPar.Get(2)->GetString();
+ SbxError eErr = SbxBase::GetError();
+ if( eErr != SbxERR_OK )
{
- String aDisassemblyStr;
- pModule->Disassemble( aDisassemblyStr );
- xTextOut->writeString( aDisassemblyStr );
+ aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) );
+ SbxBase::ResetError();
}
- xOut->closeOutput();
+
+ 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
+#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;
@@ -429,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 )
@@ -453,14 +285,6 @@ BOOL SbModule::Compile()
}
}
-#ifdef DBG_SAVE_DISASSEMBLY
- dbg_SaveDisassembly( this );
-#endif
-
-#ifdef DBG_TRACE_BASIC
- lcl_PrepareTraceForModule( this );
-#endif
-
return bRet;
}
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 152f2a0652..fac945f69b 100644
--- 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;
}
@@ -281,8 +319,6 @@ BOOL SbiScanner::NextSym()
{
pLine++; nCol++; continue;
}
-// if( toupper( *pLine ) == 'D' )
-// eScanType = SbxDOUBLE;
*p++ = 'E'; pLine++; nCol++;
// Vorzeichen hinter Exponent?
if( *pLine == '+' )
@@ -299,7 +335,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 = '.';
@@ -307,7 +343,6 @@ BOOL SbiScanner::NextSym()
// #57844 Lokalisierte Funktion benutzen
nVal = rtl_math_uStringToDouble( buf, buf+(p-buf), '.', ',', NULL, NULL );
- // ALT: nVal = atof( buf );
ndig = ndig - comma;
if( !comma && !exp )
@@ -320,12 +355,6 @@ BOOL SbiScanner::NextSym()
}
if( bBufOverflow )
GenError( SbERR_MATH_OVERFLOW );
- // zu viele Zahlen fuer SINGLE?
-// if (ndig > 15 || ncdig > 6)
-// eScanType = SbxDOUBLE;
-// else
-// if( nVal > SbxMAXSNG || nVal < SbxMINSNG )
-// eScanType = SbxDOUBLE;
// Typkennung?
SbxDataType t = GetSuffixType( *pLine );
@@ -344,7 +373,6 @@ BOOL SbiScanner::NextSym()
sal_Unicode cmp1[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F', 0 };
sal_Unicode cmp2[] = { '0', '1', '2', '3', '4', '5', '6', '7', 0 };
sal_Unicode *cmp = cmp1;
- //char *cmp = "0123456789ABCDEF";
sal_Unicode base = 16;
sal_Unicode ndig = 8;
sal_Unicode xch = *pLine++ & 0xFF; nCol++;
@@ -352,17 +380,16 @@ BOOL SbiScanner::NextSym()
{
case 'O':
cmp = cmp2; base = 8; ndig = 11; break;
- //cmp = "01234567"; base = 8; ndig = 11; break;
case 'H':
break;
default :
// 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 +397,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 +430,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 +450,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 +489,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 +512,7 @@ eoln:
// .Method
// ^^^ <- spaces is legal in MSO VBA
OSL_TRACE("*** resetting bSpaces***");
- bSpaces = FALSE;
+ bSpaces = sal_False;
}
return bRes;
}
@@ -497,7 +524,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 1bfab6df05..b069512f4e 100644
--- 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;
}
@@ -399,7 +400,6 @@ SbiSymScope SbiSymDef::GetScope() const
return pIn ? pIn->GetScope() : SbLOCAL;
}
-////////////////////////////////////////////////////////////////////////////
// Die Prozedur-Definition hat drei Pools:
// 1) aParams: wird durch die Definition gefuellt. Enthaelt die Namen
@@ -409,7 +409,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 +421,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 +451,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 );
@@ -500,7 +500,7 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
case PROPERTY_MODE_LET: aCompleteProcName.AppendAscii( "Let " ); break;
case PROPERTY_MODE_SET: aCompleteProcName.AppendAscii( "Set " ); break;
case PROPERTY_MODE_NONE:
- DBG_ERROR( "Illegal PropertyMode PROPERTY_MODE_NONE" );
+ OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
break;
}
aCompleteProcName += aName;
@@ -509,7 +509,6 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
}
-//////////////////////////////////////////////////////////////////////////
SbiConstDef::SbiConstDef( const String& rName )
: SbiSymDef( rName )
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index b0bb367210..89b6eb26b5 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -193,168 +193,6 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ NIL, "" }
};
-/*
-TokenTable aTokTable_Java [] = { // Token-Tabelle:
-
- { JS_LOG_NOT, "!" },
- { JS_NE, "!=" },
- { JS_MOD, "%" },
- { JS_ASS_MOD, "%=" },
- { JS_BIT_AND, "&" },
- { JS_LOG_AND, "&&" },
- { JS_ASS_AND, "&=" },
- { JS_LPAREN, "(" },
- { JS_RPAREN, ")" },
- { JS_MUL, "*" },
- { JS_ASS_MUL, "*=" },
- { JS_PLUS, "+" },
- { JS_INC, "++" },
- { JS_ASS_PLUS, "+=" },
- { JS_COMMA, "," },
- { JS_MINUS, "-" },
- { JS_DEC, "--" },
- { JS_ASS_MINUS, "-=" },
- { JS_DIV, "/" },
- { JS_ASS_DIV, "/=" },
- { JS_COND_SEL, ":" },
- { JS_LT, "<" },
- { JS_LSHIFT, "<<" },
- { JS_ASS_LSHIFT,"<<=" },
- { JS_LE, "<=" },
- { JS_NE, "<>" },
- { JS_ASSIGNMENT,"=" },
- { JS_EQ, "==" },
- { JS_GT, ">" },
- { JS_RSHIFT, ">>" },
- { JS_ASS_RSHIFT,">>=" },
- { JS_RSHIFT_Z, ">>>" },
- { JS_ASS_RSHIFT_Z,">>>=" },
- { JS_GE, ">=" },
- { JS_COND_QUEST,"?" },
- { ACCESS, "Access" },
- { ALIAS, "Alias" },
- { AND, "And" },
- { ANY, "Any" },
- { APPEND, "Append" },
- { AS, "As" },
- { BASE, "Base" },
- { BINARY, "Binary" },
- { TBOOLEAN, "Boolean" },
- { BYVAL, "ByVal", },
- { CALL, "Call" },
- { CASE, "Case" },
- { _CDECL_, "Cdecl" },
- { CLOSE, "Close" },
- { COMPARE, "Compare" },
- { _CONST_, "Const" },
- { TCURRENCY,"Currency" },
- { TDATE, "Date" },
- { DECLARE, "Declare" },
- { DEFBOOL, "DefBool" },
- { DEFCUR, "DefCur" },
- { DEFDATE, "DefDate" },
- { DEFDBL, "DefDbl" },
- { DEFERR, "DefErr" },
- { DEFINT, "DefInt" },
- { DEFLNG, "DefLng" },
- { DEFOBJ, "DefObj" },
- { DEFSNG, "DefSng" },
- { DEFSTR, "DefStr" },
- { DEFVAR, "DefVar" },
- { DIM, "Dim" },
- { DO, "Do" },
- { TDOUBLE, "Double" },
- { EACH, "Each" },
- { ELSE, "Else" },
- { ELSEIF, "ElseIf" },
- { END, "End" },
- { ENDFUNC, "End Function" },
- { ENDIF, "End If" },
- { ENDSELECT,"End Select" },
- { ENDSUB, "End Sub" },
- { ENDTYPE, "End Type" },
- { ENDIF, "EndIf" },
- { EQV, "Eqv" },
- { ERASE, "Erase" },
- { _ERROR_, "Error" },
- { EXIT, "Exit" },
- { EXPLICIT, "Explicit" },
- { FOR, "For" },
- { FUNCTION, "Function" },
- { GLOBAL, "Global" },
- { GOSUB, "GoSub" },
- { GOTO, "GoTo" },
- { IF, "If" },
- { IMP, "Imp" },
- { _IN_, "In" },
- { INPUT, "Input" }, // auch INPUT #
- { TINTEGER, "Integer" },
- { IS, "Is" },
- { LET, "Let" },
- { LIB, "Lib" },
- { LINE, "Line" },
- { LINEINPUT,"Line Input" },
- { LOCAL, "Local" },
- { LOCK, "Lock" },
- { TLONG, "Long" },
- { LOOP, "Loop" },
- { LPRINT, "LPrint" },
- { LSET, "LSet" }, // JSM
- { MOD, "Mod" },
- { NAME, "Name" },
- { NEW, "New" },
- { NEXT, "Next" },
- { NOT, "Not" },
- { TOBJECT, "Object" },
- { ON, "On" },
- { OPEN, "Open" },
- { OPTION, "Option" },
- { _OPTIONAL_, "Optional" },
- { OR, "Or" },
- { OUTPUT, "Output" },
- { PRESERVE, "Preserve" },
- { PRINT, "Print" },
- { PRIVATE, "Private" },
- { PUBLIC, "Public" },
- { RANDOM, "Random" },
- { READ, "Read" },
- { REDIM, "ReDim" },
- { REM, "Rem" },
- { RESUME, "Resume" },
- { RETURN, "Return" },
- { RSET, "RSet" }, // JSM
- { SELECT, "Select" },
- { SET, "Set" },
- { SHARED, "Shared" },
- { TSINGLE, "Single" },
- { STATIC, "Static" },
- { STEP, "Step" },
- { STOP, "Stop" },
- { TSTRING, "String" },
- { SUB, "Sub" },
- { STOP, "System" },
- { TEXT, "Text" },
- { THEN, "Then" },
- { TO, "To", },
- { TYPE, "Type" },
- { UNTIL, "Until" },
- { TVARIANT, "Variant" },
- { WEND, "Wend" },
- { WHILE, "While" },
- { WITH, "With" },
- { WRITE, "Write" }, // auch WRITE #
- { XOR, "Xor" },
- { JS_LINDEX, "[" },
- { JS_RINDEX, "]" },
- { JS_BIT_XOR, "^" },
- { JS_ASS_XOR, "^=" },
- { JS_BIT_OR, "|" },
- { JS_ASS_OR, "|=" },
- { JS_LOG_OR, "||" },
- { JS_BIT_NOT, "~" },
- { NIL }
-};
-*/
// #i109076
TokenLabelInfo::TokenLabelInfo( void )
@@ -385,13 +223,11 @@ SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb )
: SbiScanner( rSrc, pb )
{
pTokTable = aTokTable_Basic;
- //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 +269,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 +336,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 +411,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 +450,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 +491,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 +508,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 +547,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 e66fa80f21..93b133a5e8 100644
--- 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 3b1dd88eb7..16e5ee30a8 100644
--- 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/disas.hxx b/basic/source/inc/disas.hxx
index f7e463bdd2..7d7a54f55f 100644
--- 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/expr.hxx b/basic/source/inc/expr.hxx
index 785ee8e151..74b82f5963 100644
--- 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 );
@@ -189,6 +189,12 @@ protected:
SbiExprNode* AddSub();
SbiExprNode* Cat();
SbiExprNode* Like();
+ SbiExprNode* VBA_Not();
+ SbiExprNode* VBA_And();
+ SbiExprNode* VBA_Or();
+ SbiExprNode* VBA_Xor();
+ SbiExprNode* VBA_Eqv();
+ SbiExprNode* VBA_Imp();
SbiExprNode* Comp();
SbiExprNode* Boolean();
public:
@@ -200,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(); }
@@ -237,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 7bfb1f0dd9..f1ff769897 100644
--- 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,61 @@ 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 fcd1f58b57..e9c76fdebf 100644
--- 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,34 @@ 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 025ef857b4..1de16ed917 100644
--- 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 d86ca14a93..3d4a1ffc7b 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -29,7 +29,7 @@
#ifndef BASIC_NAMECONTAINER_HXX
#define BASIC_NAMECONTAINER_HXX
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -101,7 +101,7 @@ struct eqName_Impl
}
};
-typedef std::hash_map
+typedef boost::unordered_map
<
::rtl::OUString,
sal_Int32,
@@ -225,6 +225,7 @@ class SfxLibraryContainer :public LibraryContainerHelper
,public ::utl::OEventListenerAdapter
{
sal_Bool mbVBACompat;
+ rtl::OUString msProjectName;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
@@ -514,6 +515,8 @@ public:
// Methods XVBACompatibility
virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
+ virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx
index bd659bbafe..95f59322b1 100644
--- a/basic/source/inc/object.hxx
+++ b/basic/source/inc/object.hxx
@@ -55,12 +55,12 @@ using SbxVariable::GetInfo;
// Definition eines Tabelleneintrags. Dies wird hier gemacht,
// da dadurch die Methoden und Properties als private deklariert
// werden koennen.
-#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) || defined ( C52 )
+#if defined ( ICC ) || defined ( C50 ) || defined ( C52 )
public:
#endif
typedef void( SampleObject::*pMeth )
- ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite );
-#if defined ( ICC ) || defined ( HPUX )
+ ( 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 0481051df8..30157a7021 100644
--- a/basic/source/inc/opcodes.hxx
+++ b/basic/source/inc/opcodes.hxx
@@ -31,10 +31,6 @@
#include "sbintern.hxx"
-#ifdef MTW
-#undef _NUMBER
-#endif
-
// Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen
// Wert des Opcodes (s.u.).
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 0fcd794dae..0458dcb6a0 100644
--- 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 7f88e28f99..0bfd1da194 100644
--- 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 24af07f9c3..59aeffc7a4 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -33,10 +33,6 @@
#include "sb.hxx"
-// Define activates class UCBStream in iosys.cxx
-#define _USE_UNO
-
-#ifdef _USE_UNO
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/file.hxx>
@@ -53,11 +49,6 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::container;
-// Define activates old file implementation
-// (only in non UCB case)
-// #define _OLD_FILE_IMPL
-
-
namespace basicEncoder
{
@@ -66,16 +57,10 @@ class AsciiEncoder
{
public:
static ::rtl::OUString decodeUnoUrlParamValue(const rtl::OUString & rSource);
- //static ::rtl::OUString encodeUnoUrlParamValue(const rtl::OUString & rSource);
- //static ::rtl::ByteSequence decode(const ::rtl::OUString & string);
- //static ::rtl::OUString encode(const ::rtl::ByteSequence & bytes);
- //static void test();
};
}
-#endif /* _USE_UNO */
-
class SbiInstance; // aktiver StarBASIC-Prozess
class SbiRuntime; // aktive StarBASIC-Prozedur-Instanz
@@ -103,10 +88,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 +109,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
@@ -145,20 +130,14 @@ class SbiRTLData
{
public:
-#ifdef _OLD_FILE_IMPL
- Dir* pDir;
-#else
::osl::Directory* pDir;
-#endif
- INT16 nDirFlags;
+ sal_Int16 nDirFlags;
short nCurDirPos;
String sFullNameToBeChecked;
WildCard* pWildCard;
-#ifdef _USE_UNO
Sequence< ::rtl::OUString > aDirSeq;
-#endif /* _USE_UNO */
SbiRTLData();
~SbiRTLData();
@@ -192,9 +171,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 +182,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 +201,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* );
@@ -244,7 +223,7 @@ public:
sal_uInt32 GetStdTimeIdx() const { return nStdTimeIdx; }
sal_uInt32 GetStdDateTimeIdx() const { return nStdDateTimeIdx; }
- // #39629# NumberFormatter auch statisch anbieten
+ // NumberFormatter auch statisch anbieten
static void PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
LanguageType* peFormatterLangType=NULL, DateFormat* peFormatterDateFormat=NULL );
@@ -269,9 +248,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,30 +272,29 @@ 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
SbxArrayRef refArgv; // aktueller Argv
- // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
- //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern
+ // #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
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 +323,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,15 +353,14 @@ 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 );
- // #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 +383,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 +424,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 +466,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/workben/basmgr.src b/basic/source/inc/sbdiagnose.hxx
index e53efc8246..065efdb183 100644
--- a/basic/workben/basmgr.src
+++ b/basic/source/inc/sbdiagnose.hxx
@@ -1,8 +1,7 @@
/*************************************************************************
- *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * Copyright 2000, 2011 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -24,8 +23,12 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#pragma CHARSET_IBMPC
-String 300 {
- Text = "Dummy";
-};
+#ifndef BASIC_SBDIAGNOSE_HXX
+#define BASIC_SBDIAGNOSE_HXX
+
+#ifdef DBG_UTIL
+void ResetCapturedAssertions();
+#endif
+
+#endif // BASIC_SBDIAGNOSE_HXX
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 6c00a999c1..c35d688e10 100644
--- 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/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
index b7a754b314..9a12f373bf 100644
--- 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
index 50625c10de..bf2caf12cb 100644
--- a/basic/source/inc/sbtrace.hxx
+++ b/basic/source/inc/sbtrace.hxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,17 +28,17 @@
#ifndef _SBTRACE_HXX
#define _SBTRACE_HXX
-// #define DBG_TRACE_BASIC
+//#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
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 54e2106842..daa614d9c5 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -42,7 +42,8 @@
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
#include <rtl/ustring.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
+#include <vector>
class SbUnoObject: public SbxObject
{
@@ -51,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
@@ -84,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;
@@ -103,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();
@@ -117,6 +125,8 @@ public:
bool isInvocationBased( void )
{ return mbInvocation; }
+ bool needsDirectInvocation( void )
+ { return mbDirectInvocation; }
};
@@ -126,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
@@ -134,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; }
@@ -144,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& );
};
@@ -162,7 +172,6 @@ public:
: SbxObject( aName_ )
, m_xClass( xClass_ )
{}
- //~SbUnoClass();
// Find ueberladen, um Elemente on Demand anzulegen
virtual SbxVariable* Find( const String&, SbxClassType );
@@ -170,7 +179,6 @@ public:
// Wert rausgeben
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& getUnoClass( void ) { return m_xClass; }
- //void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
};
SV_DECL_IMPL_REF(SbUnoClass);
@@ -283,15 +291,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 );
//========================================================================
@@ -308,8 +319,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_ );
@@ -321,7 +332,7 @@ public:
virtual void Clear();
};
-typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
typedef std::vector< rtl::OUString > VBAConstantsVector;
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index aa9aa82086..684148f840 100644
--- 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 657c8c6860..33a6fa7589 100644
--- 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 );
@@ -142,7 +143,7 @@ public:
};
//============================================================================
-typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
+typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo
> SfxScriptLibrary_BASE;
diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx
index 3dd28c4e35..80d563756e 100644
--- 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 a36fcfafb5..5be485e8f7 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -45,7 +45,6 @@ class SbiParser;
enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL };
-///////////////////////////////////////////////////////////////////////////
// Der String-Pool nimmt String-Eintraege auf und sorgt dafuer,
// dass sie nicht doppelt vorkommen.
@@ -59,16 +58,15 @@ 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; }
};
-///////////////////////////////////////////////////////////////////////////
SV_DECL_PTRARR_DEL(SbiSymbols,SbiSymDef*,5,5)
@@ -81,8 +79,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 +89,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,16 +98,15 @@ 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
};
-///////////////////////////////////////////////////////////////////////////
class SbiSymDef { // Allgemeiner Symboleintrag
friend class SbiSymPool;
@@ -120,21 +117,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 +143,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 +190,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 +206,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 333a20e10e..b329b37ddf 100644
--- 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 affad8d499..c6deda08e5 100644
--- 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 100644
index 0000000000..627f2cdaf7
--- /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 100644
index 0000000000..9ebe052b9d
--- /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 38f7fbee5c..9c048c15e2 100644
--- 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 e8dd108854..4212479817 100644
--- 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
new file mode 100644
index 0000000000..bde3db0621
--- /dev/null
+++ b/basic/source/runtime/dllmgr-none.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 "sal/config.h"
+
+#if defined(WNT)
+#include <windows.h>
+#undef GetObject
+#endif
+
+#include <algorithm>
+#include <cstddef>
+#include <list>
+#include <map>
+#include <vector>
+
+#include "basic/sbx.hxx"
+#include "basic/sbxvar.hxx"
+#include "osl/thread.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#include "dllmgr.hxx"
+
+struct SbiDllMgr::Impl {};
+
+SbError SbiDllMgr::Call(
+ rtl::OUString const &, rtl::OUString const &, SbxArray *, SbxVariable &,
+ bool)
+{
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+}
+
+void SbiDllMgr::FreeDll(rtl::OUString const &) {}
+
+SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
+
+SbiDllMgr::~SbiDllMgr() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
new file mode 100644
index 0000000000..f38e587a3f
--- /dev/null
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -0,0 +1,776 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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 "sal/config.h"
+
+#if defined(WNT)
+#include <windows.h>
+#undef GetObject
+#endif
+
+#include <algorithm>
+#include <cstddef>
+#include <list>
+#include <map>
+#include <vector>
+
+#include "basic/sbx.hxx"
+#include "basic/sbxvar.hxx"
+#include "osl/thread.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#undef max
+
+#include "dllmgr.hxx"
+
+/* Open issues:
+
+ Missing support for functions returning structs (see TODO in call()).
+
+ Missing support for additional data types (64 bit integers, Any, ...; would
+ trigger OSL_ASSERT(false) in various switches).
+
+ It is assumed that the variables passed into SbiDllMgr::Call to represent
+ the arguments and return value have types that exactly match the Declare
+ statement; it would be better if this code had access to the function
+ signature from the Declare statement, so that it could convert the passed
+ variables accordingly.
+*/
+
+namespace {
+
+char * address(std::vector< char > & blob) {
+ return blob.empty() ? 0 : &blob[0];
+}
+
+SbError convert(rtl::OUString const & source, rtl::OString * target) {
+ return
+ source.convertToString(
+ target, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
+ ? ERRCODE_NONE : ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+}
+
+SbError convert(char const * source, sal_Int32 length, rtl::OUString * target) {
+ return
+ rtl_convertStringToUString(
+ &target->pData, source, length, osl_getThreadTextEncoding(),
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))
+ ? ERRCODE_NONE : ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+}
+
+struct UnmarshalData {
+ UnmarshalData(SbxVariable * theVariable, void * theBuffer):
+ variable(theVariable), buffer(theBuffer) {}
+
+ SbxVariable * variable;
+ void * buffer;
+};
+
+struct StringData: public UnmarshalData {
+ StringData(SbxVariable * theVariable, void * theBuffer, bool theSpecial):
+ UnmarshalData(theVariable, theBuffer), special(theSpecial) {}
+
+ bool special;
+};
+
+class MarshalData: private boost::noncopyable {
+public:
+ std::vector< char > * newBlob() {
+ blobs_.push_front(std::vector< char >());
+ return &blobs_.front();
+ }
+
+ std::vector< UnmarshalData > unmarshal;
+
+ std::vector< StringData > unmarshalStrings;
+
+private:
+ std::list< std::vector< char > > blobs_;
+};
+
+std::size_t align(std::size_t address, std::size_t alignment) {
+ // alignment = 2^k for some k >= 0
+ return (address + (alignment - 1)) & ~(alignment - 1);
+}
+
+char * align(
+ std::vector< char > & blob, std::size_t alignment, std::size_t offset,
+ std::size_t add)
+{
+ std::vector< char >::size_type n = blob.size();
+ n = align(n - offset, alignment) + offset; //TODO: overflow in align()
+ blob.resize(n + add); //TODO: overflow
+ return address(blob) + n;
+}
+
+template< typename T > void add(
+ std::vector< char > & blob, T const & data, std::size_t alignment,
+ std::size_t offset)
+{
+ *reinterpret_cast< T * >(align(blob, alignment, offset, sizeof (T))) = data;
+}
+
+std::size_t alignment(SbxVariable * variable) {
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ return 2;
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxSTRING:
+ return 4;
+ case SbxDOUBLE:
+ return 8;
+ case SbxOBJECT:
+ {
+ std::size_t n = 1;
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
+ n = std::max(n, alignment(props->Get(i)));
+ }
+ return n;
+ }
+ case SbxBOOL:
+ case SbxBYTE:
+ return 1;
+ default:
+ OSL_ASSERT(false);
+ return 1;
+ }
+ } else {
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< sal_Int32 > low(dims);
+ for (int i = 0; i < dims; ++i) {
+ sal_Int32 up;
+ arr->GetDim32(i + 1, low[i], up);
+ }
+ return alignment(arr->Get32(&low[0]));
+ }
+}
+
+SbError marshal(
+ bool outer, SbxVariable * variable, bool special,
+ std::vector< char > & blob, std::size_t offset, MarshalData & data);
+
+SbError marshalString(
+ SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
+{
+ OSL_ASSERT(variable != 0 && buffer != 0);
+ rtl::OString str;
+ SbError e = convert(variable->GetString(), &str);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ std::vector< char > * blob = data.newBlob();
+ 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;
+}
+
+SbError marshalStruct(
+ SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
+ MarshalData & data)
+{
+ OSL_ASSERT(variable != 0);
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ 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;
+ }
+ }
+ return ERRCODE_NONE;
+}
+
+SbError marshalArray(
+ SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
+ MarshalData & data)
+{
+ OSL_ASSERT(variable != 0);
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ 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< sal_Int32 > idx = low;;) {
+ SbError e = marshal(
+ false, arr->Get32(&idx[0]), false, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ int i = dims - 1;
+ while (idx[i] == up[i]) {
+ idx[i] = low[i];
+ if (i == 0) {
+ return ERRCODE_NONE;
+ }
+ --i;
+ }
+ ++idx[i];
+ }
+}
+
+// 8-aligned structs are only 4-aligned on stack, so alignment of members in
+// such structs must take that into account via "offset"
+SbError marshal(
+ bool outer, SbxVariable * variable, bool special,
+ std::vector< char > & blob, std::size_t offset, MarshalData & data)
+{
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetFlags() & SBX_REFERENCE) == 0) {
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ add(blob, variable->GetInteger(), outer ? 8 : 2, offset);
+ break;
+ case SbxLONG:
+ add(blob, variable->GetLong(), outer ? 8 : 4, offset);
+ break;
+ case SbxSINGLE:
+ add(blob, variable->GetSingle(), outer ? 8 : 4, offset);
+ break;
+ case SbxDOUBLE:
+ add(blob, variable->GetDouble(), 8, offset);
+ break;
+ case SbxSTRING:
+ {
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(blob, p, 8, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ align(blob, outer ? 8 : alignment(variable), offset, 0);
+ SbError e = marshalStruct(variable, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ break;
+ }
+ case SbxBOOL:
+ add(blob, variable->GetBool(), outer ? 8 : 1, offset);
+ break;
+ case SbxBYTE:
+ add(blob, variable->GetByte(), outer ? 8 : 1, offset);
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ SbError e = marshalArray(variable, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ } else {
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxDOUBLE:
+ case SbxBOOL:
+ case SbxBYTE:
+ add(blob, variable->data(), 8, offset);
+ break;
+ case SbxSTRING:
+ {
+ std::vector< char > * blob2 = data.newBlob();
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(*blob2, p, 8, 0);
+ add(blob, address(*blob2), 8, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ std::vector< char > * blob2 = data.newBlob();
+ SbError e = marshalStruct(variable, *blob2, 0, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ void * p = address(*blob2);
+ if (outer) {
+ data.unmarshal.push_back(UnmarshalData(variable, p));
+ }
+ add(blob, p, 8, offset);
+ break;
+ }
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ std::vector< char > * blob2 = data.newBlob();
+ SbError e = marshalArray(variable, *blob2, 0, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ void * p = address(*blob2);
+ if (outer) {
+ data.unmarshal.push_back(UnmarshalData(variable, p));
+ }
+ add(blob, p, 8, offset);
+ }
+ }
+ return ERRCODE_NONE;
+}
+
+template< typename T > T read(void const ** pointer) {
+ T const * p = static_cast< T const * >(*pointer);
+ *pointer = static_cast< void const * >(p + 1);
+ return *p;
+}
+
+void const * unmarshal(SbxVariable * variable, void const * data) {
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ variable->PutInteger(read< sal_Int16 >(&data));
+ break;
+ case SbxLONG:
+ variable->PutLong(read< sal_Int32 >(&data));
+ break;
+ case SbxSINGLE:
+ variable->PutSingle(read< float >(&data));
+ break;
+ case SbxDOUBLE:
+ variable->PutDouble(read< double >(&data));
+ break;
+ case SbxSTRING:
+ read< char * >(&data); // handled by unmarshalString
+ break;
+ case SbxOBJECT:
+ {
+ data = reinterpret_cast< void const * >(
+ align(
+ reinterpret_cast< sal_uIntPtr >(data),
+ alignment(variable)));
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (sal_uInt16 i = 0; i < props->Count(); ++i) {
+ data = unmarshal(props->Get(i), data);
+ }
+ break;
+ }
+ case SbxBOOL:
+ variable->PutBool(read< sal_Bool >(&data));
+ break;
+ case SbxBYTE:
+ variable->PutByte(read< sal_uInt8 >(&data));
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ 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< sal_Int32 > idx = low;;) {
+ data = unmarshal(arr->Get32(&idx[0]), data);
+ int i = dims - 1;
+ while (idx[i] == up[i]) {
+ idx[i] = low[i];
+ if (i == 0) {
+ goto done;
+ }
+ --i;
+ }
+ ++idx[i];
+ }
+ done:;
+ }
+ return data;
+}
+
+SbError unmarshalString(StringData const & data, SbxVariable & result) {
+ rtl::OUString str;
+ if (data.buffer != 0) {
+ char const * p = static_cast< char const * >(data.buffer);
+ sal_Int32 len;
+ if (data.special) {
+ len = static_cast< sal_Int32 >(result.GetULong());
+ if (len < 0) { // i.e., DWORD result >= 2^31
+ return ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+ }
+ } else {
+ len = rtl_str_getLength(p);
+ }
+ SbError e = convert(p, len, &str);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ data.variable->PutString(String(str));
+ return ERRCODE_NONE;
+}
+
+struct ProcData {
+ rtl::OString name;
+ FARPROC proc;
+};
+
+SbError call(
+ rtl::OUString const & dll, ProcData const & proc, SbxArray * arguments,
+ SbxVariable & result)
+{
+ if (arguments->Count() > 20)
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+
+ std::vector< char > stack;
+ MarshalData data;
+
+ // For DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer)
+ // from kernel32, upon return, filled lpBuffer length is result DWORD, which
+ // requires special handling in unmarshalString; other functions might
+ // require similar treatment, too:
+ bool special =
+ dll.equalsIgnoreAsciiCaseAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("KERNEL32.DLL")) &&
+ (proc.name ==
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("GetLogicalDriveStringsA")));
+ for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ SbError e = marshal(
+ true, arguments->Get(i), special && i == 2, stack, stack.size(),
+ data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ align(stack, 8, 0, 0);
+ }
+
+ stack.resize(20*8);
+
+ // We fake all calls as being to a varargs function,
+ // as this means any floating-point argument among the first four
+ // ones will end up in a XMM register where the callee expects it.
+ sal_Int32 (*proc_i)(double d, ...) = (sal_Int32 (*)(double, ...)) proc.proc;
+ double (*proc_d)(double d, ...) = (double (*)(double, ...)) proc.proc;
+
+ sal_Int64 iRetVal;
+ double dRetVal;
+
+ switch (result.GetType()) {
+ case SbxEMPTY:
+ case SbxINTEGER:
+ case SbxLONG:
+ case SbxSTRING:
+ case SbxOBJECT:
+ case SbxBOOL:
+ case SbxBYTE:
+ iRetVal =
+ proc_i(*(double *)&stack[0*8],
+ *(double *)&stack[1*8],
+ *(double *)&stack[2*8],
+ *(double *)&stack[3*8],
+ *(sal_uInt64 *)&stack[4*8],
+ *(sal_uInt64 *)&stack[5*8],
+ *(sal_uInt64 *)&stack[6*8],
+ *(sal_uInt64 *)&stack[7*8],
+ *(sal_uInt64 *)&stack[8*8],
+ *(sal_uInt64 *)&stack[9*8],
+ *(sal_uInt64 *)&stack[10*8],
+ *(sal_uInt64 *)&stack[11*8],
+ *(sal_uInt64 *)&stack[12*8],
+ *(sal_uInt64 *)&stack[13*8],
+ *(sal_uInt64 *)&stack[14*8],
+ *(sal_uInt64 *)&stack[15*8],
+ *(sal_uInt64 *)&stack[16*8],
+ *(sal_uInt64 *)&stack[17*8],
+ *(sal_uInt64 *)&stack[18*8],
+ *(sal_uInt64 *)&stack[19*8]);
+ break;
+ case SbxSINGLE:
+ case SbxDOUBLE:
+ dRetVal =
+ proc_d(*(double *)&stack[0*8],
+ *(double *)&stack[1*8],
+ *(double *)&stack[2*8],
+ *(double *)&stack[3*8],
+ *(sal_uInt64 *)&stack[4*8],
+ *(sal_uInt64 *)&stack[5*8],
+ *(sal_uInt64 *)&stack[6*8],
+ *(sal_uInt64 *)&stack[7*8],
+ *(sal_uInt64 *)&stack[8*8],
+ *(sal_uInt64 *)&stack[9*8],
+ *(sal_uInt64 *)&stack[10*8],
+ *(sal_uInt64 *)&stack[11*8],
+ *(sal_uInt64 *)&stack[12*8],
+ *(sal_uInt64 *)&stack[13*8],
+ *(sal_uInt64 *)&stack[14*8],
+ *(sal_uInt64 *)&stack[15*8],
+ *(sal_uInt64 *)&stack[16*8],
+ *(sal_uInt64 *)&stack[17*8],
+ *(sal_uInt64 *)&stack[18*8],
+ *(sal_uInt64 *)&stack[19*8]);
+ }
+
+ switch (result.GetType()) {
+ case SbxEMPTY:
+ break;
+ case SbxINTEGER:
+ result.PutInteger(static_cast< sal_Int16 >(iRetVal));
+ break;
+ case SbxLONG:
+ result.PutLong(static_cast< sal_Int32 >(iRetVal));
+ break;
+ case SbxSINGLE:
+ result.PutSingle(static_cast< float >(dRetVal));
+ break;
+ case SbxDOUBLE:
+ result.PutDouble(dRetVal);
+ break;
+ case SbxSTRING:
+ {
+ char const * s1 = reinterpret_cast< char const * >(iRetVal);
+ rtl::OUString s2;
+ SbError e = convert(s1, rtl_str_getLength(s1), &s2);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ result.PutString(String(s2));
+ break;
+ }
+ case SbxOBJECT:
+ //TODO
+ break;
+ case SbxBOOL:
+ result.PutBool(static_cast< sal_Bool >(iRetVal));
+ break;
+ case SbxBYTE:
+ result.PutByte(static_cast< sal_uInt8 >(iRetVal));
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ arguments->Get(i)->ResetFlag(SBX_REFERENCE);
+ //TODO: skipped for errors?!?
+ }
+ for (std::vector< UnmarshalData >::iterator i(data.unmarshal.begin());
+ i != data.unmarshal.end(); ++i)
+ {
+ unmarshal(i->variable, i->buffer);
+ }
+ for (std::vector< StringData >::iterator i(data.unmarshalStrings.begin());
+ i != data.unmarshalStrings.end(); ++i)
+ {
+ SbError e = unmarshalString(*i, result);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ return ERRCODE_NONE;
+}
+
+SbError getProcData(HMODULE handle, rtl::OUString const & name, ProcData * proc)
+{
+ OSL_ASSERT(proc != 0);
+ if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
+ sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
+ if (n <= 0 || n > 0xFFFF) {
+ return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
+ }
+ FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
+ if (p != 0) {
+ proc->name = rtl::OString(RTL_CONSTASCII_STRINGPARAM("#")) +
+ rtl::OString::valueOf(n);
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ } else {
+ rtl::OString name8;
+ SbError e = convert(name, &name8);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ FARPROC p = GetProcAddress(handle, name8.getStr());
+ if (p != 0) {
+ proc->name = name8;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ sal_Int32 i = name8.indexOf('#');
+ if (i != -1) {
+ name8 = name8.copy(0, i);
+ p = GetProcAddress(handle, name8.getStr());
+ if (p != 0) {
+ proc->name = name8;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ }
+ rtl::OString real(
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("_")) + name8);
+ p = GetProcAddress(handle, real.getStr());
+ if (p != 0) {
+ proc->name = real;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ real = name8 + rtl::OString(RTL_CONSTASCII_STRINGPARAM("A"));
+ p = GetProcAddress(handle, real.getStr());
+ if (p != 0) {
+ proc->name = real;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ }
+ return ERRCODE_BASIC_PROC_UNDEFINED;
+}
+
+struct Dll: public salhelper::SimpleReferenceObject {
+private:
+ typedef std::map< rtl::OUString, ProcData > Procs;
+
+ virtual ~Dll();
+
+public:
+ Dll(): handle(0) {}
+
+ SbError getProc(rtl::OUString const & name, ProcData * proc);
+
+ HMODULE handle;
+ Procs procs;
+};
+
+Dll::~Dll() {
+ if (handle != 0 && !FreeLibrary(handle)) {
+ OSL_TRACE("FreeLibrary(%p) failed with %u", handle, GetLastError());
+ }
+}
+
+SbError Dll::getProc(rtl::OUString const & name, ProcData * proc) {
+ Procs::iterator i(procs.find(name));
+ if (i != procs.end()) {
+ *proc = i->second;
+ return ERRCODE_NONE;
+ }
+ SbError e = getProcData(handle, name, proc);
+ if (e == ERRCODE_NONE) {
+ procs.insert(Procs::value_type(name, *proc));
+ }
+ return e;
+}
+
+rtl::OUString fullDllName(rtl::OUString const & name) {
+ rtl::OUString full(name);
+ if (full.indexOf('.') == -1) {
+ full += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".DLL"));
+ }
+ return full;
+}
+
+}
+
+struct SbiDllMgr::Impl: private boost::noncopyable {
+private:
+ typedef std::map< rtl::OUString, rtl::Reference< Dll > > Dlls;
+
+public:
+ Dll * getDll(rtl::OUString const & name);
+
+ Dlls dlls;
+};
+
+Dll * SbiDllMgr::Impl::getDll(rtl::OUString const & name) {
+ Dlls::iterator i(dlls.find(name));
+ if (i == dlls.end()) {
+ i = dlls.insert(Dlls::value_type(name, new Dll)).first;
+ HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
+ if (h == 0) {
+ dlls.erase(i);
+ return 0;
+ }
+ i->second->handle = h;
+ }
+ return i->second.get();
+}
+
+SbError SbiDllMgr::Call(
+ rtl::OUString const & function, rtl::OUString const & library,
+ SbxArray * arguments, SbxVariable & result, bool cdeclConvention)
+{
+ if (cdeclConvention) {
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+ }
+ rtl::OUString dllName(fullDllName(library));
+ Dll * dll = impl_->getDll(dllName);
+ if (dll == 0) {
+ return ERRCODE_BASIC_BAD_DLL_LOAD;
+ }
+ ProcData proc;
+ SbError e = dll->getProc(function, &proc);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ return call(dllName, proc, arguments, result);
+}
+
+void SbiDllMgr::FreeDll(rtl::OUString const & library) {
+ impl_->dlls.erase(library);
+}
+
+SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
+
+SbiDllMgr::~SbiDllMgr() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 1021bcce34..5b47511db1 100644
--- a/basic/source/runtime/dllmgr.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -29,6 +29,11 @@
#include "precompiled_basic.hxx"
#include "sal/config.h"
+#if defined(WNT)
+#include <windows.h>
+#undef GetObject
+#endif
+
#include <algorithm>
#include <cstddef>
#include <list>
@@ -37,12 +42,12 @@
#include "basic/sbx.hxx"
#include "basic/sbxvar.hxx"
+#include "runtime.hxx"
#include "osl/thread.h"
#include "rtl/ref.hxx"
#include "rtl/string.hxx"
#include "rtl/ustring.hxx"
#include "salhelper/simplereferenceobject.hxx"
-#include "tools/svwin.h"
#undef max
@@ -50,8 +55,6 @@
/* Open issues:
- Only 32-bit Windows for now.
-
Missing support for functions returning structs (see TODO in call()).
Missing support for additional data types (64 bit integers, Any, ...; would
@@ -64,8 +67,6 @@
variables accordingly.
*/
-#if defined WNT // only 32-bit Windows, actually
-
extern "C" {
int __stdcall DllMgr_call32(FARPROC, void const * stack, std::size_t size);
@@ -169,7 +170,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;
@@ -184,9 +185,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]));
@@ -207,7 +208,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;
@@ -220,7 +222,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;
@@ -236,12 +238,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) {
@@ -266,9 +268,15 @@ SbError marshal(
std::vector< char > & blob, std::size_t offset, MarshalData & data)
{
OSL_ASSERT(variable != 0);
- if ((variable->GetFlags() & SBX_REFERENCE) == 0) {
- if ((variable->GetType() & SbxARRAY) == 0) {
- switch (variable->GetType()) {
+
+ SbxDataType eVarType = variable->GetType();
+ bool bByVal = (variable->GetFlags() & SBX_REFERENCE) == 0;
+ if( !bByVal && !SbiRuntime::isVBAEnabled() && eVarType == SbxSTRING )
+ bByVal = true;
+
+ if (bByVal) {
+ if ((eVarType & SbxARRAY) == 0) {
+ switch (eVarType) {
case SbxINTEGER:
add(blob, variable->GetInteger(), outer ? 4 : 2, offset);
break;
@@ -317,8 +325,8 @@ SbError marshal(
}
}
} else {
- if ((variable->GetType() & SbxARRAY) == 0) {
- switch (variable->GetType()) {
+ if ((eVarType & SbxARRAY) == 0) {
+ switch (eVarType) {
case SbxINTEGER:
case SbxLONG:
case SbxSINGLE:
@@ -406,7 +414,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;
@@ -424,12 +432,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]) {
@@ -489,7 +497,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);
@@ -551,7 +559,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?!?
}
@@ -719,21 +727,6 @@ void SbiDllMgr::FreeDll(rtl::OUString const & library) {
impl_->dlls.erase(library);
}
-#else
-
-struct SbiDllMgr::Impl {};
-
-SbError SbiDllMgr::Call(
- rtl::OUString const &, rtl::OUString const &, SbxArray *, SbxVariable &,
- bool)
-{
- return ERRCODE_BASIC_NOT_IMPLEMENTED;
-}
-
-void SbiDllMgr::FreeDll(rtl::OUString const &) {}
-
-#endif
-
SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
SbiDllMgr::~SbiDllMgr() {}
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 389e5835d1..91616a399a 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -152,7 +152,6 @@ IMPL_LINK_INLINE_END( SvRTLInputBox, CancelHdl, Button *, pButton )
// *********************************************************************
// *********************************************************************
-// *********************************************************************
// Syntax: String InputBox( Prompt, [Title], [Default] [, nXpos, nYpos ] )
@@ -161,14 +160,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 97498a8a29..9caeff78fd 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -40,9 +40,6 @@
#include "runtime.hxx"
-#ifdef _USE_UNO
-
-// <-- encoding
#include <sal/alloca.h>
#include <ctype.h>
@@ -51,7 +48,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/textenc.h>
#include <rtl/ustrbuf.hxx>
-// encoding -->
+
#include <comphelper/processfactory.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -73,8 +70,6 @@ using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
using namespace com::sun::star::bridge;
-#endif /* _USE_UNO */
-
#include "iosys.hxx"
#include "sbintern.hxx"
@@ -139,7 +134,6 @@ IMPL_LINK_INLINE_START( SbiInputDialog, Cancel, Window *, pWindow )
}
IMPL_LINK_INLINE_END( SbiInputDialog, Cancel, Window *, pWindow )
-//////////////////////////////////////////////////////////////////////////
SbiStream::SbiStream()
: pStrm( 0 )
@@ -215,13 +209,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 +224,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,14 +237,14 @@ 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::createFromAscii( "com.sun.star.bridge.BridgeFactory" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.BridgeFactory" )) ), UNO_QUERY );
Sequence< Reference< XBridge > > aBridgeSeq;
sal_Int32 nBridgeCount = 0;
@@ -263,13 +257,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 +281,7 @@ BOOL needSecurityRestrictions( void )
else
{
// Different user -> Secure mode!
- bRetVal = TRUE;
+ bRetVal = sal_True;
break;
}
}
@@ -297,50 +291,48 @@ 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
{
- Reference< XContentProviderManager > xManager( xSMgr->createInstance( ::rtl::OUString::createFromAscii
- ( "com.sun.star.ucb.UniversalContentBroker" ) ), UNO_QUERY );
+ Reference< XContentProviderManager > xManager( xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM
+ ( "com.sun.star.ucb.UniversalContentBroker" )) ), UNO_QUERY );
- if ( !( xManager.is() && xManager->queryContentProvider( ::rtl::OUString::createFromAscii( "file:///" ) ).is() ) )
+ 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
}
-#ifndef _OLD_FILE_IMPL
-
class OslStream : public SvStream
{
osl::File maFile;
@@ -349,11 +341,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 )
@@ -364,21 +356,21 @@ OslStream::OslStream( const String& rName, short nStrmMode )
if( (nStrmMode & (STREAM_READ | STREAM_WRITE)) == (STREAM_READ | STREAM_WRITE) )
{
- nFlags = OpenFlag_Read | OpenFlag_Write;
+ nFlags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write;
}
else if( nStrmMode & STREAM_WRITE )
{
- nFlags = OpenFlag_Write;
+ nFlags = osl_File_OpenFlag_Write;
}
else //if( nStrmMode & STREAM_READ )
{
- nFlags = OpenFlag_Read;
+ nFlags = osl_File_OpenFlag_Read;
}
osl::FileBase::RC nRet = maFile.open( nFlags );
- if( nRet == osl::FileBase::E_NOENT && nFlags != OpenFlag_Read )
+ if( nRet == osl::FileBase::E_NOENT && nFlags != osl_File_OpenFlag_Read )
{
- nFlags |= OpenFlag_Create;
+ nFlags |= osl_File_OpenFlag_Create;
nRet = maFile.open( nFlags );
}
@@ -394,50 +386,40 @@ OslStream::~OslStream()
maFile.close();
}
-ULONG OslStream::GetData( void* pData, ULONG nSize )
+sal_uIntPtr OslStream::GetData( void* pData, sal_uIntPtr nSize )
{
sal_uInt64 nBytesRead = nSize;
- osl::FileBase::RC nRet = osl::FileBase::E_None;
- nRet = maFile.read( pData, nBytesRead, nBytesRead );
- return (ULONG)nBytesRead;
+ maFile.read( pData, nBytesRead, 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;
- osl::FileBase::RC nRet = osl::FileBase::E_None;
- nRet = maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
- return (ULONG)nBytesWritten;
+ maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
+ return (sal_uIntPtr)nBytesWritten;
}
-ULONG OslStream::SeekPos( ULONG nPos )
+sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
{
- osl::FileBase::RC nRet;
if( nPos == STREAM_SEEK_TO_END )
- {
- nRet = maFile.setPos( Pos_End, 0 );
- }
+ maFile.setPos( Pos_End, 0 );
else
- {
- nRet = maFile.setPos( Pos_Absolut, (sal_uInt64)nPos );
- }
- sal_uInt64 nRealPos;
- nRet = maFile.getPos( nRealPos );
- return sal::static_int_cast<ULONG>(nRealPos);
+ maFile.setPos( Pos_Absolut, (sal_uInt64)nPos );
+ sal_uInt64 nRealPos(0);
+ maFile.getPos( nRealPos );
+ return sal::static_int_cast<sal_uIntPtr>(nRealPos);
}
void OslStream::FlushData()
{
}
-void OslStream::SetSize( ULONG nSize )
+void OslStream::SetSize( sal_uIntPtr nSize )
{
- osl::FileBase::RC nRet = osl::FileBase::E_None;
- nRet = maFile.setSize( (sal_uInt64)nSize );
+ maFile.setSize( (sal_uInt64)nSize );
}
-#endif
-
#ifdef _USE_UNO
@@ -452,47 +434,13 @@ 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 )
-{
- ULONG eReturn = ERRCODE_IO_GENERAL;
- switch( nError )
- {
- case ucb::IOErrorCode_ABORT: eReturn = SVSTREAM_GENERALERROR; break;
- case ucb::IOErrorCode_NOT_EXISTING: eReturn = SVSTREAM_FILE_NOT_FOUND; break;
- case ucb::IOErrorCode_NOT_EXISTING_PATH: eReturn = SVSTREAM_PATH_NOT_FOUND; break;
- case ucb::IOErrorCode_OUT_OF_FILE_HANDLES: eReturn = SVSTREAM_TOO_MANY_OPEN_FILES; break;
- case ucb::IOErrorCode_ACCESS_DENIED: eReturn = SVSTREAM_ACCESS_DENIED; break;
- case ucb::IOErrorCode_LOCKING_VIOLATION: eReturn = SVSTREAM_SHARING_VIOLATION; break;
-
- case ucb::IOErrorCode_INVALID_ACCESS: eReturn = SVSTREAM_INVALID_ACCESS; break;
- case ucb::IOErrorCode_CANT_CREATE: eReturn = SVSTREAM_CANNOT_MAKE; break;
- case ucb::IOErrorCode_INVALID_PARAMETER: eReturn = SVSTREAM_INVALID_PARAMETER; break;
-
- case ucb::IOErrorCode_CANT_READ: eReturn = SVSTREAM_READ_ERROR; break;
- case ucb::IOErrorCode_CANT_WRITE: eReturn = SVSTREAM_WRITE_ERROR; break;
- case ucb::IOErrorCode_CANT_SEEK: eReturn = SVSTREAM_SEEK_ERROR; break;
- case ucb::IOErrorCode_CANT_TELL: eReturn = SVSTREAM_TELL_ERROR; break;
-
- case ucb::IOErrorCode_OUT_OF_MEMORY: eReturn = SVSTREAM_OUTOFMEMORY; break;
-
- case SVSTREAM_FILEFORMAT_ERROR: eReturn = SVSTREAM_FILEFORMAT_ERROR; break;
- case ucb::IOErrorCode_WRONG_VERSION: eReturn = SVSTREAM_WRONGVERSION;
- case ucb::IOErrorCode_OUT_OF_DISK_SPACE: eReturn = SVSTREAM_DISK_FULL; break;
-
- case ucb::IOErrorCode_BAD_CRC: eReturn = ERRCODE_IO_BADCRC; break;
- }
- return eReturn;
-}
-*/
-
UCBStream::UCBStream( Reference< XInputStream > & rStm )
: xIS( rStm )
, xSeek( rStm, UNO_QUERY )
@@ -533,7 +481,7 @@ UCBStream::~UCBStream()
}
}
-ULONG UCBStream::GetData( void* pData, ULONG nSize )
+sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize )
{
try
{
@@ -562,7 +510,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
{
@@ -589,13 +537,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 );
@@ -629,11 +577,11 @@ void UCBStream::FlushData()
}
}
-void UCBStream::SetSize( ULONG nSize )
+void UCBStream::SetSize( sal_uIntPtr nSize )
{
(void)nSize;
- DBG_ERROR( "not allowed to call from basic" );
+ OSL_FAIL( "not allowed to call from basic" );
SetError( ERRCODE_IO_GENERAL );
}
@@ -660,7 +608,7 @@ SbError SbiStream::Open
if( xSMgr.is() )
{
Reference< XSimpleFileAccess >
- xSFI( xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ xSFI( xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
if( xSFI.is() )
{
try
@@ -682,9 +630,6 @@ SbError SbiStream::Open
{
Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
pStrm = new UCBStream( xIS );
- // Open for writing is not implemented in ucb yet!!!
- //Reference< XOutputStream > xIS = xSFI->openFileWrite( aNameStr );
- //pStrm = new UCBStream( xIS );
}
else //if( nStrmMode & STREAM_READ )
{
@@ -704,11 +649,7 @@ SbError SbiStream::Open
#endif
if( !pStrm )
{
-#ifdef _OLD_FILE_IMPL
- pStrm = new SvFileStream( aNameStr, nStrmMode );
-#else
pStrm = new OslStream( aNameStr, nStrmMode );
-#endif
}
if( IsAppend() )
pStrm->Seek( STREAM_SEEK_TO_END );
@@ -722,12 +663,6 @@ SbError SbiStream::Close()
{
if( pStrm )
{
- if( !hasUno() )
- {
-#ifdef _OLD_FILE_IMPL
- ((SvFileStream *)pStrm)->Close();
-#endif
- }
MapError();
delete pStrm;
pStrm = NULL;
@@ -736,7 +671,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() )
@@ -775,10 +710,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;
@@ -791,7 +726,7 @@ void SbiStream::ExpandFile()
}
}
-SbError SbiStream::Write( const ByteString& rBuf, USHORT n )
+SbError SbiStream::Write( const ByteString& rBuf, sal_uInt16 n )
{
ExpandFile();
if( IsAppend() )
@@ -802,7 +737,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 );
@@ -823,7 +758,6 @@ SbError SbiStream::Write( const ByteString& rBuf, USHORT n )
return nError;
}
-//////////////////////////////////////////////////////////////////////////
// Zugriff auf das aktuelle I/O-System:
@@ -833,7 +767,6 @@ SbiIoSystem* SbGetIoSystem()
return pInst ? pInst->GetIoSystem() : NULL;
}
-//////////////////////////////////////////////////////////////////////////
SbiIoSystem::SbiIoSystem()
{
@@ -1021,8 +954,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 f2ed11196b..80066425e3 100644..100755
--- a/basic/source/runtime/makefile.mk
+++ b/basic/source/runtime/makefile.mk
@@ -41,7 +41,8 @@ ENABLE_EXCEPTIONS = TRUE
SLOFILES= \
$(SLO)$/basrdll.obj \
- $(SLO)$/inputbox.obj \
+ $(SLO)$/comenumwrapper.obj \
+ $(SLO)$/inputbox.obj\
$(SLO)$/runtime.obj \
$(SLO)$/step0.obj \
$(SLO)$/step1.obj \
@@ -50,15 +51,27 @@ SLOFILES= \
$(SLO)$/stdobj.obj \
$(SLO)$/stdobj1.obj \
$(SLO)$/methods.obj \
- $(SLO)$/methods1.obj \
+ $(SLO)$/methods1.obj\
$(SLO)$/props.obj \
- $(SLO)$/ddectrl.obj \
- $(SLO)$/dllmgr.obj
+ $(SLO)$/ddectrl.obj \
+ $(SLO)$/sbdiagnose.obj
+.IF "$(GUI)$(CPU)" == "WNTI"
+SLOFILES+= \
+ $(SLO)$/dllmgr-x86.obj
+.ELIF "$(GUI)$(CPU)" == "WNTX"
+SLOFILES+= \
+ $(SLO)$/dllmgr-x64.obj
+.ELSE
+SLOFILES+= \
+ $(SLO)$/dllmgr-none.obj
+.ENDIF
.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
-SLOFILES+= $(SLO)$/wnt.obj
+SLOFILES+= \
+ $(SLO)$/wnt-x86.obj
.ELIF "$(GUI)$(COM)$(CPU)" == "WNTGCCI"
-SLOFILES+= $(SLO)$/wnt-mingw.obj
+SLOFILES+= \
+ $(SLO)$/wnt-mingw.obj
.ENDIF
# --- Targets -------------------------------------------------------------
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 525d0012ab..6a846eb927 100644
--- 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>
@@ -52,16 +52,12 @@
#include "runtime.hxx"
#include "sbunoobj.hxx"
#ifdef WNT
-#include <tools/prewin.h>
-#include "winbase.h"
-#include <tools/postwin.h>
#include <tools/fsys.hxx>
#else
#include <osl/file.hxx>
#endif
#include "errobject.hxx"
-#ifdef _USE_UNO
#include <comphelper/processfactory.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -84,10 +80,6 @@ using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
using namespace com::sun::star::script;
-#endif /* _USE_UNO */
-
-//#define _ENABLE_CUR_DIR
-
#include "stdobj.hxx"
#include <basic/sbstdobj.hxx>
#include "rtlproto.hxx"
@@ -106,29 +98,27 @@ 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>
#endif
-#ifdef WNT
-#include <io.h>
-#endif
-
-
#include <basic/sbobjmod.hxx>
#include <basic/sbobjmod.hxx>
+#ifdef WNT
+#define GradientStyle_RECT BLA_GradientStyle_RECT
+#include <windows.h>
+#include <io.h>
+#undef GetObject
+#undef GradientSyle_RECT
+#endif
+
static void FilterWhiteSpace( String& rStr )
{
rStr.EraseAllChars( ' ' );
@@ -165,7 +155,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 );
}
@@ -223,7 +213,7 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void
if( xSMgr.is() )
{
xSFI = com::sun::star::uno::Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
}
}
return xSFI;
@@ -231,8 +221,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 )
@@ -265,7 +255,7 @@ RTLFUNC(Error)
{
String aErrorMsg;
SbError nErr = 0L;
- INT32 nCode = 0;
+ sal_Int32 nCode = 0;
if( rPar.Count() == 1 )
{
nErr = StarBASIC::GetErrBasic();
@@ -277,7 +267,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,8 +415,7 @@ RTLFUNC(CurDir)
// DirEntry-Funktionalitaet keine Moeglichkeit besteht, das aktuelle so
// 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 )
{
@@ -463,7 +452,7 @@ RTLFUNC(CurDir)
int nSize = _PATH_INCR;
char* pMem;
- while( TRUE )
+ while( sal_True )
{
pMem = new char[nSize];
if( !pMem )
@@ -490,70 +479,23 @@ RTLFUNC(CurDir)
#endif
}
-RTLFUNC(ChDir) // JSM
+RTLFUNC(ChDir)
{
(void)pBasic;
(void)bWrite;
rPar.Get(0)->PutEmpty();
- if (rPar.Count() == 2)
- {
-#ifdef _ENABLE_CUR_DIR
- String aPath = rPar.Get(1)->GetString();
- BOOL bError = 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;
-#else
- if (!DirEntry(aPath).SetCWD())
- bError = TRUE;
-#endif
- if( bError )
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#endif
- }
- else
+ if (rPar.Count() != 2)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
-RTLFUNC(ChDrive) // JSM
+RTLFUNC(ChDrive)
{
(void)pBasic;
(void)bWrite;
rPar.Get(0)->PutEmpty();
- if (rPar.Count() == 2)
- {
-#ifdef _ENABLE_CUR_DIR
- // Keine Laufwerke in Unix
-#ifndef UNX
- String aPar1 = rPar.Get(1)->GetString();
-
-#if defined (WIN) || defined (WNT) || defined (OS2)
- if (aPar1.Len() > 0)
- {
- int nCurDrive = (int)aPar1.GetBuffer()[0]; ;
- if ( !isalpha( nCurDrive ) )
- {
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return;
- }
- else
- nCurDrive -= ( 'A' - 1 );
- if (_chdrive(nCurDrive))
- StarBASIC::Error( SbERR_NO_DEVICE );
- }
-#endif
-
-#endif
- // #ifndef UNX
-#endif
- }
- else
+ if (rPar.Count() != 2)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
@@ -596,7 +538,7 @@ void implStepRenameOSL( const String& aSource, const String& aDest )
}
}
-RTLFUNC(FileCopy) // JSM
+RTLFUNC(FileCopy)
{
(void)pBasic;
(void)bWrite;
@@ -606,7 +548,6 @@ RTLFUNC(FileCopy) // JSM
{
String aSource = rPar.Get(1)->GetString();
String aDest = rPar.Get(2)->GetString();
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -623,31 +564,19 @@ RTLFUNC(FileCopy) // JSM
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- DirEntry aSourceDirEntry(aSource);
- if (aSourceDirEntry.Exists())
- {
- if (aSourceDirEntry.CopyTo(DirEntry(aDest),FSYS_ACTION_COPYFILE) != FSYS_ERR_OK)
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
- }
- else
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
FileBase::RC nRet = File::copy( getFullPathUNC( aSource ), getFullPathUNC( aDest ) );
if( nRet != FileBase::E_None )
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
}
-#endif
}
}
else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
-RTLFUNC(Kill) // JSM
+RTLFUNC(Kill)
{
(void)pBasic;
(void)bWrite;
@@ -657,7 +586,6 @@ RTLFUNC(Kill) // JSM
{
String aFileSpec = rPar.Get(1)->GetString();
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -680,21 +608,15 @@ RTLFUNC(Kill) // JSM
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- if(DirEntry(aFileSpec).Kill() != FSYS_ERR_OK)
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
File::remove( getFullPathUNC( aFileSpec ) );
-#endif
}
}
else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
-RTLFUNC(MkDir) // JSM
+RTLFUNC(MkDir)
{
(void)pBasic;
(void)bWrite;
@@ -704,7 +626,6 @@ RTLFUNC(MkDir) // JSM
{
String aPath = rPar.Get(1)->GetString();
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -728,7 +649,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 );
@@ -751,14 +672,8 @@ RTLFUNC(MkDir) // JSM
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- if (!DirEntry(aPath).MakeDir())
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
Directory::create( getFullPathUNC( aPath ) );
-#endif
}
}
else
@@ -766,8 +681,6 @@ RTLFUNC(MkDir) // JSM
}
-#ifndef _OLD_FILE_IMPL
-
// In OSL only empty directories can be deleted
// so we have to delete all files recursively
void implRemoveDirRecursive( const String& aDirPath )
@@ -823,10 +736,9 @@ void implRemoveDirRecursive( const String& aDirPath )
nRet = Directory::remove( aDirPath );
}
-#endif
-RTLFUNC(RmDir) // JSM
+RTLFUNC(RmDir)
{
(void)pBasic;
(void)bWrite;
@@ -835,7 +747,6 @@ RTLFUNC(RmDir) // JSM
if (rPar.Count() == 2)
{
String aPath = rPar.Get(1)->GetString();
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -870,22 +781,15 @@ RTLFUNC(RmDir) // JSM
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- DirEntry aDirEntry(aPath);
- if (aDirEntry.Kill() != FSYS_ERR_OK)
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
implRemoveDirRecursive( getFullPathUNC( aPath ) );
-#endif
}
}
else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
-RTLFUNC(SendKeys) // JSM
+RTLFUNC(SendKeys)
{
(void)pBasic;
(void)bWrite;
@@ -921,8 +825,7 @@ RTLFUNC(FileLen)
{
SbxVariableRef pArg = rPar.Get( 1 );
String aStr( pArg->GetString() );
- INT32 nLen = 0;
- // <-- UCB
+ sal_Int32 nLen = 0;
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -939,18 +842,12 @@ RTLFUNC(FileLen)
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- FileStat aStat = DirEntry( aStr );
- nLen = aStat.GetSize();
-#else
DirectoryItem aItem;
- FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem );
+ DirectoryItem::get( getFullPathUNC( aStr ), aItem );
FileStatus aFileStatus( FileStatusMask_FileSize );
- nRet = aItem.getFileStatus( aFileStatus );
- nLen = (INT32)aFileStatus.getFileSize();
-#endif
+ aItem.getFileStatus( aFileStatus );
+ nLen = (sal_Int32)aFileStatus.getFileSize();
}
rPar.Get(0)->PutLong( (long)nLen );
}
@@ -1003,23 +900,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++;
}
@@ -1029,7 +926,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
{
@@ -1038,7 +935,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
@@ -1085,7 +982,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
@@ -1093,7 +990,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();
@@ -1110,7 +1007,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
{
@@ -1119,13 +1016,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
@@ -1141,7 +1038,7 @@ RTLFUNC(InStrRev)
if( nRet == -1 )
nPos = 0;
else
- nPos = (USHORT)nRet + 1;
+ nPos = (sal_uInt16)nRet + 1;
}
else
{
@@ -1155,7 +1052,7 @@ RTLFUNC(InStrRev)
if( nRet == -1 )
nPos = 0;
else
- nPos = (USHORT)nRet + 1;
+ nPos = (sal_uInt16)nRet + 1;
}
}
}
@@ -1239,7 +1136,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;
@@ -1249,7 +1146,7 @@ RTLFUNC(Left)
lResultLen = 0;
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
- aStr.Erase( (USHORT)lResultLen );
+ aStr.Erase( (sal_uInt16)lResultLen );
rPar.Get(0)->PutString( aStr );
}
}
@@ -1298,7 +1195,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
@@ -1308,23 +1205,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 )
@@ -1333,7 +1230,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 );
@@ -1341,8 +1238,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;
@@ -1354,12 +1251,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 );
}
@@ -1407,7 +1304,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
@@ -1416,7 +1313,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 )
@@ -1428,7 +1325,7 @@ RTLFUNC(Replace)
}
}
- INT32 lCount = -1;
+ sal_Int32 lCount = -1;
if( nArgCount >=5 )
{
if( rPar.Get(5)->GetType() != SbxEMPTY )
@@ -1446,7 +1343,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
{
@@ -1455,14 +1352,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 );
@@ -1484,7 +1381,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) ) );
}
}
@@ -1498,7 +1395,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;
@@ -1508,8 +1405,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 );
@@ -1550,7 +1447,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 )
@@ -1569,7 +1466,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 );
}
}
@@ -1584,7 +1481,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 );
}
}
@@ -1634,11 +1531,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 );
@@ -1669,16 +1566,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();
@@ -1714,7 +1611,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)
@@ -1728,10 +1625,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,9 +1685,6 @@ RTLFUNC(Val)
char* pEndPtr;
String aStr( rPar.Get(1)->GetString() );
-// lt. Mikkysoft bei Kommas abbrechen!
-// for( USHORT n=0; n < aStr.Len(); n++ )
-// if( aStr[n] == ',' ) aStr[n] = '.';
FilterWhiteSpace( aStr );
if ( aStr.GetBuffer()[0] == '&' && aStr.Len() > 1 )
@@ -1804,7 +1698,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;
}
}
@@ -1813,7 +1707,6 @@ RTLFUNC(Val)
// #57844 Lokalisierte Funktion benutzen
nResult = ::rtl::math::stringToDouble( aStr, '.', ',', NULL, NULL );
checkArithmeticOverflow( nResult );
- // ATL: nResult = strtod( aStr.GetStr(), &pEndPtr );
}
rPar.Get(0)->PutDouble( nResult );
@@ -1822,46 +1715,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;
@@ -1871,7 +1764,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() )
{
@@ -1879,7 +1772,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
@@ -1894,7 +1787,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 );
@@ -1911,7 +1804,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
@@ -1945,14 +1838,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 );
}
@@ -1971,9 +1864,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 ) )
@@ -1990,11 +1883,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 ))
@@ -2003,7 +1896,7 @@ RTLFUNC(TimeSerial)
return;
}
- INT32 nSeconds = nHour;
+ sal_Int32 nSeconds = nHour;
nSeconds *= 3600;
nSeconds += nMinute * 60;
nSeconds += nSecond;
@@ -2033,7 +1926,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
@@ -2061,8 +1954,7 @@ RTLFUNC(DateValue)
else
fResult = ceil( fResult );
}
- // fResult += 2.0; // Anpassung StarCalcFormatter
- rPar.Get(0)->PutDate( fResult ); // JSM
+ rPar.Get(0)->PutDate( fResult );
}
else
StarBASIC::Error( SbERR_CONVERSION );
@@ -2094,7 +1986,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))
@@ -2102,7 +1994,7 @@ RTLFUNC(TimeValue)
if ( nType == NUMBERFORMAT_DATETIME )
// Tage abschneiden
fResult = fmod( fResult, 1 );
- rPar.Get(0)->PutDate( fResult ); // JSM
+ rPar.Get(0)->PutDate( fResult );
}
else
StarBASIC::Error( SbERR_CONVERSION );
@@ -2125,7 +2017,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 );
}
}
@@ -2139,19 +2031,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;
}
@@ -2165,20 +2057,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;
}
@@ -2192,7 +2084,7 @@ RTLFUNC(Minute)
else
{
double nArg = rPar.Get(1)->GetDate();
- INT16 nMin = implGetMinute( nArg );
+ sal_Int16 nMin = implGetMinute( nArg );
rPar.Get(0)->PutInteger( nMin );
}
}
@@ -2206,24 +2098,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;
}
@@ -2237,7 +2129,7 @@ RTLFUNC(Second)
else
{
double nArg = rPar.Get(1)->GetDate();
- INT16 nSecond = implGetSecond( nArg );
+ sal_Int16 nSecond = implGetSecond( nArg );
rPar.Get(0)->PutInteger( nSecond );
}
}
@@ -2389,7 +2281,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)
@@ -2408,7 +2300,7 @@ RTLFUNC(IsObject)
SbxBase::ResetError();
SbUnoClass* pUnoClass;
- BOOL bObject;
+ sal_Bool bObject;
if( pObj && NULL != ( pUnoClass=PTR_CAST(SbUnoClass,pObj) ) )
{
bObject = pUnoClass->getUnoClass().is();
@@ -2430,14 +2322,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 )
{
@@ -2519,12 +2411,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 );
}
@@ -2664,7 +2556,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();
@@ -2672,22 +2564,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;
}
@@ -2699,7 +2591,7 @@ RTLFUNC(Dir)
String aPath;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount > 3 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
@@ -2711,7 +2603,6 @@ RTLFUNC(Dir)
if( !pRTLData )
return;
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -2754,7 +2645,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
@@ -2768,7 +2659,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
@@ -2782,7 +2673,6 @@ RTLFUNC(Dir)
}
catch( Exception & )
{
- //StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
@@ -2799,11 +2689,11 @@ RTLFUNC(Dir)
{
if( pRTLData->nCurDirPos == -2 )
{
- aPath = ::rtl::OUString::createFromAscii( "." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "." ));
}
else if( pRTLData->nCurDirPos == -1 )
{
- aPath = ::rtl::OUString::createFromAscii( ".." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".." ));
}
pRTLData->nCurDirPos++;
}
@@ -2838,7 +2728,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 );
}
@@ -2853,90 +2743,7 @@ RTLFUNC(Dir)
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- if ( nParCount >= 2 )
- {
- delete pRTLData->pDir;
- pRTLData->pDir = 0; // wg. Sonderbehandlung Sb_ATTR_VOLUME
- DirEntry aEntry( rPar.Get(1)->GetString() );
- FileStat aStat( aEntry );
- if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE))
- {
- // ah ja, ist nur ein dateiname
- // Pfad abschneiden (wg. VB4)
- rPar.Get(0)->PutString( aEntry.GetName() );
- return;
- }
- USHORT 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;
- if( nFlags & Sb_ATTR_DIRECTORY )
- nMode |= FSYS_KIND_DIR;
- if( nFlags == Sb_ATTR_DIRECTORY )
- nMode = FSYS_KIND_DIR;
- pRTLData->pDir = new Dir( aEntry, (DirEntryKind) nMode );
- pRTLData->nCurDirPos = 0;
- }
- }
-
- if( pRTLData->pDir )
- {
- for( ;; )
- {
- if( pRTLData->nCurDirPos >= pRTLData->pDir->Count() )
- {
- delete pRTLData->pDir;
- pRTLData->pDir = 0;
- aPath.Erase();
- break;
- }
- 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 );
-#else
// TODO: OSL
if ( nParCount >= 2 )
{
@@ -2944,7 +2751,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
@@ -2966,7 +2773,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
@@ -2989,11 +2796,11 @@ RTLFUNC(Dir)
{
if( pRTLData->nCurDirPos == -2 )
{
- aPath = ::rtl::OUString::createFromAscii( "." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "." ));
}
else if( pRTLData->nCurDirPos == -1 )
{
- aPath = ::rtl::OUString::createFromAscii( ".." );
+ aPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".." ));
}
pRTLData->nCurDirPos++;
}
@@ -3033,7 +2840,6 @@ RTLFUNC(Dir)
}
}
rPar.Get(0)->PutString( aPath );
-#endif
}
}
}
@@ -3046,7 +2852,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.
@@ -3063,7 +2869,7 @@ RTLFUNC(GetAttr)
{
if (nRealFlags == FILE_ATTRIBUTE_NORMAL)
nRealFlags = 0;
- nFlags = (INT16) (nRealFlags);
+ nFlags = (sal_Int16) (nRealFlags);
}
else
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
@@ -3074,7 +2880,6 @@ RTLFUNC(GetAttr)
}
#endif
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -3109,12 +2914,11 @@ RTLFUNC(GetAttr)
}
}
else
- // --> UCB
{
DirectoryItem aItem;
- FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
+ DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetString() ), aItem );
FileStatus aFileStatus( FileStatusMask_Attributes | FileStatusMask_Type );
- nRet = aItem.getFileStatus( aFileStatus );
+ aItem.getFileStatus( aFileStatus );
sal_uInt64 nAttributes = aFileStatus.getAttributes();
sal_Bool bReadOnly = (nAttributes & Attribute_ReadOnly) != 0;
@@ -3141,7 +2945,6 @@ RTLFUNC(FileDateTime)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // <-- UCB
String aPath = rPar.Get(1)->GetString();
Time aTime;
Date aDate;
@@ -3163,25 +2966,17 @@ RTLFUNC(FileDateTime)
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- DirEntry aEntry( aPath );
- FileStat aStat( aEntry );
- aTime = Time( aStat.TimeModified() );
- aDate = Date( aStat.DateModified() );
-#else
DirectoryItem aItem;
- FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aPath ), aItem );
+ DirectoryItem::get( getFullPathUNC( aPath ), aItem );
FileStatus aFileStatus( FileStatusMask_ModifyTime );
- nRet = aItem.getFileStatus( aFileStatus );
+ aItem.getFileStatus( aFileStatus );
TimeValue aTimeVal = aFileStatus.getModifyTime();
oslDateTime aDT;
osl_getDateTimeFromTimeValue( &aTimeVal, &aDT );
aTime = Time( aDT.Hours, aDT.Minutes, aDT.Seconds, 10000000*aDT.NanoSeconds );
aDate = Date( aDT.Day, aDT.Month, aDT.Year );
-#endif
}
double fSerial = (double)GetDayDiff( aDate );
@@ -3224,13 +3019,12 @@ RTLFUNC(EOF)
(void)pBasic;
(void)bWrite;
- // AB 08/16/2000: No changes for UCB
+ // No changes for UCB
if ( rPar.Count() != 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nChannel = rPar.Get(1)->GetInteger();
- // nChannel--; // macht MD beim Oeffnen auch nicht
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
@@ -3238,7 +3032,7 @@ RTLFUNC(EOF)
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
- BOOL bIsEof;
+ sal_Bool bIsEof;
SvStream* pSvStrm = pSbStrm->GetStrm();
if ( pSbStrm->IsText() )
{
@@ -3259,8 +3053,7 @@ RTLFUNC(FileAttr)
(void)pBasic;
(void)bWrite;
- // AB 08/16/2000: No changes for UCB
-
+ // No changes for UCB
// #57064 Obwohl diese Funktion nicht mit DirEntry arbeitet, ist sie von
// der Anpassung an virtuelle URLs nich betroffen, da sie nur auf bereits
// geoeffneten Dateien arbeitet und der Name hier keine Rolle spielt.
@@ -3269,8 +3062,7 @@ RTLFUNC(FileAttr)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- INT16 nChannel = rPar.Get(1)->GetInteger();
-// nChannel--;
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
@@ -3278,9 +3070,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
@@ -3292,12 +3084,12 @@ RTLFUNC(Loc)
(void)pBasic;
(void)bWrite;
- // AB 08/16/2000: No changes for UCB
+ // No changes for UCB
if ( rPar.Count() != 2 )
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 )
@@ -3306,7 +3098,7 @@ RTLFUNC(Loc)
return;
}
SvStream* pSvStrm = pSbStrm->GetStrm();
- ULONG nPos;
+ sal_uIntPtr nPos;
if( pSbStrm->IsRandom())
{
short nBlockLen = pSbStrm->GetBlockLen();
@@ -3321,7 +3113,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 );
}
}
@@ -3330,12 +3122,12 @@ RTLFUNC(Lof)
(void)pBasic;
(void)bWrite;
- // AB 08/16/2000: No changes for UCB
+ // No changes for UCB
if ( rPar.Count() != 2 )
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 )
@@ -3344,10 +3136,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 );
}
}
@@ -3357,15 +3149,14 @@ RTLFUNC(Seek)
(void)pBasic;
(void)bWrite;
- // AB 08/16/2000: No changes for UCB
+ // No changes for UCB
int nArgs = (int)rPar.Count();
if ( nArgs < 2 || nArgs > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- INT16 nChannel = rPar.Get(1)->GetInteger();
-// nChannel--;
+ sal_Int16 nChannel = rPar.Get(1)->GetInteger();
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
@@ -3377,15 +3168,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 );
@@ -3395,7 +3186,7 @@ RTLFUNC(Seek)
pSbStrm->SetExpandOnWriteTo( 0 );
if ( pSbStrm->IsRandom() )
nPos *= pSbStrm->GetBlockLen();
- pStrm->Seek( (ULONG)nPos );
+ pStrm->Seek( (sal_uIntPtr)nPos );
pSbStrm->SetExpandOnWriteTo( nPos );
}
}
@@ -3405,7 +3196,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
@@ -3429,11 +3220,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 );
}
@@ -3447,23 +3238,19 @@ RTLFUNC(Rnd)
else
{
double nRand = (double)rand();
- nRand = ( nRand / (double)RAND_MAX );
+ nRand = ( nRand / ((double)RAND_MAX + 1.0));
rPar.Get(0)->PutDouble( nRand );
}
}
-//
-// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = FALSE ]]])
-//
+// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = sal_False ]]])
// WindowStyles (VBA-kompatibel):
// 2 == Minimized
// 3 == Maximized
// 10 == Full-Screen (Textmodus-Anwendungen OS/2, WIN95, WNT)
-//
// !!!HACK der WindowStyle wird im Creator an Application::StartApp
// uebergeben. Format: "xxxx2"
-//
RTLFUNC(Shell)
@@ -3478,7 +3265,7 @@ RTLFUNC(Shell)
return;
}
- ULONG nArgCount = rPar.Count();
+ sal_uIntPtr nArgCount = rPar.Count();
if ( nArgCount < 2 || nArgCount > 5 )
{
rPar.Get(0)->PutLong(0);
@@ -3500,13 +3287,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 )
{
@@ -3520,7 +3307,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 )
@@ -3536,9 +3323,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 )
@@ -3558,7 +3345,7 @@ RTLFUNC(Shell)
}
// #55735 / #72471 Ende
- INT16 nWinStyle = 0;
+ sal_Int16 nWinStyle = 0;
if( nArgCount >= 3 )
{
nWinStyle = rPar.Get(2)->GetInteger();
@@ -3575,7 +3362,7 @@ RTLFUNC(Shell)
break;
}
- BOOL bSync = FALSE;
+ sal_Bool bSync = sal_False;
if( nArgCount >= 5 )
bSync = rPar.Get(4)->GetBool();
if( bSync )
@@ -3588,9 +3375,9 @@ RTLFUNC(Shell)
::rtl::OUString aOUStrProg( rStr.GetBuffer(), rStr.Len() );
::rtl::OUString aOUStrProgUNC = getFullPathUNC( aOUStrProg );
- iter++;
+ ++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 )
@@ -3606,7 +3393,7 @@ RTLFUNC(Shell)
}
oslProcess pApp;
- BOOL bSucc = osl_executeProcess(
+ sal_Bool bSucc = osl_executeProcess(
aOUStrProgUNC.pData,
pParamList,
nParamCount,
@@ -3629,6 +3416,7 @@ RTLFUNC(Shell)
if ( bSucc && SbiRuntime::isVBAEnabled())
{
oslProcessInfo aInfo;
+ aInfo.Size = sizeof(oslProcessInfo);
osl_getProcessInfo( pApp, osl_Process_IDENTIFIER, &aInfo );
nResult = aInfo.Ident;
}
@@ -3650,7 +3438,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 +3488,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 +3564,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 +3587,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 +3613,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 +3640,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 +3692,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 +3722,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 +3749,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 +3789,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 +3799,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 +3815,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 +3826,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 +3848,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 +3871,7 @@ RTLFUNC(QBColor)
(void)pBasic;
(void)bWrite;
- static const INT32 pRGB[] =
+ static const sal_Int32 pRGB[] =
{
0x000000,
0x800000,
@@ -4109,13 +3897,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 +3913,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 +3921,11 @@ 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;
- if( nArgCount == 3 )
- {
- // LCID not supported now
- //nLanguage = rPar.Get(3)->GetInteger();
- }
+ sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
- USHORT nOldLen = aOldStr.Len();
+ sal_uInt16 nOldLen = aOldStr.Len();
if( nOldLen == 0 )
{
// null string,return
@@ -4150,7 +3933,7 @@ RTLFUNC(StrConv)
return;
}
- INT32 nType = 0;
+ sal_Int32 nType = 0;
if ( (nConversion & 0x03) == 3 ) // vbProperCase
{
CharClass& rCharClass = GetCharClass();
@@ -4184,10 +3967,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 +3991,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 +4006,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 +4019,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 +4175,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 +4252,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;
@@ -4487,7 +4270,7 @@ RTLFUNC(MsgBox)
delete pBox;
}
-RTLFUNC(SetAttr) // JSM
+RTLFUNC(SetAttr)
{
(void)pBasic;
(void)bWrite;
@@ -4496,9 +4279,8 @@ 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() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -4517,56 +4299,12 @@ RTLFUNC(SetAttr) // JSM
}
}
}
- else
- // --> UCB
- {
-#ifdef _OLD_FILE_IMPL
- // #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))
- StarBASIC::Error(SbERR_FILE_NOT_FOUND);
- #endif
- #ifdef OS2
- FILESTATUS3 aFileStatus;
- APIRET rc = DosQueryPathInfo(aByteFile.GetBuffer(),1,
- &aFileStatus,sizeof(FILESTATUS3));
- if (!rc)
- {
- if (aFileStatus.attrFile != nFlags)
- {
- aFileStatus.attrFile = nFlags;
- rc = DosSetPathInfo(aFile.GetStr(),1,
- &aFileStatus,sizeof(FILESTATUS3),0);
- if (rc)
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- }
- }
- else
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- #endif
-#else
- // Not implemented
-#endif
- }
}
else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
-RTLFUNC(Reset) // JSM
+RTLFUNC(Reset)
{
(void)pBasic;
(void)bWrite;
@@ -4582,7 +4320,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,9 +4348,8 @@ RTLFUNC(FileExists)
if ( rPar.Count() == 2 )
{
String aStr = rPar.Get(1)->GetString();
- BOOL bExists = FALSE;
+ sal_Bool bExists = sal_False;
- // <-- UCB
if( hasUno() )
{
com::sun::star::uno::Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
@@ -4629,16 +4366,10 @@ RTLFUNC(FileExists)
}
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- DirEntry aEntry( aStr );
- bExists = aEntry.Exists();
-#else
DirectoryItem aItem;
FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem );
bExists = (nRet == FileBase::E_None);
-#endif
}
rPar.Get(0)->PutBool( bExists );
}
@@ -4657,10 +4388,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 +4408,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 +4425,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 +4443,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 e03833ea18..907a30112a 100644
--- 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
@@ -96,7 +88,7 @@ static Reference< XCalendar > getLocaleCalendar( void )
if( xSMgr.is() )
{
xCalendar = Reference< XCalendar >( xSMgr->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.LocaleCalendar" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleCalendar" )) ), UNO_QUERY );
}
}
@@ -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);
@@ -158,12 +270,12 @@ RTLFUNC(CByte) // JSM
rPar.Get(0)->PutByte(nByte);
}
-RTLFUNC(CCur) // JSM
+RTLFUNC(CCur)
{
(void)pBasic;
(void)bWrite;
- SbxINT64 nCur;
+ sal_Int64 nCur = 0;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
@@ -175,7 +287,7 @@ RTLFUNC(CCur) // JSM
rPar.Get(0)->PutCurrency( nCur );
}
-RTLFUNC(CDec) // JSM
+RTLFUNC(CDec)
{
(void)pBasic;
(void)bWrite;
@@ -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 );
@@ -782,13 +895,6 @@ RTLFUNC(FindObject)
SbxObject* pFindObj = NULL;
if( pFind )
pFindObj = PTR_CAST(SbxObject,pFind);
- /*
- if( !pFindObj )
- {
- StarBASIC::Error( SbERR_VAR_UNDEFINED );
- return;
- }
- */
// Objekt zurueckliefern
SbxVariableRef refVar = rPar.Get(0);
@@ -820,13 +926,6 @@ RTLFUNC(FindPropertyObject)
SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject();
pObj = PTR_CAST(SbxObject,pObjVarObj);
}
- /*
- if( !pObj )
- {
- StarBASIC::Error( SbERR_VAR_UNDEFINED );
- return;
- }
- */
// 2. Parameter ist der Name
String aNameStr = rPar.Get(2)->GetString();
@@ -849,12 +948,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 +962,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,22 +974,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:
- case SbxLONG64:
- case SbxULONG64:
if( bIsVariant )
- *pStrm << (USHORT)SbxLONG; // VarType Id
+ *pStrm << (sal_uInt16)SbxLONG; // VarType Id
*pStrm << rVar.GetLong();
break;
-
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ if( bIsVariant )
+ *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;
@@ -898,7 +1000,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;
@@ -909,9 +1011,8 @@ 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;
}
else
{
@@ -919,38 +1020,37 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
// What does that mean for Unicode?! Choosing conversion to ByteString...
ByteString aByteStr( rStr, gsl_getSystemTextEncoding() );
*pStrm << (const char*)aByteStr.GetBuffer();
- //*pStrm << (const char*)rStr.GetStr();
}
}
break;
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;
}
@@ -961,7 +1061,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxCHAR:
case SbxBYTE:
{
- BYTE aByte;
+ sal_uInt8 aByte;
*pStrm >> aByte;
rVar.PutByte( aByte );
}
@@ -975,7 +1075,7 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxINT:
case SbxUINT:
{
- INT16 aInt;
+ sal_Int16 aInt;
*pStrm >> aInt;
rVar.PutInteger( aInt );
}
@@ -983,15 +1083,20 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxLONG:
case SbxULONG:
- case SbxLONG64:
- case SbxULONG64:
{
- INT32 aInt;
+ sal_Int32 aInt;
*pStrm >> aInt;
rVar.PutLong( aInt );
}
break;
-
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ {
+ sal_uInt32 aInt;
+ *pStrm >> aInt;
+ rVar.PutInt64( (sal_Int64)aInt );
+ }
+ break;
case SbxSINGLE:
{
float nS;
@@ -1026,23 +1131,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;
@@ -1051,19 +1156,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 )
@@ -1071,9 +1176,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 ) )
{
@@ -1091,7 +1196,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 )
@@ -1103,7 +1208,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 );
}
@@ -1115,11 +1220,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);
@@ -1130,9 +1235,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 );
@@ -1143,7 +1248,7 @@ RTLFUNC(Put)
(void)pBasic;
(void)bWrite;
- PutGet( rPar, TRUE );
+ PutGet( rPar, sal_True );
}
RTLFUNC(Get)
@@ -1151,7 +1256,7 @@ RTLFUNC(Get)
(void)pBasic;
(void)bWrite;
- PutGet( rPar, FALSE );
+ PutGet( rPar, sal_False );
}
RTLFUNC(Environ)
@@ -1166,46 +1271,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 );
@@ -1238,7 +1318,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)
@@ -1251,7 +1331,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()));
}
@@ -1302,8 +1382,6 @@ RTLFUNC(ResolvePath)
{
String aStr = rPar.Get(1)->GetString();
DirEntry aEntry( aStr );
- //if( aEntry.IsVirtual() )
- //aStr = aEntry.GetRealPathFromVirtualURL();
rPar.Get(0)->PutString( aStr );
}
else
@@ -1320,7 +1398,7 @@ RTLFUNC(TypeLen)
else
{
SbxDataType eType = rPar.Get(1)->GetType();
- INT16 nLen = 0;
+ sal_Int16 nLen = 0;
switch( eType )
{
case SbxEMPTY:
@@ -1354,8 +1432,8 @@ RTLFUNC(TypeLen)
case SbxDOUBLE:
case SbxCURRENCY:
case SbxDATE:
- case SbxLONG64:
- case SbxULONG64:
+ case SbxSALINT64:
+ case SbxSALUINT64:
nLen = 8;
break;
@@ -1375,7 +1453,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:
@@ -1474,7 +1552,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)
{
@@ -1547,13 +1625,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 );
@@ -1594,7 +1678,7 @@ RTLFUNC(Split)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if ( nParCount < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1612,7 +1696,7 @@ RTLFUNC(Split)
else
aDelim = String::CreateFromAscii( " " );
- INT32 nCount = -1;
+ sal_Int32 nCount = -1;
if( nParCount == 4 )
nCount = rPar.Get(3)->GetLong();
@@ -1666,7 +1750,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 );
@@ -1679,7 +1763,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 );
@@ -1695,14 +1779,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();
@@ -1719,7 +1803,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 );
@@ -1734,9 +1818,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();
@@ -1747,7 +1831,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 )
@@ -1756,7 +1840,7 @@ RTLFUNC(WeekdayName)
return;
}
- BOOL bAbbreviate = false;
+ sal_Bool bAbbreviate = false;
if( nParCount >= 3 )
{
SbxVariable* pPar2 = rPar.Get(2);
@@ -1771,16 +1855,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
@@ -1800,7 +1884,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;
}
@@ -1812,7 +1896,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
@@ -1820,13 +1904,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 );
}
}
@@ -1880,7 +1964,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 ) )
@@ -1891,30 +1975,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)
@@ -1922,7 +2006,7 @@ RTLFUNC(DateAdd)
(void)pBasic;
(void)bWrite;
- USHORT nParCount = rPar.Count();
+ sal_uInt16 nParCount = rPar.Count();
if( nParCount != 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1937,7 +2021,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 )
@@ -1950,15 +2034,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 );
@@ -1970,20 +2054,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;
@@ -1992,7 +2076,7 @@ RTLFUNC(DateAdd)
nTargetMonth += 12;
nYearsAdd++;
}
- nTargetYear = (INT32)nYear - nYearsAdd;
+ nTargetYear = (sal_Int32)nYear - nYearsAdd;
}
else
{
@@ -2002,7 +2086,7 @@ RTLFUNC(DateAdd)
nTargetMonth -= 12;
nYearsAdd++;
}
- nTargetYear = (INT32)nYear + nYearsAdd;
+ nTargetYear = (sal_Int32)nYear + nYearsAdd;
}
nTargetYear16 = limitToINT16( nTargetYear );
bOk = implDateSerial( nTargetYear16, nTargetMonth, nDay, dNewDate );
@@ -2014,14 +2098,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--;
@@ -2047,7 +2131,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 );
@@ -2070,30 +2154,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;
}
@@ -2112,7 +2196,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();
@@ -2129,17 +2213,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;
@@ -2174,7 +2258,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 )
@@ -2200,9 +2284,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();
@@ -2225,14 +2309,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;
}
@@ -2247,7 +2331,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 );
@@ -2264,7 +2348,7 @@ RTLFUNC(DatePart)
double dDate = rPar.Get(2)->GetDate();
- INT32 nRet = 0;
+ sal_Int32 nRet = 0;
switch( pInfo->meInterval )
{
case INTERVAL_YYYY:
@@ -2284,10 +2368,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:
@@ -2298,7 +2382,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();
@@ -2309,15 +2393,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 )
@@ -2337,7 +2421,7 @@ RTLFUNC(DatePart)
// Calculate week
double dDiff = dDate - dYearFirstDay;
- nRet = 1 + INT32( dDiff / 7 );
+ nRet = 1 + sal_Int32( dDiff / 7 );
}
break;
}
@@ -2368,7 +2452,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 );
@@ -2376,7 +2460,7 @@ RTLFUNC(FormatDateTime)
}
double dDate = rPar.Get(1)->GetDate();
- INT16 nNamedFormat = 0;
+ sal_Int16 nNamedFormat = 0;
if( nParCount > 2 )
{
nNamedFormat = rPar.Get(2)->GetInteger();
@@ -2426,7 +2510,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 );
@@ -2438,7 +2522,6 @@ RTLFUNC(FormatDateTime)
// ShortDate: Display a date using the short date format specified
// in your computer's regional settings.
- // 12/21/2004
// 21.12.2004
case 2:
pSbxVar->PutDate( floor(dDate) );
@@ -2471,7 +2554,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 );
@@ -2490,7 +2573,7 @@ RTLFUNC(Round)
dVal = -dVal;
}
- INT16 numdecimalplaces = 0;
+ sal_Int16 numdecimalplaces = 0;
if( nParCount == 3 )
{
numdecimalplaces = rPar.Get(2)->GetInteger();
@@ -2530,7 +2613,7 @@ void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUStri
Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
if( xFactory.is() )
{
- xFunc.set( xFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
+ xFunc.set( xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FunctionAccess"))), UNO_QUERY_THROW);
}
}
Any aRet = xFunc->callFunction( sFuncName, aArgs );
@@ -2549,7 +2632,7 @@ RTLFUNC(SYD)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 )
{
@@ -2573,7 +2656,7 @@ RTLFUNC(SLN)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 )
{
@@ -2596,7 +2679,7 @@ RTLFUNC(Pmt)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2641,7 +2724,7 @@ RTLFUNC(PPmt)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 || nArgCount > 6 )
{
@@ -2688,7 +2771,7 @@ RTLFUNC(PV)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2733,7 +2816,7 @@ RTLFUNC(NPV)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 1 || nArgCount > 2 )
{
@@ -2761,7 +2844,7 @@ RTLFUNC(NPer)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2806,7 +2889,7 @@ RTLFUNC(MIRR)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 )
{
@@ -2837,7 +2920,7 @@ RTLFUNC(IRR)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 1 || nArgCount > 2 )
{
@@ -2874,7 +2957,7 @@ RTLFUNC(IPmt)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 || nArgCount > 6 )
{
@@ -2921,7 +3004,7 @@ RTLFUNC(FV)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 5 )
{
@@ -2966,7 +3049,7 @@ RTLFUNC(DDB)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 4 || nArgCount > 5 )
{
@@ -3005,7 +3088,7 @@ RTLFUNC(Rate)
(void)pBasic;
(void)bWrite;
- ULONG nArgCount = rPar.Count()-1;
+ sal_uLong nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 6 )
{
@@ -3088,7 +3171,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 );
@@ -3115,8 +3198,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 );
@@ -3139,7 +3222,6 @@ RTLFUNC(Input)
rPar.Get(0)->PutString( String( aByteBuffer, gsl_getSystemTextEncoding() ) );
}
-// #115824
RTLFUNC(Me)
{
(void)pBasic;
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 44f87c16fb..fe660cd291 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -33,10 +33,11 @@
#include "stdobj.hxx"
#include "rtlproto.hxx"
#include "errobject.hxx"
+#include "basegfx/numeric/ftools.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 +61,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 +75,7 @@ RTLFUNC(False)
(void)pBasic;
(void)bWrite;
- rPar.Get(0)->PutBool( FALSE );
+ rPar.Get(0)->PutBool( sal_False );
}
RTLFUNC(Empty)
@@ -115,7 +116,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 10b866c827..7258a7d2d4 100644
--- 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
@@ -357,9 +359,14 @@ extern RTLFUNC(CDateToIso);
extern RTLFUNC(CDateFromIso);
extern RTLFUNC(CompatibilityMode);
extern RTLFUNC(CDec);
+extern RTLFUNC(CaptureAssertions);
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 450388b7e8..7178492a92 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -45,7 +45,8 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include "sbunoobj.hxx"
#include "errobject.hxx"
-#include "sbtrace.hxx"
+
+#include "comenumwrapper.hxx"
SbxVariable* getDefaultProp( SbxVariable* pRef );
@@ -61,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 )
{
@@ -75,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;
}
@@ -222,9 +223,7 @@ SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// Alle Opcodes mit zwei Operanden
};
-//////////////////////////////////////////////////////////////////////////
// SbiRTLData //
-//////////////////////////////////////////////////////////////////////////
SbiRTLData::SbiRTLData()
{
@@ -241,9 +240,7 @@ SbiRTLData::~SbiRTLData()
delete pWildCard;
}
-//////////////////////////////////////////////////////////////////////////
// SbiInstance //
-//////////////////////////////////////////////////////////////////////////
// 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
// Die Entscheidung, ob StepPoint aufgerufen werden soll, wird anhand des
@@ -255,12 +252,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:
@@ -293,8 +290,8 @@ SbiInstance::SbiInstance( StarBASIC* p )
nBreakCallLvl = 0;
nErr =
nErl = 0;
- bReschedule = TRUE;
- bCompatibility = FALSE;
+ bReschedule = sal_True;
+ bCompatibility = sal_False;
}
SbiInstance::~SbiInstance()
@@ -325,7 +322,7 @@ SbiInstance::~SbiInstance()
}
catch( const Exception& )
{
- DBG_ERROR( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" );
+ OSL_FAIL( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" );
}
ComponentVector.clear();
@@ -452,7 +449,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
@@ -466,7 +463,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
@@ -517,7 +514,7 @@ SbModule* SbiInstance::GetActiveModule()
return NULL;
}
-SbMethod* SbiInstance::GetCaller( USHORT nLevel )
+SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel )
{
SbiRuntime* p = pRun;
while( nLevel-- && p )
@@ -539,13 +536,11 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
return NULL;
}
-//////////////////////////////////////////////////////////////////////////
// SbiInstance //
-//////////////////////////////////////////////////////////////////////////
// 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)
{
@@ -560,11 +555,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;
@@ -624,10 +619,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;
@@ -635,9 +630,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;
@@ -655,16 +650,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 )
{
@@ -710,7 +705,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
// Einen P-Code ausfuehren
-BOOL SbiRuntime::Step()
+sal_Bool SbiRuntime::Step()
{
if( bRun )
{
@@ -732,13 +727,8 @@ BOOL SbiRuntime::Step()
Application::Reschedule();
}
-#ifdef DBG_TRACE_BASIC
- UINT32 nPC = ( pCode - (const BYTE* )pImg->GetCode() );
- dbg_traceStep( pMod, nPC, pINST->nCallLvl );
-#endif
-
SbiOpcode eOp = (SbiOpcode ) ( *pCode++ );
- UINT32 nOp1, nOp2;
+ sal_uInt32 nOp1, nOp2;
if( eOp <= SbOP0_END )
{
(this->*( aStep0[ eOp ] ) )();
@@ -773,11 +763,6 @@ BOOL SbiRuntime::Step()
// (insbesondere nicht nach Compiler-Fehlern zur Laufzeit)
if( nError && bRun )
{
-#ifdef DBG_TRACE_BASIC
- SbError nTraceErr = nError;
- String aTraceErrMsg = GetSbData()->aErrMsg;
- bool bTraceErrHandled = true;
-#endif
SbError err = nError;
ClearExprStack();
nError = 0;
@@ -785,7 +770,7 @@ BOOL SbiRuntime::Step()
pInst->nErl = nLine;
pErrCode = pCode;
pErrStmnt = pStmnt;
- // An error occured in an error handler
+ // An error occurred in an error handler
// force parent handler ( if there is one )
// to handle the error
bool bLetParentHandleThis = false;
@@ -793,7 +778,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 );
@@ -818,7 +803,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;
@@ -841,7 +826,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
@@ -858,19 +843,10 @@ BOOL SbiRuntime::Step()
// Kein Error-Hdl gefunden -> altes Vorgehen
else
{
-#ifdef DBG_TRACE_BASIC
- bTraceErrHandled = false;
-#endif
pInst->Abort();
}
- // ALT: Nur
- // pInst->Abort();
}
-
-#ifdef DBG_TRACE_BASIC
- dbg_traceNotifyError( nTraceErr, aTraceErrMsg, bTraceErrHandled, pINST->nCallLvl );
-#endif
}
}
return bRun;
@@ -900,11 +876,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
{
@@ -936,7 +913,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
@@ -946,16 +923,12 @@ 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;
}
-//////////////////////////////////////////////////////////////////////////
-//
// Parameter, Locals, Caller
-//
-//////////////////////////////////////////////////////////////////////////
SbMethod* SbiRuntime::GetCaller()
{
@@ -972,11 +945,7 @@ SbxArray* SbiRuntime::GetParams()
return refParams;
}
-//////////////////////////////////////////////////////////////////////////
-//
// Stacks
-//
-//////////////////////////////////////////////////////////////////////////
// Der Expression-Stack steht fuer die laufende Auswertung von Expressions
// zur Verfuegung.
@@ -999,7 +968,7 @@ SbxVariableRef SbiRuntime::PopVar()
SbxVariableRef xVar = refExprStk->Get( --nExprLvl );
#ifdef DBG_UTIL
if ( xVar->GetName().EqualsAscii( "Cells" ) )
- DBG_TRACE( "" );
+ OSL_TRACE( "" );
#endif
// Methods halten im 0.Parameter sich selbst, also weghauen
if( xVar->IsA( TYPE(SbxMethod) ) )
@@ -1007,7 +976,7 @@ SbxVariableRef SbiRuntime::PopVar()
return xVar;
}
-BOOL SbiRuntime::ClearExprStack()
+sal_Bool SbiRuntime::ClearExprStack()
{
// Achtung: Clear() reicht nicht, da Methods geloescht werden muessen
while ( nExprLvl )
@@ -1015,7 +984,7 @@ BOOL SbiRuntime::ClearExprStack()
PopVar();
}
refExprStk->Clear();
- return FALSE;
+ return sal_False;
}
// Variable auf dem Expression-Stack holen, ohne sie zu entfernen
@@ -1031,7 +1000,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
@@ -1043,7 +1012,7 @@ void SbiRuntime::TOSMakeTemp()
p->Broadcast( SBX_HINT_DATAWANTED );
SbxVariable* pDflt = NULL;
- if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ( pDflt = getDefaultProp( p ) ) )
+ if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ((pDflt = getDefaultProp(p)) != NULL) )
{
pDflt->Broadcast( SBX_HINT_DATAWANTED );
// replacing new p on stack causes object pointed by
@@ -1054,7 +1023,6 @@ void SbiRuntime::TOSMakeTemp()
p = new SbxVariable( *pDflt );
p->SetFlag( SBX_READWRITE );
refExprStk->Put( p, nExprLvl - 1 );
-// return;
}
else if( p->GetRefCount() != 1 )
@@ -1066,7 +1034,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 );
@@ -1203,6 +1171,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;
@@ -1245,18 +1230,14 @@ void SbiRuntime::ClearForStack()
PopFor();
}
-//////////////////////////////////////////////////////////////////////////
-//
// DLL-Aufrufe
-//
-//////////////////////////////////////////////////////////////////////////
void SbiRuntime::DllCall
( const String& aFuncName, // Funktionsname
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() )
@@ -1266,15 +1247,6 @@ void SbiRuntime::DllCall
}
// MUSS NOCH IMPLEMENTIERT WERDEN
- /*
- String aMsg;
- aMsg = "FUNC=";
- aMsg += pFunc;
- aMsg += " DLL=";
- aMsg += pDLL;
- MessBox( NULL, WB_OK, String( "DLL-CALL" ), aMsg ).Execute();
- Error( SbERR_NOT_IMPLEMENTED );
- */
SbxVariable* pRes = new SbxVariable( eResType );
SbiDllMgr* pDllMgr = pInst->GetDllMgr();
@@ -1283,13 +1255,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/sbdiagnose.cxx b/basic/source/runtime/sbdiagnose.cxx
new file mode 100644
index 0000000000..97bfb0a008
--- /dev/null
+++ b/basic/source/runtime/sbdiagnose.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 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 "rtlproto.hxx"
+#include "sbdiagnose.hxx"
+
+#include "basic/sbstar.hxx"
+
+#include <tools/debug.hxx>
+#include <comphelper/flagguard.hxx>
+
+#ifdef DBG_UTIL
+
+static DbgChannelId nRestoreChannelId = 0;
+static DbgChannelId nAssertionChannelId = 0;
+static StarBASICRef xAssertionChannelBasic;
+static String sCaptureFunctionName;
+static bool bReportingAssertion = false;
+
+void ResetCapturedAssertions()
+{
+ if ( nRestoreChannelId != 0 )
+ {
+ DBG_INSTOUTERROR( nRestoreChannelId );
+ }
+ nRestoreChannelId = 0;
+ xAssertionChannelBasic = NULL;
+ sCaptureFunctionName = String();
+ bReportingAssertion = false;
+}
+
+void DbgReportAssertion( const sal_Char* i_assertionMessage )
+{
+ if ( !xAssertionChannelBasic )
+ {
+ ResetCapturedAssertions();
+ return;
+ }
+
+ // prevent infinite recursion
+ if ( bReportingAssertion )
+ return;
+ ::comphelper::FlagRestorationGuard aGuard( bReportingAssertion, true );
+
+ SbxArrayRef const xArguments( new SbxArray( SbxVARIANT ) );
+ SbxVariableRef const xMessageText = new SbxVariable( SbxSTRING );
+ xMessageText->PutString( String::CreateFromAscii( i_assertionMessage ) );
+ xArguments->Put( xMessageText, 1 );
+
+ ErrCode const nError = xAssertionChannelBasic->Call( sCaptureFunctionName, xArguments );
+ if ( ( nError & SbERR_METHOD_NOT_FOUND ) != 0 )
+ ResetCapturedAssertions();
+}
+
+#endif
+
+/// capture assertions, route them to the given given Basic function
+RTLFUNC(CaptureAssertions)
+{
+ (void)bWrite;
+
+ // need exactly one argument
+ if ( rPar.Count() != 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+#ifdef DBG_UTIL
+ DBG_TESTSOLARMUTEX();
+
+ String const sFunctionName = rPar.Get(1)->GetString();
+ if ( sFunctionName.Len() == 0 )
+ {
+ ResetCapturedAssertions();
+ return;
+ }
+
+ if ( nAssertionChannelId == 0 )
+ {
+ // TODO: should we register a named channel at the VCL API, instead of an unnamed channel at the tools API?
+ // A named channel would mean it would appear in the nonpro-debug-options dialog
+ nAssertionChannelId = DbgRegisterUserChannel( &DbgReportAssertion );
+ }
+
+ DbgChannelId const nCurrentChannelId = (DbgChannelId)DbgGetErrorOut();
+ if ( nCurrentChannelId != nAssertionChannelId )
+ {
+ // remember the current channel
+ nRestoreChannelId = nCurrentChannelId;
+
+ // set the new channel
+ DBG_INSTOUTERROR( nAssertionChannelId );
+
+ // ensure OSL assertions are captured, too
+ DbgData aData( *DbgGetData() );
+ aData.bHookOSLAssert = sal_True;
+ DbgUpdateOslHook( &aData );
+ }
+
+ xAssertionChannelBasic = pBasic;
+ sCaptureFunctionName = sFunctionName;
+#else
+ (void)pBasic;
+ (void)rPar;
+ (void)bWrite;
+#endif
+}
+
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 4cf212031d..a15457c1c0 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -35,13 +35,23 @@
#include <sal/macros.h>
#include "rtlproto.hxx"
#include "sbintern.hxx"
-#include <hash_map>
+#include <boost/unordered_map.hpp>
// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
// Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
// benoetigen!
-#define _ARGSMASK 0x007F // Bis zu 127 Argumente
-#define _COMPTMASK 0x0080 // Only valid in compatibility mode
+// previously _ARGSMASK was 0x007F ( e.g. up to 127 args ) however 63 should be
+// enough, if not we need to increase the size of nArgs member in the Methods
+// struct below.
+// note: the limitation of 63 args is only for RTL functions defined here and
+// does NOT impose a limit on User defined procedures ). This changes is to
+// allow us space for a flag to blacklist some functions in vba mode
+
+#define _ARGSMASK 0x003F // 63 Arguments
+#define _COMPTMASK 0x00C0 // COMPATABILITY mask
+#define _COMPATONLY 0x0080 // procedure is visible in vba mode only
+#define _NORMONLY 0x0040 // procedure is visible in normal mode only
+
#define _RWMASK 0x0F00 // Maske fuer R/W-Bits
#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags
@@ -68,7 +78,7 @@ struct Methods {
SbxDataType eType; // Datentyp
short nArgs; // Argumente und Flags
RtlCall pFunc; // Function Pointer
- USHORT nHash; // Hashcode
+ sal_uInt16 nHash; // Hashcode
};
struct StringHashCode
@@ -79,37 +89,6 @@ struct StringHashCode
}
};
-class VBABlacklist
-{
-friend class VBABlackListQuery;
- std::hash_map< String, bool, StringHashCode > mBlackList;
- VBABlacklist()
- {
- const char* list[] = { "Red" };
- sal_Int32 nSize = SAL_N_ELEMENTS( list );
- for ( sal_Int32 index = 0; index < nSize; ++index )
- {
- mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
- }
- }
-public:
- bool isBlackListed( const String& sName )
- {
- String sNameLower( sName );
- sNameLower.ToLowerAscii();
- return ( mBlackList.find( sNameLower ) != mBlackList.end() );
- }
-};
-
-class VBABlackListQuery
-{
-public:
- static bool isBlackListed( const String& sName )
- {
- static VBABlacklist blackList;
- return blackList.isBlackListed( sName );
- }
-};
static Methods aMethods[] = {
{ "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
@@ -119,7 +98,7 @@ static Methods aMethods[] = {
{ "Array", SbxOBJECT, _FUNCTION, RTLNAME(Array),0 },
{ "Asc", SbxLONG, 1 | _FUNCTION, RTLNAME(Asc),0 },
{ "string", SbxSTRING, 0,NULL,0 },
-{ "AscW", SbxLONG, 1 | _FUNCTION | _COMPTMASK, RTLNAME(Asc),0},
+{ "AscW", SbxLONG, 1 | _FUNCTION | _COMPATONLY, RTLNAME(Asc),0},
{ "string", SbxSTRING, 0,NULL,0 },
{ "Atn", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Atn),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
@@ -132,9 +111,13 @@ static Methods aMethods[] = {
{ "ATTR_VOLUME", SbxINTEGER, _CPROP, RTLNAME(ATTR_VOLUME),0 },
{ "Beep", SbxNULL, _FUNCTION, RTLNAME(Beep),0 },
-{ "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 },
+{ "Blue", SbxINTEGER, 1 | _FUNCTION | _NORMONLY, 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 },
@@ -165,7 +148,7 @@ static Methods aMethods[] = {
{ "Chr", SbxSTRING, 1 | _FUNCTION, RTLNAME(Chr),0 },
{ "string", SbxINTEGER, 0,NULL,0 },
-{ "ChrW", SbxSTRING, 1 | _FUNCTION | _COMPTMASK, RTLNAME(Chr),0},
+{ "ChrW", SbxSTRING, 1 | _FUNCTION | _COMPATONLY, RTLNAME(Chr),0},
{ "string", SbxINTEGER, 0,NULL,0 },
{ "CInt", SbxINTEGER, 1 | _FUNCTION, RTLNAME(CInt),0 },
@@ -184,6 +167,8 @@ static Methods aMethods[] = {
{ "number", SbxDOUBLE, 0,NULL,0 },
{ "CreateObject", SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateObject ),0 },
{ "class", SbxSTRING, 0,NULL,0 },
+{ "CaptureAssertions", SbxNULL, 1 | _FUNCTION, RTLNAME(CaptureAssertions), 0 },
+ { "methodName", SbxSTRING, 0, NULL, 0 },
{ "CreateUnoListener",SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateUnoListener ),0 },
{ "prefix", SbxSTRING, 0,NULL,0 },
{ "typename", SbxSTRING, 0,NULL,0 },
@@ -212,7 +197,7 @@ static Methods aMethods[] = {
{ "expression", SbxVARIANT, 0,NULL,0 },
{ "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr),0 },
{ "expression", SbxVARIANT, 0,NULL,0 },
-{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(DDB),0 },
+{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPATONLY, RTLNAME(DDB),0 },
{ "Cost", SbxDOUBLE, 0, NULL,0 },
{ "Salvage", SbxDOUBLE, 0, NULL,0 },
{ "Life", SbxDOUBLE, 0, NULL,0 },
@@ -307,7 +292,7 @@ static Methods aMethods[] = {
{ "Format", SbxSTRING, 2 | _FUNCTION, RTLNAME(Format),0 },
{ "expression", SbxVARIANT, 0,NULL,0 },
{ "format", SbxSTRING, _OPT, NULL,0 },
-{ "FormatDateTime", SbxSTRING, 2 | _FUNCTION | _COMPTMASK, RTLNAME(FormatDateTime),0 },
+{ "FormatDateTime", SbxSTRING, 2 | _FUNCTION | _COMPATONLY, RTLNAME(FormatDateTime),0 },
{ "Date", SbxDATE, 0,NULL,0 },
{ "NamedFormat", SbxINTEGER, _OPT, NULL,0 },
{ "FRAMEANCHORCHAR", SbxINTEGER, _CPROP, RTLNAME(FRAMEANCHORCHAR),0 },
@@ -317,7 +302,7 @@ static Methods aMethods[] = {
{ "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
{ "Modulename", SbxSTRING, 0,NULL,0 },
-{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPATONLY, RTLNAME(FV),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "NPer", SbxDOUBLE, 0, NULL,0 },
{ "Pmt", SbxDOUBLE, 0, NULL,0 },
@@ -340,7 +325,7 @@ static Methods aMethods[] = {
{ "GetSystemTicks", SbxLONG, _FUNCTION,RTLNAME(GetSystemTicks),0 },
{ "GetSystemType", SbxINTEGER, _FUNCTION,RTLNAME(GetSystemType),0 },
{ "GlobalScope", SbxOBJECT, _FUNCTION,RTLNAME(GlobalScope),0 },
-{ "Green", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Green),0 },
+{ "Green", SbxINTEGER, 1 | _FUNCTION | _NORMONLY, RTLNAME(Green),0 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
{ "HasUnoInterfaces", SbxBOOL, 1 | _FUNCTION, RTLNAME(HasUnoInterfaces),0},
@@ -362,7 +347,7 @@ static Methods aMethods[] = {
{ "Variant1", SbxVARIANT, 0,NULL,0 },
{ "Variant2", SbxVARIANT, 0,NULL,0 },
-{ "Input", SbxSTRING, 2 | _FUNCTION | _COMPTMASK, RTLNAME(Input),0},
+{ "Input", SbxSTRING, 2 | _FUNCTION | _COMPATONLY, RTLNAME(Input),0},
{ "Number", SbxLONG, 0,NULL,0 },
{ "FileNumber", SbxLONG, 0,NULL,0 },
{ "InputBox", SbxSTRING, 5 | _FUNCTION, RTLNAME(InputBox),0 },
@@ -376,21 +361,21 @@ static Methods aMethods[] = {
{ "String1", SbxSTRING, 0,NULL,0 },
{ "String2", SbxSTRING, 0,NULL,0 },
{ "Compare", SbxINTEGER, _OPT, NULL,0 },
-{ "InStrRev", SbxLONG, 4 | _FUNCTION | _COMPTMASK, RTLNAME(InStrRev),0},
+{ "InStrRev", SbxLONG, 4 | _FUNCTION | _COMPATONLY, RTLNAME(InStrRev),0},
{ "String1", SbxSTRING, 0,NULL,0 },
{ "String2", SbxSTRING, 0,NULL,0 },
{ "Start", SbxSTRING, _OPT, NULL,0 },
{ "Compare", SbxINTEGER, _OPT, NULL,0 },
{ "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
-{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(IPmt),0 },
+{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPATONLY, RTLNAME(IPmt),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "Per", SbxDOUBLE, 0, NULL,0 },
{ "NPer", SbxDOUBLE, 0, NULL,0 },
{ "PV", SbxDOUBLE, 0, NULL,0 },
{ "FV", SbxVARIANT, _OPT, NULL,0 },
{ "Due", SbxVARIANT, _OPT, NULL,0 },
-{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(IRR),0 },
+{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPATONLY, RTLNAME(IRR),0 },
{ "ValueArray", SbxARRAY, 0, NULL,0 },
{ "Guess", SbxVARIANT, _OPT, NULL,0 },
{ "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
@@ -456,14 +441,14 @@ static Methods aMethods[] = {
{ "MB_YESNO", SbxINTEGER, _CPROP, RTLNAME(MB_YESNO),0 },
{ "MB_YESNOCANCEL", SbxINTEGER, _CPROP, RTLNAME(MB_YESNOCANCEL),0 },
-{ "Me", SbxOBJECT, 0 | _FUNCTION | _COMPTMASK, RTLNAME(Me),0 },
+{ "Me", SbxOBJECT, 0 | _FUNCTION | _COMPATONLY, RTLNAME(Me),0 },
{ "Mid", SbxSTRING, 3 | _LFUNCTION,RTLNAME(Mid),0 },
{ "String", SbxSTRING, 0,NULL,0 },
{ "StartPos", SbxLONG, 0,NULL,0 },
{ "Length", SbxLONG, _OPT, NULL,0 },
{ "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute),0 },
{ "Date", SbxDATE, 0,NULL,0 },
-{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MIRR),0 },
+{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPATONLY, RTLNAME(MIRR),0 },
{ "ValueArray", SbxARRAY, 0, NULL,0 },
{ "FinanceRate", SbxDOUBLE, 0, NULL,0 },
{ "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
@@ -471,7 +456,7 @@ static Methods aMethods[] = {
{ "pathname", SbxSTRING, 0,NULL,0 },
{ "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
{ "Date", SbxDATE, 0,NULL,0 },
-{ "MonthName", SbxSTRING, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MonthName),0 },
+{ "MonthName", SbxSTRING, 2 | _FUNCTION | _COMPATONLY, RTLNAME(MonthName),0 },
{ "Month", SbxINTEGER, 0,NULL,0 },
{ "Abbreviate", SbxBOOL, _OPT, NULL,0 },
{ "MsgBox", SbxINTEGER, 5 | _FUNCTION, RTLNAME(MsgBox),0 },
@@ -483,13 +468,13 @@ static Methods aMethods[] = {
{ "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
{ "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
-{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(NPer),0 },
+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPATONLY, RTLNAME(NPer),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "Pmt", SbxDOUBLE, 0, NULL,0 },
{ "PV", SbxDOUBLE, 0, NULL,0 },
{ "FV", SbxVARIANT, _OPT, NULL,0 },
{ "Due", SbxVARIANT, _OPT, NULL,0 },
-{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(NPV),0 },
+{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPATONLY, RTLNAME(NPV),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "ValueArray", SbxARRAY, 0, NULL,0 },
{ "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
@@ -504,14 +489,14 @@ static Methods aMethods[] = {
{ "interval", SbxLONG, 0,NULL,0 },
{ "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
-{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(Pmt),0 },
+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPATONLY, RTLNAME(Pmt),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "NPer", SbxDOUBLE, 0, NULL,0 },
{ "PV", SbxDOUBLE, 0, NULL,0 },
{ "FV", SbxVARIANT, _OPT, NULL,0 },
{ "Due", SbxVARIANT, _OPT, NULL,0 },
-{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(PPmt),0 },
+{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPATONLY, RTLNAME(PPmt),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "Per", SbxDOUBLE, 0, NULL,0 },
{ "NPer", SbxDOUBLE, 0, NULL,0 },
@@ -524,7 +509,7 @@ static Methods aMethods[] = {
{ "recordnumber", SbxLONG, 0,NULL,0 },
{ "variablename", SbxVARIANT, 0,NULL,0 },
-{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPATONLY, RTLNAME(PV),0 },
{ "Rate", SbxDOUBLE, 0, NULL,0 },
{ "NPer", SbxDOUBLE, 0, NULL,0 },
{ "Pmt", SbxDOUBLE, 0, NULL,0 },
@@ -536,14 +521,14 @@ static Methods aMethods[] = {
{ "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
{ "Number", SbxDOUBLE, _OPT, NULL,0 },
-{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(Rate),0 },
+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPATONLY, RTLNAME(Rate),0 },
{ "NPer", SbxDOUBLE, 0, NULL,0 },
{ "Pmt", SbxDOUBLE, 0, NULL,0 },
{ "PV", SbxDOUBLE, 0, NULL,0 },
{ "FV", SbxVARIANT, _OPT, NULL,0 },
{ "Due", SbxVARIANT, _OPT, NULL,0 },
{ "Guess", SbxVARIANT, _OPT, NULL,0 },
-{ "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red),0 },
+{ "Red", SbxINTEGER, 1 | _FUNCTION | _NORMONLY, RTLNAME(Red),0 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
{ "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
{ "ResolvePath", SbxSTRING, 1 | _FUNCTION, RTLNAME(ResolvePath),0 },
@@ -564,12 +549,12 @@ static Methods aMethods[] = {
{ "Count", SbxLONG, 0,NULL,0 },
{ "RmDir", SbxNULL, 1 | _FUNCTION, RTLNAME(RmDir),0 },
{ "pathname", SbxSTRING, 0,NULL,0 },
-{ "Round", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(Round),0},
+{ "Round", SbxDOUBLE, 2 | _FUNCTION | _COMPATONLY, RTLNAME(Round),0},
{ "Expression", SbxDOUBLE, 0,NULL,0 },
{ "Numdecimalplaces", SbxINTEGER, _OPT, NULL,0 },
{ "Rnd", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Rnd),0 },
{ "Number", SbxDOUBLE, _OPT, NULL,0 },
-{ "RTL", SbxOBJECT, 0 | _FUNCTION | _COMPTMASK, RTLNAME(RTL),0},
+{ "RTL", SbxOBJECT, 0 | _FUNCTION | _COMPATONLY, RTLNAME(RTL),0},
{ "RTrim", SbxSTRING, 1 | _FUNCTION, RTLNAME(RTrim),0 },
{ "string", SbxSTRING, 0,NULL,0 },
@@ -596,11 +581,11 @@ static Methods aMethods[] = {
{ "WindowStyle", SbxINTEGER, _OPT, NULL,0 },
{ "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
-{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SLN),0 },
+{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPATONLY, RTLNAME(SLN),0 },
{ "Cost", SbxDOUBLE, 0,NULL,0 },
{ "Double", SbxDOUBLE, 0,NULL,0 },
{ "Life", SbxDOUBLE, 0,NULL,0 },
-{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPATONLY, RTLNAME(SYD),0 },
{ "Cost", SbxDOUBLE, 0,NULL,0 },
{ "Salvage", SbxDOUBLE, 0,NULL,0 },
{ "Life", SbxDOUBLE, 0,NULL,0 },
@@ -628,7 +613,7 @@ static Methods aMethods[] = {
{ "String", SbxSTRING, 2 | _FUNCTION, RTLNAME(String),0 },
{ "Count", SbxLONG, 0,NULL,0 },
{ "Filler", SbxVARIANT, 0,NULL,0 },
-{ "StrReverse", SbxSTRING, 1 | _FUNCTION | _COMPTMASK, RTLNAME(StrReverse),0 },
+{ "StrReverse", SbxSTRING, 1 | _FUNCTION | _COMPATONLY, RTLNAME(StrReverse),0 },
{ "String1", SbxSTRING, 0,NULL,0 },
{ "Switch", SbxVARIANT, 2 | _FUNCTION, RTLNAME(Switch),0 },
{ "Expression", SbxVARIANT, 0,NULL,0 },
@@ -645,6 +630,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 },
@@ -726,7 +715,7 @@ static Methods aMethods[] = {
{ "Weekday", SbxINTEGER, 2 | _FUNCTION, RTLNAME(Weekday),0 },
{ "Date", SbxDATE, 0,NULL,0 },
{ "Firstdayofweek", SbxINTEGER, _OPT, NULL,0 },
-{ "WeekdayName", SbxSTRING, 3 | _FUNCTION | _COMPTMASK, RTLNAME(WeekdayName),0 },
+{ "WeekdayName", SbxSTRING, 3 | _FUNCTION | _COMPATONLY, RTLNAME(WeekdayName),0 },
{ "Weekday", SbxINTEGER, 0,NULL,0 },
{ "Abbreviate", SbxBOOL, _OPT, NULL,0 },
{ "Firstdayofweek", SbxINTEGER, _OPT, NULL,0 },
@@ -780,11 +769,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 +788,12 @@ 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;
+ if ( !pInst || ( pInst->IsCompatibility() && ( _NORMONLY & p->nArgs ) ) || ( !pInst->IsCompatibility() && ( _COMPATONLY & p->nArgs ) ) )
+ bFound = sal_False;
}
- if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
- bFound = FALSE;
break;
}
nIndex += ( p->nArgs & _ARGSMASK ) + 1;
@@ -834,8 +821,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 +837,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;
@@ -887,15 +874,13 @@ SbxInfo* SbiStdObject::GetInfo( short nIdx )
if( !nIdx )
return NULL;
Methods* p = &aMethods[ --nIdx ];
- // Wenn mal eine Hilfedatei zur Verfuegung steht:
- // SbxInfo* pInfo_ = new SbxInfo( Hilfedateiname, p->nHelpId );
SbxInfo* pInfo_ = new SbxInfo;
short nPar = p->nArgs & _ARGSMASK;
for( short i = 0; i < nPar; i++ )
{
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 58f2c047d8..f54def9a7c 100644
--- 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 )
@@ -313,43 +313,8 @@ void SbStdFont::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
//-----------------------------------------------------------------------------
-/*
-class TransferableHelperImpl : public TransferableHelper
-{
- SotFormatStringId mFormat;
- String mString;
- Graphic mGraphic;
-
- virtual void AddSupportedFormats();
- virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
-
-public:
- TransferableHelperImpl( void ) { mFormat = 0; }
- TransferableHelperImpl( const String& rStr )
- mFormat( FORMAT_STRING ), mString( rStr ) {}
- TransferableHelperImpl( const Graphic& rGraphic );
- mFormat( FORMAT_BITMAP ), mGraphic( rGraphic ) {}
-
-};
-
-void TransferableHelperImpl::AddSupportedFormats()
-{
-}
-sal_Bool TransferableHelperImpl::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
-{
- sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
- if( nFormat == FORMAT_STRING )
- {
- }
- else if( nFormat == FORMAT_BITMAP ||
- nFormat == FORMAT_GDIMETAFILE )
- {
- }
-}
-*/
-
-void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, sal_Bool )
{
if( pPar_ && (pPar_->Count() > 1) )
{
@@ -357,10 +322,9 @@ void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar_, BOOL )
return;
}
- //Clipboard::Clear();
}
-void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
(void)pVar;
@@ -370,30 +334,16 @@ 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 );
return;
}
- /*
- if( nFormat == FORMAT_STRING )
- pVar->PutString( Clipboard::PasteString() );
- else
- if( (nFormat == FORMAT_BITMAP) ||
- (nFormat == FORMAT_GDIMETAFILE ) )
- {
- SbxObjectRef xPic = new SbStdPicture;
- Graphic aGraph;
- aGraph.Paste();
- ((SbStdPicture*)(SbxObject*)xPic)->SetGraphic( aGraph );
- pVar->PutObject( xPic );
- }
- */
}
-void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
if( !pPar_ || (pPar_->Count() != 2) )
{
@@ -401,18 +351,17 @@ 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( Clipboard::HasFormat( nFormat ) );
+ pVar->PutBool( sal_False );
}
-void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
if( pPar_ && (pPar_->Count() > 1) )
{
@@ -421,10 +370,9 @@ void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
}
pVar->PutString( String() );
- //pVar->PutString( Clipboard::PasteString() );
}
-void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
(void)pVar;
@@ -434,31 +382,16 @@ 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 );
return;
}
- /*
- if( nFormat == FORMAT_STRING )
- {
- Clipboard::CopyString( pPar_->Get(1)->GetString() );
- }
- else
- if( (nFormat == FORMAT_BITMAP) ||
- (nFormat == FORMAT_GDIMETAFILE) )
- {
- SbxObject* pObj = (SbxObject*)pPar_->Get(1)->GetObject();
-
- if( pObj && pObj->IsA( TYPE( SbStdPicture ) ) )
- ((SbStdPicture*)(SbxObject*)pObj)->GetGraphic().Copy();
- }
- */
}
-void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
+void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
(void)pVar;
@@ -468,7 +401,6 @@ void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar_, BOOL )
return;
}
- // Clipboard::CopyString( pPar_->Get(1)->GetString() );
}
@@ -531,8 +463,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 7503832cc2..a9dddab134 100644
--- 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
@@ -443,7 +477,6 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// Check value, !object is no error for sure if, only if type is fixed
SbxDataType eValType = refVal->GetType();
-// bool bGetValObject = false;
if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() )
{
Error( SbERR_INVALID_USAGE_OBJECT );
@@ -478,11 +511,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 +564,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 +588,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 +598,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
@@ -588,7 +689,6 @@ void SbiRuntime::StepVBASET()
}
-// JSM 07.10.95
void SbiRuntime::StepLSET()
{
SbxVariableRef refVal = PopVar();
@@ -599,14 +699,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 )
{
@@ -624,7 +724,6 @@ void SbiRuntime::StepLSET()
}
}
-// JSM 07.10.95
void SbiRuntime::StepRSET()
{
SbxVariableRef refVal = PopVar();
@@ -635,14 +734,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,' ');
@@ -700,13 +799,13 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
{
SbxDataType eType = refVar->IsFixed() ? refVar->GetType() : SbxVARIANT;
SbxDimArray* pArray = new SbxDimArray( eType );
- // AB 2.4.1996, auch Arrays ohne Dimensionsangaben zulassen (VB-komp.)
+ // 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 +819,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 +881,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 +890,7 @@ void SbiRuntime::StepREDIMP()
if( nDimsOld != nDimsNew )
{
- bRangeError = TRUE;
+ bRangeError = sal_True;
}
else
{
@@ -802,27 +901,11 @@ void SbiRuntime::StepREDIMP()
sal_Int32 lBoundOld, uBoundOld;
pNewArray->GetDim32( i, lBoundNew, uBoundNew );
pOldArray->GetDim32( i, lBoundOld, uBoundOld );
-
- /* #69094 Allow all dimensions to be changed
- although Visual Basic is not able to do so.
- // All bounds but the last have to be the same
- if( i < nDims && ( lBoundNew != lBoundOld || uBoundNew != uBoundOld ) )
- {
- bRangeError = TRUE;
- break;
- }
- else
- */
- {
- // #69094: if( i == nDims )
- {
- lBoundNew = std::max( lBoundNew, lBoundOld );
- uBoundNew = std::min( uBoundNew, uBoundOld );
- }
- short j = i - 1;
- pActualIndices[j] = pLowerBounds[j] = lBoundNew;
- pUpperBounds[j] = uBoundNew;
- }
+ lBoundNew = std::max( lBoundNew, lBoundOld );
+ uBoundNew = std::min( uBoundNew, uBoundOld );
+ short j = i - 1;
+ pActualIndices[j] = pLowerBounds[j] = lBoundNew;
+ pUpperBounds[j] = uBoundNew;
}
}
@@ -846,7 +929,6 @@ void SbiRuntime::StepREDIMP()
}
}
- //StarBASIC::FatalError( SbERR_NOT_IMPLEMENTED );
}
// REDIM_COPY
@@ -877,7 +959,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 );
@@ -913,7 +995,6 @@ void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled )
}
}
else
- // AB 2.4.1996
// Arrays haben bei Erase nach VB ein recht komplexes Verhalten. Hier
// werden zunaechst nur die Typ-Probleme bei REDIM (#26295) beseitigt:
// Typ hart auf den Array-Typ setzen, da eine Variable mit Array
@@ -986,7 +1067,6 @@ void SbiRuntime::StepARGV()
SbxVariableRef pVal = PopVar();
// Before fix of #94916:
- // if( pVal->ISA(SbxMethod) || pVal->ISA(SbxProperty) )
if( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) )
{
// Methoden und Properties evaluieren!
@@ -1046,7 +1126,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();
@@ -1082,11 +1162,6 @@ void SbiRuntime::StepINPUT()
BasResId aId( IDS_SBERR_START + 4 );
String aMsg( aId );
- //****** DONT CHECK IN, TEST ONLY *******
- //****** DONT CHECK IN, TEST ONLY *******
- // ErrorBox( NULL, WB_OK, aMsg ).Execute();
- //****** DONT CHECK IN, TEST ONLY *******
- //****** DONT CHECK IN, TEST ONLY *******
pCode = pRestart;
}
@@ -1095,7 +1170,6 @@ void SbiRuntime::StepINPUT()
}
else
{
- // pIosys->ResetChannel();
PopVar();
}
}
@@ -1110,7 +1184,6 @@ void SbiRuntime::StepLINPUT()
Error( pIosys->GetError() );
SbxVariableRef p = PopVar();
p->PutString( String( aInput, gsl_getSystemTextEncoding() ) );
- // pIosys->ResetChannel();
}
// Programmende
@@ -1169,7 +1242,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 +1257,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();
@@ -1268,26 +1341,13 @@ void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos
String aDest = pTos1->GetString();
String aSource = pTos->GetString();
- // <-- UCB
if( hasUno() )
{
implStepRenameUCB( aSource, aDest );
}
else
- // --> UCB
{
-#ifdef _OLD_FILE_IMPL
- DirEntry aSourceDirEntry( aSource );
- if( aSourceDirEntry.Exists() )
- {
- if( aSourceDirEntry.MoveTo( DirEntry(aDest) ) != FSYS_ERR_OK )
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
- }
- else
- StarBASIC::Error( SbERR_PATH_NOT_FOUND );
-#else
implStepRenameOSL( aSource, aDest );
-#endif
}
}
@@ -1318,7 +1378,6 @@ void SbiRuntime::StepEMPTY()
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
xVar->PutErr( 448 );
PushVar( xVar );
- // ALT: PushVar( new SbxVariable( SbxEMPTY ) );
}
// TOS = Fehlercode
@@ -1326,7 +1385,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 a619a01b3d..8e0e9311c6 100644
--- 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 prüfen
- if( pVar->GetRefCount() > 2 ) // 2 ist normal für 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 für 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,34 @@ 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() ) + 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 +242,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 +305,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 +344,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 +360,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,9 +375,9 @@ 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
+ // #32714 Resume ohne Error? -> Fehler
if( !bInError )
{
Error( SbERR_BAD_RESUME );
@@ -388,8 +386,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 +400,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 +409,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 +428,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 +519,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 +530,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 +554,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 +563,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 c244642009..cd7aa82b7d 100644
--- 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
@@ -89,7 +89,6 @@ SbxVariable* SbiRuntime::FindElement
SbxVariable* p = new SbxVariable;
p->PutString( sArg );
PushVar( p );
- //
StepARGV();
nOp1 = nOp1 | 0x8000; // indicate params are present
aName = String::CreateFromAscii("Evaluate");
@@ -108,8 +107,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 +141,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 +179,13 @@ SbxVariable* SbiRuntime::FindElement
// Nicht da und nicht im Objekt?
// Hat das Ding Parameter, nicht einrichten!
if( nOp1 & 0x8000 )
- bFatalError = TRUE;
- // ALT: StarBASIC::FatalError( nNotFound );
+ bFatalError = sal_True;
// 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 +230,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 );
@@ -248,7 +250,7 @@ SbxVariable* SbiRuntime::FindElement
// Erst nach dem Setzen anfassen, da z.B. LEFT()
// den Unterschied zwischen Left$() und Left() kennen muss
- // AB 12.8.96: Da in PopVar() die Parameter von Methoden weggehauen
+ // Da in PopVar() die Parameter von Methoden weggehauen
// werden, muessen wir hier explizit eine neue SbxMethod anlegen
SbxVariable* pNew = new SbxMethod( *((SbxMethod*)pElem) ); // das ist der Call!
//ALT: SbxVariable* pNew = new SbxVariable( *pElem ); // das ist der Call!
@@ -282,7 +284,7 @@ SbxVariable* SbiRuntime::FindElement
// Find-Funktion ueber Name fuer aktuellen Scope (z.B. Abfrage aus BASIC-IDE)
SbxBase* SbiRuntime::FindElementExtern( const String& rName )
{
- // Hinweis zu #35281#: Es darf nicht davon ausgegangen werden, dass
+ // Hinweis zu: Es darf nicht davon ausgegangen werden, dass
// pMeth != null, da im RunInit noch keine gesetzt ist.
SbxVariable* pElem = NULL;
@@ -309,8 +311,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 +339,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 +352,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 +392,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 +408,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 +450,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 +541,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 +549,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 +618,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 +632,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 +646,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 +692,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 +700,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();
@@ -697,10 +733,9 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
p = refParams->Get( i );
if( p->GetType() == SbxERROR && ( i ) )
- //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 +745,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 +754,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 +776,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 +792,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 +807,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 +822,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,16 +837,12 @@ 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
ClearExprStack();
- // #56368 Kuenstliche Referenz fuer StepElem wieder freigeben,
- // damit sie nicht ueber ein Statement hinaus erhalten bleibt
- //refSaveObj = NULL;
- // #74254 Jetzt per Liste
ClearRefs();
// Wir muessen hier hart abbrechen, da sonst Zeile und Spalte nicht mehr
@@ -822,7 +853,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 +865,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 +879,8 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// #29955 for-Schleifen-Ebene korrigieren, #67452 NICHT im Error-Handler sonst Chaos
if( !bInError )
{
- // (Bei Sprüngen 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 +891,11 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
}
// 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
- // Erklärung 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,16 +904,13 @@ 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 );
- //16.10.96, ALT:
- //if( nNewFlags != SbDEBUG_CONTINUE )
- // nFlags = nNewFlags;
}
}
@@ -892,7 +919,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 +934,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 +952,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 +984,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 +1006,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 +1048,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 +1056,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 +1099,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 +1113,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 +1145,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 +1172,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 +1194,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 +1212,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 +1232,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 +1244,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 +1282,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 8c332c1a8c..8c332c1a8c 100644..100755
--- a/basic/source/runtime/wnt-mingw.s
+++ b/basic/source/runtime/wnt-mingw.s
diff --git a/basic/source/runtime/wnt.asm b/basic/source/runtime/wnt-x86.asm
index 2a8710e342..2a8710e342 100644
--- a/basic/source/runtime/wnt.asm
+++ b/basic/source/runtime/wnt-x86.asm
diff --git a/basic/source/sample/collelem.cxx b/basic/source/sample/collelem.cxx
index b88dc3bcbb..5c42b262bf 100644
--- 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 5261f13cfe..5261f13cfe 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 c1c78684ed..c8c08fd329 100644
--- a/basic/source/sample/object.cxx
+++ b/basic/source/sample/object.cxx
@@ -59,10 +59,6 @@
// Das Sample-Objekt wird in ..\app\mybasic.cxx wie folgt in StarBASIC
// eingebaut:
-// MyBasic::MyBasic() : StarBASIC()
-// {
-// AddFactory( new SampleObjectFac() );
-// }
// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
@@ -74,7 +70,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 +126,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 +168,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 ) )
@@ -209,15 +205,13 @@ void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
SbxInfo* SampleObject::GetInfo( short nIdx )
{
Methods* p = &aMethods[ nIdx ];
- // Wenn mal eine Hilfedatei zur Verfuegung steht:
- // SbxInfo* pInfo_ = new SbxInfo( Hilfedateiname, p->nHelpId );
SbxInfo* pInfo_ = new SbxInfo;
short nPar = p->nArgs & _ARGSMASK;
for( short i = 0; i < nPar; i++ )
{
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_ );
@@ -225,15 +219,14 @@ SbxInfo* SampleObject::GetInfo( short nIdx )
return pInfo_;
}
-////////////////////////////////////////////////////////////////////////////
-// 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 +234,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 +242,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/sbx/makefile.mk b/basic/source/sbx/makefile.mk
index cc20080cbe..332c6a0d42 100644..100755
--- a/basic/source/sbx/makefile.mk
+++ b/basic/source/sbx/makefile.mk
@@ -47,7 +47,6 @@ SLOFILES= \
$(SLO)$/sbxbyte.obj \
$(SLO)$/sbxchar.obj \
$(SLO)$/sbxcoll.obj \
- $(SLO)$/sbxcurr.obj \
$(SLO)$/sbxdec.obj \
$(SLO)$/sbxform.obj \
$(SLO)$/sbxint.obj \
@@ -58,12 +57,12 @@ SLOFILES= \
$(SLO)$/sbxsng.obj \
$(SLO)$/sbxuint.obj \
$(SLO)$/sbxulng.obj \
- $(SLO)$/sbxvals.obj \
$(SLO)$/sbxvar.obj
EXCEPTIONSFILES= \
$(SLO)$/sbxarray.obj \
+ $(SLO)$/sbxcurr.obj \
$(SLO)$/sbxdate.obj \
$(SLO)$/sbxdbl.obj \
$(SLO)$/sbxexec.obj \
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 200c10018c..eb95cf685c 100644
--- 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 {
@@ -59,11 +59,7 @@ public:
TYPEINIT1(SbxArray,SbxBase)
TYPEINIT1(SbxDimArray,SbxArray)
-//////////////////////////////////////////////////////////////////////////
-//
// SbxArray
-//
-//////////////////////////////////////////////////////////////////////////
SbxArray::SbxArray( SbxDataType t ) : SbxBase()
{
@@ -89,7 +85,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 +123,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 +132,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 +162,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 +180,7 @@ SbxVariableRef& SbxArray::GetRef( USHORT nIdx )
return *((*pData)[nIdx]);
}
-SbxVariable* SbxArray::Get32( UINT32 nIdx )
+SbxVariable* SbxArray::Get32( sal_uInt32 nIdx )
{
if( !CanRead() )
{
@@ -203,7 +199,7 @@ SbxVariable* SbxArray::Get32( UINT32 nIdx )
return rRef;
}
-SbxVariable* SbxArray::Get( USHORT nIdx )
+SbxVariable* SbxArray::Get( sal_uInt16 nIdx )
{
if( !CanRead() )
{
@@ -222,7 +218,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 +238,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 +258,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 +277,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 +291,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 +314,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 +322,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 +333,7 @@ void SbxArray::Remove32( UINT32 nIdx )
}
}
-void SbxArray::Remove( USHORT nIdx )
+void SbxArray::Remove( sal_uInt16 nIdx )
{
if( nIdx < pData->size() )
{
@@ -352,10 +348,9 @@ 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 );
if( *pRef == pVar )
{
Remove32( i ); break;
@@ -371,8 +366,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 +376,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 +404,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 +427,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 +455,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 +484,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 +506,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 +527,7 @@ BOOL SbxArray::LoadData( SvStream& rStrm, USHORT nVer )
}
else
{
- bRes = FALSE; break;
+ bRes = sal_False; break;
}
}
if( bRes )
@@ -541,10 +536,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,34 +548,30 @@ 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;
}
-//////////////////////////////////////////////////////////////////////////
-//
// SbxArray
-//
-//////////////////////////////////////////////////////////////////////////
SbxDimArray::SbxDimArray( SbxDataType t ) : SbxArray( t ), mbHasFixedSize( false )
{
@@ -632,7 +623,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 +647,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 +701,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 +720,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 +736,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 +754,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 +772,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 +821,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 f96c39730d..099b38f6b1 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -49,18 +49,11 @@ TYPEINIT0(SbxBase)
SbxAppData* GetSbxData_Impl()
{
-#ifndef DOS
SbxAppData** ppData = (SbxAppData**) ::GetAppData( SHL_SBX );
SbxAppData* p = *ppData;
if( !p )
p = *ppData = new SbxAppData;
return p;
-#else
- SbxAppData** ppData;
- SbxAppData* p;
- p = *ppData = new SbxAppData;
- return p;
-#endif
}
SbxAppData::~SbxAppData()
@@ -116,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 ) )
@@ -145,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()
@@ -161,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
@@ -175,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 )
{
@@ -185,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,
@@ -211,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 );
@@ -233,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 )
@@ -251,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;
}
@@ -267,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 )
@@ -283,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 )
@@ -311,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;
}
@@ -401,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() );
@@ -414,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;
@@ -422,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 )
@@ -442,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 1f7d510e48..e0efbec32b 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -71,14 +71,10 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
}
break;
case SbxSALINT64:
+ case SbxCURRENCY:
nRes = p->nInt64 ? SbxTRUE : SbxFALSE; break;
case SbxSALUINT64:
nRes = p->uInt64 ? SbxTRUE : SbxFALSE; break;
- case SbxULONG64:
- nRes = !!p->nULong64 ? SbxTRUE : SbxFALSE; break;
- case SbxLONG64:
- case SbxCURRENCY:
- nRes = !!p->nLong64 ? SbxTRUE : SbxFALSE; break;
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
@@ -90,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;
}
@@ -139,23 +135,18 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
nRes = ( *p->pDouble != 0 ) ? SbxTRUE : SbxFALSE; break;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
nRes = ( *p->pnInt64 ) ? SbxTRUE : SbxFALSE; break;
case SbxBYREF | SbxSALUINT64:
nRes = ( *p->puInt64 ) ? SbxTRUE : SbxFALSE; break;
- case SbxBYREF | SbxULONG64:
- nRes = !!*p->pULong64 ? SbxTRUE : SbxFALSE; break;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- nRes = !!*p->pLong64 ? SbxTRUE : SbxFALSE; break;
-
default:
SbxBase::SetError( SbxERR_CONVERSION ); nRes = SbxFALSE;
}
return nRes;
}
-void ImpPutBool( SbxValues* p, INT16 n )
+void ImpPutBool( SbxValues* p, sal_Int16 n )
{
if( n )
n = SbxTRUE;
@@ -164,34 +155,30 @@ 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:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
case SbxSALINT64:
- p->nInt64 = n; break;
+ p->nInt64 = (sal_Int64) n; break;
case SbxSALUINT64:
- p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64.Set( (UINT32)n ); break;
- case SbxLONG64:
- case SbxCURRENCY:
- p->nLong64.Set( (INT32)n ); break;
+ 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:
@@ -207,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;
@@ -215,32 +202,27 @@ 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:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = n; break;
+ *p->pnInt64 = (sal_Int64) n; break;
case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = n; break;
- case SbxBYREF | SbxULONG64:
- p->pULong64->Set( (UINT32)n ); break;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- p->pLong64->Set( (INT32)n ); break;
-
+ *p->puInt64 = (sal_uInt64) n; break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index 0151f59bc0..a3cf94e160 100644
--- 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,10 +93,15 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE;
}
else
- nRes = (BYTE) p->nULong;
+ nRes = (sal_uInt8) p->nULong;
break;
+ case SbxCURRENCY:
case SbxSALINT64:
- if( p->nInt64 > SbxMAXBYTE )
+ {
+ sal_Int64 val = p->nInt64;
+ if ( p->eType == SbxCURRENCY )
+ val = val / CURRENCY_FACTOR;
+ if( val > SbxMAXBYTE )
{
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE;
}
@@ -105,15 +110,16 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
}
else
- nRes = (BYTE) p->nInt64;
+ nRes = (sal_uInt8) val;
break;
+ }
case SbxSALUINT64:
if( p->uInt64 > SbxMAXBYTE )
{
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXBYTE;
}
else
- nRes = (BYTE) p->uInt64;
+ nRes = (sal_uInt8) p->uInt64;
break;
case SbxSINGLE:
if( p->nSingle > SbxMAXBYTE )
@@ -125,24 +131,15 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
}
else
- nRes = (BYTE) ImpRound( p->nSingle );
+ nRes = (sal_uInt8) ImpRound( p->nSingle );
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -160,7 +157,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
}
else
- nRes = (BYTE) ImpRound( dVal );
+ nRes = (sal_uInt8) ImpRound( dVal );
break;
}
case SbxBYREF | SbxSTRING:
@@ -183,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:
@@ -219,11 +216,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -238,7 +231,7 @@ start:
return nRes;
}
-void ImpPutByte( SbxValues* p, BYTE n )
+void ImpPutByte( SbxValues* p, sal_uInt8 n )
{
switch( +p->eType )
{
@@ -259,16 +252,12 @@ void ImpPutByte( SbxValues* p, BYTE n )
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxSALUINT64:
p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setByte( n );
@@ -312,16 +301,12 @@ void ImpPutByte( SbxValues* p, BYTE n )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
+ case SbxBYREF | SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index ab0aff6579..14e422bd9c 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -81,8 +81,15 @@ start:
else
nRes = (xub_Unicode) p->nULong;
break;
+ case SbxCURRENCY:
case SbxSALINT64:
- if( p->nInt64 > SbxMAXCHAR )
+ {
+ sal_Int64 val = p->nInt64;
+
+ if ( p->eType == SbxCURRENCY )
+ val = val / CURRENCY_FACTOR;
+
+ if( val > SbxMAXCHAR )
{
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXCHAR;
}
@@ -91,8 +98,9 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (xub_Unicode) p->nInt64;
+ nRes = (xub_Unicode) val;
break;
+ }
case SbxSALUINT64:
if( p->uInt64 > SbxMAXCHAR )
{
@@ -115,20 +123,11 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -146,7 +145,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
}
else
- nRes = (BYTE) ImpRound( dVal );
+ nRes = (sal_uInt8) ImpRound( dVal );
break;
}
case SbxBYREF | SbxSTRING:
@@ -202,11 +201,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -239,16 +234,12 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxSALUINT64:
p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setChar( n );
break;
@@ -285,32 +276,28 @@ 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:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
+ case SbxBYREF | SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 5bc2e08f30..23eb1c2872 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -42,9 +42,8 @@ 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;
-/////////////////////////////////////////////////////////////////////////
SbxCollection::SbxCollection( const XubString& rClass )
: SbxObject( rClass )
@@ -62,7 +61,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 +101,7 @@ void SbxCollection::Initialize()
p->SetFlag( SBX_DONTSTORE );
}
-SbxVariable* SbxCollection::FindUserData( UINT32 nData )
+SbxVariable* SbxCollection::FindUserData( sal_uInt32 nData )
{
if( GetParameters() )
{
@@ -130,9 +129,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 +191,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,21 +211,20 @@ 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;
}
-/////////////////////////////////////////////////////////////////////////
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 +276,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 +287,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 66ce3fb03e..bbce15e0be 100644
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -34,32 +34,34 @@
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 );
sal_uInt64 ImpGetUInt64( const SbxValues* );
void ImpPutUInt64( SbxValues*, sal_uInt64 );
-sal_Int64 ImpDoubleToSalInt64( double d );
+sal_Int64 ImpDoubleToSalInt64 ( double d );
sal_uInt64 ImpDoubleToSalUInt64( double d );
+double ImpSalInt64ToDouble ( sal_Int64 n );
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
@@ -69,39 +71,20 @@ void ImpPutSingle( SbxValues*, float );
// SBXDBL.CXX
double ImpGetDouble( const SbxValues* );
-void ImpPutDouble( SbxValues*, double, BOOL bCoreString=FALSE );
-
-#if FALSE
-// SBX64.CXX
-
-SbxINT64 ImpGetINT64( const SbxValues* );
-void ImpPutINT64( SbxValues*, const SbxINT64& );
-SbxUINT64 ImpGetUINT64( const SbxValues* );
-void ImpPutUINT64( SbxValues*, const SbxUINT64& );
-#endif
+void ImpPutDouble( SbxValues*, double, sal_Bool bCoreString=sal_False );
// SBXCURR.CXX
-SbxUINT64 ImpDoubleToUINT64( double );
-double ImpUINT64ToDouble( const SbxUINT64& );
-SbxINT64 ImpDoubleToINT64( double );
-double ImpINT64ToDouble( const SbxINT64& );
+sal_Int64 ImpGetCurrency( const SbxValues* );
+void ImpPutCurrency( SbxValues*, const sal_Int64 );
-#if TRUE
-INT32 ImpGetCurrLong( const SbxValues* );
-void ImpPutCurrLong( SbxValues*, INT32 );
-INT32 ImpDoubleToCurrLong( double );
-double ImpCurrLongToDouble( INT32 );
-#endif
+inline sal_Int64 ImpDoubleToCurrency( double d )
+ { if (d > 0) return (sal_Int64)( d * CURRENCY_FACTOR + 0.5);
+ else return (sal_Int64)( d * CURRENCY_FACTOR - 0.5);
+ }
-SbxINT64 ImpGetCurrency( const SbxValues* );
-void ImpPutCurrency( SbxValues*, const SbxINT64& );
-inline
-SbxINT64 ImpDoubleToCurrency( double d )
- { return ImpDoubleToINT64( d * CURRENCY_FACTOR ); }
-inline
-double ImpCurrencyToDouble( const SbxINT64 &r )
- { return ImpINT64ToDouble( r ) / CURRENCY_FACTOR; }
+inline double ImpCurrencyToDouble( const sal_Int64 r )
+ { return (double)r / (double)CURRENCY_FACTOR; }
// SBXDEC.CXX
@@ -124,28 +107,28 @@ void ImpPutString( SbxValues*, const ::rtl::OUString* );
// SBXCHAR.CXX
sal_Unicode ImpGetChar( const SbxValues* );
-void ImpPutChar( SbxValues*, sal_Unicode );
+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 );
-// ByteArry <--> String
+// ByteArray <--> String
SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
::rtl::OUString ByteArrayToString(SbxArray* pArr);
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 0057d6f93a..0ea500bb0b 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -29,101 +29,305 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#include <basic/sbx.hxx>
#include <tools/errcode.hxx>
+#include <vcl/svapp.hxx> // for SvtSysLocale
-#define _TLBIGINT_INT64
-#include <tools/bigint.hxx>
-
+#include <basic/sbx.hxx>
#include <basic/sbxvar.hxx>
#include "sbxconv.hxx"
-static ::rtl::OUString ImpCurrencyToString( const SbxINT64& );
-static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& );
-SbxINT64 ImpGetCurrency( const SbxValues* p )
+static rtl::OUString ImpCurrencyToString( const sal_Int64 &rVal )
{
- SbxValues aTmp;
- SbxINT64 nRes;
+ bool isNeg = ( rVal < 0 );
+ sal_Int64 absVal = isNeg ? -rVal : rVal;
+
+ SvtSysLocale aSysLocale;
+ sal_Unicode cDecimalSep = '.';
+#if MAYBEFUTURE
+ sal_Unicode cThousandSep = ',';
+ const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
+ cDecimalSep = rData.getNumDecimalSep().GetBuffer()[0];
+ cThousandSep = rData.getNumThousandSep().GetBuffer()[0];
+#endif
+
+ rtl::OUString aAbsStr = rtl::OUString::valueOf( absVal );
+ rtl::OUStringBuffer aBuf;
+
+ sal_Int32 initialLen = aAbsStr.getLength();
+
+ bool bLessThanOne = false;
+ if ( initialLen <= 4 ) // if less the 1
+ bLessThanOne = true;
+
+ sal_Int32 nCapacity = 6; // minimum e.g. 0.0000
+
+ if ( !bLessThanOne )
+ {
+ nCapacity = initialLen + 1;
+#if MAYBEFUTURE
+ if ( initialLen > 5 )
+ {
+ sal_Int32 nThouSeperators = ( initialLen - 5 ) / 3;
+ nCapacity += nThouSeperators;
+ }
+#endif
+ }
+
+ if ( isNeg )
+ ++nCapacity;
+
+ aBuf.setLength( nCapacity );
+
+
+ sal_Int32 nDigitCount = 0;
+ sal_Int32 nInsertIndex = nCapacity - 1;
+ sal_Int32 nEndIndex = isNeg ? 1 : 0;
+
+ for ( sal_Int32 charCpyIndex = aAbsStr.getLength() - 1; nInsertIndex >= nEndIndex; ++nDigitCount )
+ {
+ if ( nDigitCount == 4 )
+ aBuf.setCharAt( nInsertIndex--, cDecimalSep );
+#if MAYBEFUTURE
+ if ( nDigitCount > 4 && ! ( ( nDigitCount - 4 ) % 3) )
+ aBuf.setCharAt( nInsertIndex--, cThousandSep );
+#endif
+ if ( nDigitCount < initialLen )
+ aBuf.setCharAt( nInsertIndex--, aAbsStr[ charCpyIndex-- ] );
+ else
+ // Handle leading 0's to right of decimal point
+ // Note: in VBA the stringification is a little more complex
+ // but more natural as only the necessary digits
+ // to the right of the decimal places are displayed
+ // It would be great to conditionally be able to display like that too
+ //
+ // Val OOo (Cur) VBA (Cur)
+ // --- --------- ---------
+ // 0 0.0000 0
+ // 0.1 0.1000 0.1
+
+ aBuf.setCharAt( nInsertIndex--, (sal_Unicode)'0' );
+ }
+ if ( isNeg )
+ aBuf.setCharAt( nInsertIndex, (sal_Unicode)'-' );
+
+ aAbsStr = aBuf.makeStringAndClear();
+ return aAbsStr;
+}
+
+
+static sal_Int64 ImpStringToCurrency( const rtl::OUString &rStr )
+{
+
+ sal_Int32 nFractDigit = 4;
+
+ SvtSysLocale aSysLocale;
+ sal_Unicode cDeciPnt = sal_Unicode('.');
+ sal_Unicode c1000Sep = sal_Unicode(',');
+
+#if MAYBEFUTURE
+ const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
+ sal_Unicode cLocaleDeciPnt = rData.getNumDecimalSep().GetBuffer()[0];
+ sal_Unicode cLocale1000Sep = rData.getNumThousandSep().GetBuffer()[0];
+
+ // score each set of separators (Locale and Basic) on total number of matches
+ // if one set has more matches use that set
+ // if tied use the set with the only or rightmost decimal separator match
+ // currency is fixed pt system: usually expect the decimal pt, 1000sep may occur
+ sal_Int32 LocaleScore = 0;
+ sal_Int32 LocaleLastDeci = -1;
+ sal_Int32 LOBasicScore = 0;
+ sal_Int32 LOBasicLastDeci = -1;
+
+ for( int idx=0; idx<rStr.getLength(); idx++ )
+ {
+ if ( *(p+idx) == cLocaleDeciPnt )
+ {
+ LocaleScore++;
+ LocaleLastDeci = idx;
+ }
+ if ( *(p+idx) == cLocale1000Sep )
+ LocaleScore++;
+
+ if ( *(p+idx) == cDeciPnt )
+ {
+ LOBasicScore++;
+ LOBasicLastDeci = idx;
+ }
+ if ( *(p+idx) == c1000Sep )
+ LOBasicScore++;
+ }
+ if ( ( LocaleScore > LOBasicScore )
+ ||( LocaleScore = LOBasicScore && LocaleLastDeci > LOBasicLastDeci ) )
+ {
+ cDeciPnt = cLocaleDeciPnt;
+ c1000Sep = cLocale1000Sep;
+ }
+#endif
+
+ // lets use the existing string number conversions
+ // there is a performance impact here ( multiple string copies )
+ // but better I think than a home brewed string parser, if we need a parser
+ // we should share some existing ( possibly from calc is there a currency
+ // conversion there ? #TODO check )
+
+ rtl::OUString sTmp( rStr.trim() );
+ const sal_Unicode* p = sTmp.getStr();
+
+ // normalise string number by removeing thousands & decimal point seperators
+ rtl::OUStringBuffer sNormalisedNumString( sTmp.getLength() + nFractDigit );
+
+ if ( *p == '-' || *p == '+' )
+ sNormalisedNumString.append( *p );
+
+ while ( ( *p >= '0' && *p <= '9' ) )
+ {
+ sNormalisedNumString.append( *p++ );
+ // #TODO in vba mode set runtime error when a space ( or other )
+ // illegal character is found
+ if( *p == c1000Sep )
+ p++;
+ }
+
+ bool bRoundUp = false;
+
+ if( *p == cDeciPnt )
+ {
+ p++;
+ while( nFractDigit && *p >= '0' && *p <= '9' )
+ {
+ sNormalisedNumString.append( *p++ );
+ nFractDigit--;
+ }
+ // Consume trailing content
+ if ( p != NULL )
+ {
+ // Round up if necessary
+ if( *p >= '5' && *p <= '9' )
+ bRoundUp = true;
+ while( *p >= '0' && *p <= '9' )
+ p++;
+ }
+
+ }
+ // can we raise error here ? ( previous behaviour was more forgiving )
+ // so... not sure that could bread existing code, lets see if anyone
+ // complains.
+
+ if ( p != sTmp.getStr() + sTmp.getLength() )
+ SbxBase::SetError( SbxERR_CONVERSION );
+ while( nFractDigit )
+ {
+ sNormalisedNumString.append( sal_Unicode('0') );
+ nFractDigit--;
+ }
+
+ sal_Int64 result = sNormalisedNumString.makeStringAndClear().toInt64();
+
+ if ( bRoundUp )
+ ++result;
+ return result;
+}
+
+
+sal_Int64 ImpGetCurrency( const SbxValues* p )
+{
+ SbxValues aTmp;
+ sal_Int64 nRes;
start:
switch( +p->eType )
{
+ case SbxERROR:
case SbxNULL:
SbxBase::SetError( SbxERR_CONVERSION );
+ nRes = 0; break;
case SbxEMPTY:
- nRes.SetNull(); break;
- case SbxCHAR:
- nRes = ImpDoubleToCurrency( (double)p->nChar ); break;
+ nRes = 0; break;
+ case SbxCURRENCY:
+ nRes = p->nInt64; break;
case SbxBYTE:
- nRes = ImpDoubleToCurrency( (double)p->nByte ); break;
- case SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nByte);
+ break;
+ case SbxCHAR:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->pChar);
+ break;
case SbxBOOL:
- nRes = ImpDoubleToCurrency( (double)p->nInteger ); break;
- case SbxERROR:
+ case SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nInteger);
+ break;
case SbxUSHORT:
- nRes = ImpDoubleToCurrency( (double)p->nUShort ); break;
- case SbxCURRENCY:
- nRes = p->nLong64; break;
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nUShort);
+ break;
case SbxLONG:
- nRes = ImpDoubleToCurrency( (double)p->nLong );
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nLong);
break;
case SbxULONG:
- nRes = ImpDoubleToCurrency( (double)p->nULong );
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(p->nULong);
break;
+
case SbxSALINT64:
- nRes = ImpDoubleToCurrency( (double)p->nInt64 );
- break;
+ {
+ nRes = p->nInt64 * CURRENCY_FACTOR; break;
+ if ( nRes > SbxMAXSALINT64 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSALINT64;
+ }
+ }
case SbxSALUINT64:
- nRes = ImpDoubleToCurrency( ImpSalUInt64ToDouble( p->uInt64 ) );
- break;
- case SbxSINGLE:
- if( p->nSingle > SbxMAXCURR )
+ nRes = p->nInt64 * CURRENCY_FACTOR; break;
+ if ( nRes > SbxMAXSALINT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMax();
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSALINT64;
}
- else if( p->nSingle < SbxMINCURR )
+ else if ( nRes < SbxMINSALINT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMin();
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINSALINT64;
}
- else
- nRes = ImpDoubleToCurrency( (double)p->nSingle );
break;
- case SbxDATE:
- case SbxDOUBLE:
- if( p->nDouble > SbxMAXCURR )
+//TODO: bring back SbxINT64 types here for limits -1 with flag value at SAL_MAX/MIN
+ case SbxSINGLE:
+ if( p->nSingle * CURRENCY_FACTOR + 0.5 > (float)SAL_MAX_INT64
+ || p->nSingle * CURRENCY_FACTOR - 0.5 < (float)SAL_MIN_INT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMax();
+ nRes = SAL_MAX_INT64;
+ if( p->nSingle * CURRENCY_FACTOR - 0.5 < (float)SAL_MIN_INT64 )
+ nRes = SAL_MIN_INT64;
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ break;
}
- else if( p->nDouble < SbxMINCURR )
+ nRes = ImpDoubleToCurrency( (double)p->nSingle );
+ break;
+
+ case SbxDATE:
+ case SbxDOUBLE:
+ if( p->nDouble * CURRENCY_FACTOR + 0.5 > (double)SAL_MAX_INT64
+ || p->nDouble * CURRENCY_FACTOR - 0.5 < (double)SAL_MIN_INT64 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMin();
+ nRes = SAL_MAX_INT64;
+ if( p->nDouble * CURRENCY_FACTOR - 0.5 < (double)SAL_MIN_INT64 )
+ nRes = SAL_MIN_INT64;
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ break;
}
- else
- nRes = ImpDoubleToCurrency( p->nDouble );
+ nRes = ImpDoubleToCurrency( p->nDouble );
break;
+
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double d = 0.0;
if( p->pDecimal )
p->pDecimal->getDouble( d );
- if( d > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMax();
- }
- else if( d < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); nRes.SetMin();
- }
- else
- nRes = ImpDoubleToCurrency( d );
+ nRes = ImpDoubleToCurrency( d );
break;
}
+
+
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pOUString )
- nRes.SetNull();
+ nRes=0;
else
nRes = ImpStringToCurrency( *p->pOUString );
break;
@@ -134,23 +338,26 @@ start:
nRes = pVal->GetCurrency();
else
{
- SbxBase::SetError( SbxERR_NO_OBJECT ); nRes.SetNull();
+ SbxBase::SetError( SbxERR_NO_OBJECT );
+ nRes=0;
}
break;
}
case SbxBYREF | SbxCHAR:
- nRes = ImpDoubleToCurrency( (double)*p->pChar ); break;
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pChar);
+ break;
case SbxBYREF | SbxBYTE:
- nRes = ImpDoubleToCurrency( (double)*p->pByte ); break;
- case SbxBYREF | SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pByte);
+ break;
case SbxBYREF | SbxBOOL:
- nRes = ImpDoubleToCurrency( (double)*p->pInteger ); break;
+ case SbxBYREF | SbxINTEGER:
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pInteger);
+ break;
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
- nRes = ImpDoubleToCurrency( (double)*p->pUShort ); break;
- case SbxBYREF | SbxCURRENCY:
- nRes = *p->pLong64; break;
+ nRes = (sal_Int64)CURRENCY_FACTOR * (sal_Int64)(*p->pUShort);
+ break;
// from here on had to be tested
case SbxBYREF | SbxLONG:
@@ -162,23 +369,25 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
aTmp.uInt64 = *p->puInt64; goto ref;
ref:
- aTmp.eType = SbxDataType( p->eType & 0x0FFF );
+ aTmp.eType = SbxDataType( p->eType & ~SbxBYREF );
p = &aTmp; goto start;
default:
- SbxBase::SetError( SbxERR_CONVERSION ); nRes.SetNull();
+ SbxBase::SetError( SbxERR_CONVERSION );
+ nRes=0;
}
return nRes;
}
-void ImpPutCurrency( SbxValues* p, const SbxINT64 &r )
+
+void ImpPutCurrency( SbxValues* p, const sal_Int64 r )
{
- double dVal = ImpCurrencyToDouble( r );
SbxValues aTmp;
start:
switch( +p->eType )
@@ -204,29 +413,31 @@ start:
// from here no longer
case SbxSINGLE:
- p->nSingle = (float)dVal; break;
+ p->nSingle = (float)( r / CURRENCY_FACTOR ); break;
case SbxDATE:
case SbxDOUBLE:
- p->nDouble = dVal; break;
- case SbxSALINT64:
- p->nInt64 = ImpDoubleToSalInt64( dVal ); break;
+ p->nDouble = ImpCurrencyToDouble( r ); break;
case SbxSALUINT64:
- p->uInt64 = ImpDoubleToSalUInt64( dVal ); break;
+ p->uInt64 = r / CURRENCY_FACTOR; break;
+ case SbxSALINT64:
+ p->nInt64 = r / CURRENCY_FACTOR; break;
+
case SbxCURRENCY:
- p->nLong64 = r; break;
+ p->nInt64 = r; break;
+
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
SbxDecimal* pDec = ImpCreateDecimal( p );
- if( !pDec->setDouble( dVal ) )
- SbxBase::SetError( SbxERR_OVERFLOW );
+ if( !pDec->setDouble( ImpCurrencyToDouble( r ) / CURRENCY_FACTOR ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
break;
}
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
if( !p->pOUString )
- p->pOUString = new ::rtl::OUString;
+ p->pOUString = new rtl::OUString;
*p->pOUString = ImpCurrencyToString( r );
break;
@@ -240,158 +451,100 @@ start:
break;
}
case SbxBYREF | SbxCHAR:
- if( dVal > SbxMAXCHAR )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXCHAR )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXCHAR;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXCHAR;
}
- else if( dVal < SbxMINCHAR )
+ else if( val < SbxMINCHAR )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMINCHAR;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMINCHAR;
}
- *p->pChar = (xub_Unicode) dVal; break;
+ *p->pChar = (sal_Unicode) val; break;
+ }
case SbxBYREF | SbxBYTE:
- if( dVal > SbxMAXBYTE )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXBYTE )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXBYTE;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXBYTE;
}
- else if( dVal < 0 )
+ else if( val < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = 0;
}
- *p->pByte = (BYTE) dVal; break;
+ *p->pByte = (sal_uInt8) val; break;
+ }
case SbxBYREF | SbxINTEGER:
case SbxBYREF | SbxBOOL:
- if( dVal > SbxMAXINT )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( r > SbxMAXINT )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXINT;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXINT;
}
- else if( dVal < SbxMININT )
+ else if( r < SbxMININT )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMININT;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMININT;
}
- *p->pInteger = (INT16) dVal; break;
+ *p->pInteger = (sal_uInt16) val; break;
+ }
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
- if( dVal > SbxMAXUINT )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXUINT )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXUINT;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXUINT;
}
- else if( dVal < 0 )
+ else if( val < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = 0;
}
- *p->pUShort = (UINT16) dVal; break;
+ *p->pUShort = (sal_uInt16) val; break;
+ }
case SbxBYREF | SbxLONG:
- if( dVal > SbxMAXLNG )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXLNG )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXLNG;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXLNG;
}
- else if( dVal < SbxMINLNG )
+ else if( val < SbxMINLNG )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMINLNG;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMINLNG;
}
- *p->pLong = (INT32) dVal; break;
+ *p->pLong = (sal_Int32) val; break;
+ }
case SbxBYREF | SbxULONG:
- if( dVal > SbxMAXULNG )
+ {
+ sal_Int64 val = r / CURRENCY_FACTOR;
+ if( val > SbxMAXULNG )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = SbxMAXULNG;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMAXULNG;
}
- else if( dVal < 0 )
+ else if( val < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); dVal = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW ); val = 0;
}
- *p->pULong = (UINT32) dVal; break;
+ *p->pULong = (sal_uInt32) val; break;
+ break;
+ }
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = r; break;
case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = ImpDoubleToSalInt64( dVal ); break;
+ *p->pnInt64 = r / CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = ImpDoubleToSalUInt64( dVal ); break;
+ *p->puInt64 = (sal_uInt64)r / CURRENCY_FACTOR; break;
case SbxBYREF | SbxSINGLE:
- *p->pSingle = (float) dVal; break;
+ p->nSingle = (float)( r / CURRENCY_FACTOR ); break;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
- *p->pDouble = (double) dVal; break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = r; break;
-
+ *p->pDouble = ImpCurrencyToDouble( r ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
-// help functions for the conversion
-
-static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r )
-{
- BigInt a10000 = 10000;
-
- //return GetpApp()->GetAppInternational().GetCurr( BigInt( r ), 4 );
- BigInt aInt( r );
- aInt.Abs();
- BigInt aFrac = aInt;
- aInt /= a10000;
- aFrac %= a10000;
- aFrac += a10000;
-
- ::rtl::OUString aString;
- if( r.nHigh < 0 )
- aString = ::rtl::OUString( (sal_Unicode)'-' );
- aString += aInt.GetString();
- aString += ::rtl::OUString( (sal_Unicode)'.' );
- aString += aFrac.GetString().GetBuffer()+1;
- return aString;
-}
-
-static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r )
-{
- int nDec = 4;
- String aStr;
- const sal_Unicode* p = r.getStr();
-
- if( *p == '-' )
- aStr += *p++;
-
- while( *p >= '0' && *p <= '9' ) {
- aStr += *p++;
- if( *p == ',' )
- p++;
- }
-
- if( *p == '.' ) {
- p++;
- while( nDec && *p >= '0' && *p <= '9' ) {
- aStr += *p++;
- nDec--;
- }
- }
- while( nDec ) {
- aStr += '0';
- nDec--;
- }
-
- BigInt aBig( aStr );
- SbxINT64 nRes;
- aBig.INT64( &nRes );
- return nRes;
-}
-
-double ImpINT64ToDouble( const SbxINT64 &r )
-{ return (double)r.nHigh*(double)4294967296.0 + (double)r.nLow; }
-
-SbxINT64 ImpDoubleToINT64( double d )
-{
- SbxINT64 nRes;
- nRes.Set( d );
- return nRes;
-}
-
-double ImpUINT64ToDouble( const SbxUINT64 &r )
-{ return (double)r.nHigh*(double)4294967296.0 + (double)r.nLow; }
-
-SbxUINT64 ImpDoubleToUINT64( double d )
-{
- SbxUINT64 nRes;
- nRes.Set( d );
- return nRes;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index ed151a7967..afde12a7aa 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -67,12 +67,8 @@ double ImpGetDate( const SbxValues* p )
case SbxDATE:
case SbxDOUBLE:
nRes = p->nDouble; break;
- case SbxULONG64:
- nRes = ImpUINT64ToDouble( p->nULong64 ); break;
- case SbxLONG64:
- nRes = ImpINT64ToDouble( p->nLong64 ); break;
case SbxCURRENCY:
- nRes = ImpCurrencyToDouble( p->nLong64 ); break;
+ nRes = ImpCurrencyToDouble( p->nInt64 ); break;
case SbxSALINT64:
nRes = static_cast< double >(p->nInt64); break;
case SbxSALUINT64:
@@ -91,7 +87,6 @@ double ImpGetDate( const SbxValues* p )
nRes = 0;
else
{
-#ifndef DOS
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
SvNumberFormatter* pFormatter;
@@ -127,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 )
@@ -142,9 +137,6 @@ double ImpGetDate( const SbxValues* p )
}
delete pFormatter;
-#else
- SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0;
-#endif
}
break;
case SbxOBJECT:
@@ -178,12 +170,8 @@ double ImpGetDate( const SbxValues* p )
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
nRes = *p->pDouble; break;
- case SbxBYREF | SbxULONG64:
- nRes = ImpUINT64ToDouble( *p->pULong64 ); break;
- case SbxBYREF | SbxLONG64:
- nRes = ImpINT64ToDouble( *p->pLong64 ); break;
case SbxBYREF | SbxCURRENCY:
- nRes = ImpCurrencyToDouble( *p->pLong64 ); break;
+ nRes = ImpCurrencyToDouble( *p->pnInt64 ); break;
case SbxBYREF | SbxSALINT64:
nRes = static_cast< double >(*p->pnInt64); break;
case SbxBYREF | SbxSALUINT64:
@@ -223,11 +211,7 @@ start:
aTmp.pUShort = &p->nUShort; goto direct;
case SbxSINGLE:
aTmp.pSingle = &p->nSingle; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
@@ -247,7 +231,6 @@ start:
case SbxBYREF | SbxSTRING:
case SbxSTRING:
case SbxLPSTR:
-#ifndef DOS
{
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
@@ -304,11 +287,8 @@ start:
pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor );
*p->pOUString = aTmpString;
delete pFormatter;
-#endif
break;
-#ifndef DOS
}
-#endif
case SbxOBJECT:
{
SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
@@ -337,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 )
@@ -348,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 )
@@ -359,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 )
{
@@ -369,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 )
{
@@ -379,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 )
{
@@ -406,7 +386,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index 32d4a891b3..10e24d0584 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -62,7 +62,7 @@ double ImpGetDouble( const SbxValues* p )
case SbxDOUBLE:
nRes = p->nDouble; break;
case SbxCURRENCY:
- nRes = ImpCurrencyToDouble( p->nLong64 ); break;
+ nRes = ImpCurrencyToDouble( p->nInt64 ); break;
case SbxSALINT64:
nRes = static_cast< double >(p->nInt64); break;
case SbxSALUINT64:
@@ -129,7 +129,7 @@ double ImpGetDouble( const SbxValues* p )
case SbxBYREF | SbxDOUBLE:
nRes = *p->pDouble; break;
case SbxBYREF | SbxCURRENCY:
- nRes = ImpCurrencyToDouble( *p->pLong64 ); break;
+ nRes = ImpCurrencyToDouble( *p->pnInt64 ); break;
case SbxBYREF | SbxSALINT64:
nRes = static_cast< double >(*p->pnInt64); break;
case SbxBYREF | SbxSALUINT64:
@@ -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:
@@ -156,7 +156,6 @@ start:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
case SbxLONG:
- case SbxCURRENCY:
aTmp.pLong = &p->nLong; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
@@ -177,6 +176,18 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
+ case SbxCURRENCY:
+ if( n > SbxMAXCURR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCURR;
+ }
+ else if( n < SbxMINCURR )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
+ }
+ p->nInt64 = ImpDoubleToCurrency( n );
+ break;
+
// from here on no longer
case SbxSALINT64:
p->nInt64 = ImpDoubleToSalInt64( n ); break;
@@ -221,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 )
@@ -232,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 )
@@ -243,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 )
{
@@ -253,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 )
{
@@ -263,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 )
{
@@ -298,7 +309,7 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 2b53c5fc1c..b0f146c088 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -36,14 +36,11 @@
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
-// int GnDecCounter = 0;
-
// Implementation SbxDecimal
SbxDecimal::SbxDecimal( void )
{
setInt( 0 );
mnRefCount = 0;
- // GnDecCounter++;
}
SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
@@ -54,7 +51,6 @@ SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
(void)rDec;
#endif
mnRefCount = 0;
- // GnDecCounter++;
}
SbxDecimal::SbxDecimal
@@ -70,7 +66,6 @@ SbxDecimal::SbxDecimal
(void)rAutomationDec;
#endif
mnRefCount = 0;
- // GnDecCounter++;
}
void SbxDecimal::fillAutomationDecimal
@@ -89,7 +84,6 @@ void SbxDecimal::fillAutomationDecimal
SbxDecimal::~SbxDecimal()
{
- // GnDecCounter--;
}
void releaseDecimalPtr( SbxDecimal*& rpDecimal )
@@ -159,32 +153,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 )
@@ -201,12 +195,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
@@ -262,31 +256,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;
@@ -306,7 +300,7 @@ bool SbxDecimal::getDouble( double& rVal )
bool SbxDecimal::getInt( int& rVal )
{
- INT32 TmpVal;
+ sal_Int32 TmpVal;
bool bRet = getLong( TmpVal );
rVal = TmpVal;
return bRet;
@@ -314,7 +308,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;
@@ -365,11 +359,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; }
@@ -377,11 +371,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; }
@@ -494,38 +488,32 @@ start:
if( !pnDecRes->setSingle( p->nSingle ) )
SbxBase::SetError( SbxERR_OVERFLOW );
break;
+ case SbxCURRENCY:
+ {
+ if( !pnDecRes->setDouble( ImpCurrencyToDouble( p->nInt64 ) ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ break;
+ }
case SbxSALINT64:
{
- double d = (double)p->nInt64;
- pnDecRes->setDouble( d );
+ if( !pnDecRes->setDouble( (double)p->nInt64 ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
break;
}
case SbxSALUINT64:
{
- double d = ImpSalUInt64ToDouble( p->uInt64 );
- pnDecRes->setDouble( d );
+ if( !pnDecRes->setDouble( (double)p->uInt64 ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
break;
}
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
- {
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else
- dVal = p->nDouble;
-
+ {
+ double dVal = p->nDouble;
if( !pnDecRes->setDouble( dVal ) )
SbxBase::SetError( SbxERR_OVERFLOW );
break;
- }
+ }
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
@@ -564,11 +552,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -608,17 +592,17 @@ start:
case SbxERROR:
case SbxUSHORT:
aTmp.pUShort = &p->nUShort; goto direct;
- case SbxSALUINT64:
- aTmp.puInt64 = &p->uInt64; goto direct;
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
case SbxLONG:
aTmp.pLong = &p->nLong; goto direct;
+ case SbxCURRENCY:
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
+ case SbxSALUINT64:
+ aTmp.puInt64 = &p->uInt64; goto direct;
+
direct:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
@@ -630,8 +614,6 @@ start:
if( pDec != p->pDecimal )
{
releaseDecimalPtr( p->pDecimal );
- // if( p->pDecimal )
- // p->pDecimal->ReleaseRef();
p->pDecimal = pDec;
if( pDec )
pDec->addRef();
@@ -653,27 +635,12 @@ start:
p->nDouble = d;
break;
}
- case SbxULONG64:
- {
- double d;
- pDec->getDouble( d );
- p->nULong64 = ImpDoubleToUINT64( d );
- break;
- }
- case SbxLONG64:
- {
- double d;
- pDec->getDouble( d );
- p->nLong64 = ImpDoubleToINT64( d );
- break;
- }
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
if( !p->pOUString )
p->pOUString = new ::rtl::OUString;
- // ImpCvtNum( (double) n, 0, *p->pString );
pDec->getString( *p->pOUString );
break;
case SbxOBJECT:
@@ -708,7 +675,6 @@ start:
*p->pInteger = 0;
}
break;
- // *p->pInteger = n; break;
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
if( !pDec->getUShort( *p->pUShort ) )
@@ -731,6 +697,12 @@ start:
*p->pULong = 0;
}
break;
+ case SbxBYREF | SbxCURRENCY:
+ double d;
+ if( !pDec->getDouble( d ) )
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ *p->pnInt64 = ImpDoubleToCurrency( d );
+ break;
case SbxBYREF | SbxSALINT64:
{
double d;
@@ -756,7 +728,6 @@ start:
*p->pSingle = 0;
}
break;
- // *p->pSingle = (float) n; break;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
if( !pDec->getDouble( *p->pDouble ) )
@@ -765,28 +736,6 @@ start:
*p->pDouble = 0;
}
break;
- case SbxBYREF | SbxULONG64:
- {
- double d;
- pDec->getDouble( d );
- *p->pULong64 = ImpDoubleToUINT64( d );
- break;
- }
- case SbxBYREF | SbxLONG64:
- {
- double d;
- pDec->getDouble( d );
- *p->pLong64 = ImpDoubleToINT64( d );
- break;
- }
- case SbxBYREF | SbxCURRENCY:
- {
- double d;
- pDec->getDouble( d );
- *p->pLong64 = ImpDoubleToCurrency( d );
- break;
- }
-
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx
index 85d5509190..362d62e3be 100644
--- a/basic/source/sbx/sbxdec.hxx
+++ b/basic/source/sbx/sbxdec.hxx
@@ -34,17 +34,15 @@
#undef WB_LEFT
#undef WB_RIGHT
-#include <tools/prewin.h>
-} // close extern "C" {
+
+#include <prewin.h>
+#include <postwin.h>
#ifndef __MINGW32__
#include <comutil.h>
#endif
#include <oleauto.h>
-extern "C" { // reopen extern "C" {
-#include <tools/postwin.h>
-
#endif
#endif
#include <basic/sbx.hxx>
@@ -62,7 +60,7 @@ class SbxDecimal
#ifdef WIN32
DECIMAL maDec;
#endif
- INT32 mnRefCount;
+ sal_Int32 mnRefCount;
public:
SbxDecimal( void );
@@ -77,11 +75,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 +96,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 0235bc5ce2..aee53b92fa 100644
--- 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 533de965db..2463766efb 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -142,17 +142,11 @@ SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousa
}
// Funktion zur Ausgabe eines Fehler-Textes (zum Debuggen)
-/*
-void SbxBasicFormater::ShowError( char * sErrMsg )
-{
-// cout << "ERROR in Format$(): " << sErrMsg << endl;
-}
-*/
// verschiebt alle Zeichen des Strings, angefangen von der nStartPos,
// 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 +169,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 +183,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 +213,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 +238,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 +246,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 +297,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 +307,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 +326,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 +338,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
@@ -379,19 +373,16 @@ TODO: ggf einen 'intelligenten' Peek-Parser um Rundungsfehler bei
// In bFoundFirstDigit wird ggf. ein Flag gesetzt wenn eine Ziffer
// gefunden wurde, dies wird dazu verwendet um 'Fehler' beim Parsen 202
// zu vermeiden, die
-//
// 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 dTemp = dNumber;
- double dDigit,dPos;
+ double dDigit;
short nMaxDigit;
// erst mal aus der Zahl eine positive Zahl machen:
dNumber = fabs( dNumber );
- dPos = (double)nPos;
// "uberpr"ufe ob Zahl zu klein f"ur angegebene Stelle ist
nMaxDigit = (short)get_number_of_digits( dNumber );
@@ -401,7 +392,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;
@@ -433,14 +424,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 );
@@ -452,10 +443,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 )
{
@@ -465,7 +456,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;
@@ -479,10 +470,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 )
{
@@ -494,7 +485,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 )
@@ -511,10 +502,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 )
{
@@ -531,7 +522,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 );
}
}
@@ -548,11 +539,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();
@@ -562,9 +553,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
@@ -573,7 +564,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 ) {
@@ -616,15 +607,10 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
return -1; // ERROR: zu viele Dezimal-Punkte
break;
case '%':
- bPercent = TRUE;
- /* old:
- bPercent++;
- if( bPercent>1 )
- return -2; // ERROR: zu viele Prozent-Zeichen
- */
+ bPercent = sal_True;
break;
case '(':
- bCurrency = TRUE;
+ bCurrency = sal_True;
break;
case ',':
{
@@ -640,13 +626,8 @@ 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++;
- if( bScientific>1 )
- return -3; // ERROR: zu viele Exponent-Zeichen
- */
break;
// EIGENES Kommando-Zeichen, das die Erzeugung der
// Tausender-Trennzeichen einschaltet
@@ -655,7 +636,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
i++;
break;
case CREATE_1000SEP_CHAR:
- bGenerateThousandSeparator = TRUE;
+ bGenerateThousandSeparator = sal_True;
break;
}
}
@@ -666,12 +647,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();
@@ -693,23 +674,11 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
- sonstige Fehler ? mehrfache Dezimalpunkte, E's, etc.
--> Fehler werden zur Zeit einfach ignoriert
*/
- /*nErr =*/ AnalyseFormatString( sFormatStrg,nNoOfDigitsLeft,nNoOfDigitsRight,
+ AnalyseFormatString( sFormatStrg,nNoOfDigitsLeft,nNoOfDigitsRight,
nNoOfOptionalDigitsLeft,nNoOfExponentDigits,
nNoOfOptionalExponentDigits,
bPercent,bCurrency,bScientific,bGenerateThousandSeparator,
nMultipleThousandSeparators );
- /* es werden alle Fehler ignoriert, wie in Visual-Basic
- if( nErr!=0 )
- {
- char sBuffer[512];
-
- //sprintf( sBuffer,"bad format-string >%s< err=%i",sFormatStrg,nErr );
- strcpy( sBuffer,"bad format-string" );
- ShowError( sBuffer );
- }
- else
- */
- {
// Spezialbehandlung f"ur Spezialzeichen
if( bPercent )
dNumber *= 100.0;
@@ -722,12 +691,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 );
@@ -737,8 +706,6 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
bDigitPosNegative = false;
if( bScientific )
{
- //if( nNoOfOptionalDigitsLeft>0 )
- // ShowError( "# in scientific-format in front of the decimal-point has no effect" );
// beim Exponent ggf. "uberz"ahlige Stellen vor dem Komma abziehen
dExponent = dExponent - (double)(nNoOfDigitsLeft-1);
nDigitPos = nMaxDigit;
@@ -751,8 +718,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;
@@ -782,14 +749,13 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
// Behandlung der Mantisse
if( bFirstDigit )
{
- //org:bFirstDigit = FALSE;
// ggf. Vorzeichen erzeugen
// Bem.: bei bCurrency soll das negative
// Vorzeichen durch () angezeigt werden
- if( bIsNegative && !bCreateSign/*!bCurrency*/ && !bSignHappend )
+ if( bIsNegative && !bCreateSign && !bSignHappend )
{
// nur einmal ein Vorzeichen ausgeben
- bSignHappend = TRUE;
+ bSignHappend = sal_True;
StrAppendChar( sReturnStrg,'-' );
}
// hier jetzt "uberz"ahlige Stellen ausgeben,
@@ -807,7 +773,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 );
@@ -819,7 +785,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,
@@ -839,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 ) && nDigitPos>0 && (nDigitPos % 3 == 0) )
StrAppendChar( sReturnStrg,cThousandSep );
@@ -853,7 +819,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
@@ -914,7 +880,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
break;
}
- BOOL bOverflow = FALSE;
+ sal_Bool bOverflow = sal_False;
#ifdef _with_sprintf
short nNextDigit = GetDigitAtPosScan( nDigitPos,bFoundFirstDigit );
#else
@@ -960,19 +926,9 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
else
StrAppendChar( sReturnStrg,'+' );
}
- //else
- // ShowError( "operator e/E did not find + or -" );
}
- //else
- // ShowError( "operator e/E ended with 0" );
break;
case ',':
- // ACHTUNG: nur falls Zahl bisher ausgegeben wurde
- // das Zeichen ausgeben
- ////--> Siehe Kommentar vom 11.7. in AnalyseFormatString()
- ////if( !bFirstDigit )
- //// // gebe Tausender-Trennzeichen aus
- //// StrAppendChar( sReturnStrg,cThousandSep );
break;
case ';':
break;
@@ -1002,12 +958,9 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
ParseBack( sReturnStrg,sFormatStrg,i-1 );
// Sonderzeichen gefunden, gebe N"ACHSTES
// Zeichen direkt aus (falls es existiert)
- // i++;
c = sFormatStrg.GetChar( ++i );
if( c!=0 )
StrAppendChar( sReturnStrg,c );
- //else
- // ShowError( "operator \\ ended with 0" );
break;
case CREATE_1000SEP_CHAR:
// hier ignorieren, Aktion wurde schon in
@@ -1019,9 +972,6 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
( c>='A' && c<='Z' ) ||
( c>='1' && c<='9' ) )
StrAppendChar( sReturnStrg,c );
- // else
- // ignorieren !
- // ehemals: ShowError( "bad character in format-string" );
}
}
// Format-String wurde vollst"andig gescanned,
@@ -1043,12 +993,11 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
// ABER nur Stellen nach dem Dezimal-Punkt k"onnen gel"oscht werden
if( nNoOfDigitsRight>0 )
ParseBack( sReturnStrg,sFormatStrg,sFormatStrg.Len()-1 );
- }
}
String SbxBasicFormater::BasicFormatNull( String sFormatStrg )
{
- BOOL bNullFormatFound;
+ sal_Bool bNullFormatFound;
String sNullFormatStrg = GetNullFormatString( sFormatStrg,bNullFormatFound );
if( bNullFormatFound )
@@ -1060,7 +1009,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 ) )
@@ -1087,7 +1036,6 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
String sPosFormatStrg = GetPosFormatString( sFormatStrg, bPosFormatFound );
String sNegFormatStrg = GetNegFormatString( sFormatStrg, bNegFormatFound );
String s0FormatStrg = Get0FormatString( sFormatStrg, b0FormatFound );
- //String sNullFormatStrg = GetNullFormatString( sFormatStrg, bNullFormatFound );
String sReturnStrg;
String sTempStrg;
@@ -1109,7 +1057,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
{
@@ -1138,33 +1086,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 1bf1836889..558f971c72 100644
--- 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,8 +94,24 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT;
}
else
- nRes = (INT16) ImpRound( p->nSingle );
+ nRes = (sal_Int16) ImpRound( p->nSingle );
break;
+ case SbxCURRENCY:
+ {
+ sal_Int64 tstVal = (sal_Int64) p->nInt64 / (sal_Int64) CURRENCY_FACTOR;
+
+ if( tstVal > SbxMAXINT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXINT;
+ }
+ else if( tstVal < SbxMININT )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT;
+ }
+ else
+ nRes = (sal_Int16) (tstVal);
+ break;
+ }
case SbxSALINT64:
if( p->nInt64 > SbxMAXINT )
{
@@ -106,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 )
@@ -114,26 +130,16 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXINT;
}
else
- nRes = (INT16) p->uInt64;
+ nRes = (sal_Int16) p->uInt64;
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
+ {
+ double dVal = 0.0;
+ if( p->eType == SbxDECIMAL )
{
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
- {
- dVal = 0.0;
if( p->pDecimal )
p->pDecimal->getDouble( dVal );
}
@@ -149,7 +155,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT;
}
else
- nRes = (INT16) ImpRound( dVal );
+ nRes = (sal_Int16) ImpRound( dVal );
break;
}
case SbxLPSTR:
@@ -172,7 +178,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMININT;
}
else
- nRes = (INT16) ImpRound( d );
+ nRes = (sal_Int16) ImpRound( d );
}
break;
case SbxOBJECT:
@@ -208,11 +214,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -227,7 +229,7 @@ start:
return nRes;
}
-void ImpPutInteger( SbxValues* p, INT16 n )
+void ImpPutInteger( SbxValues* p, sal_Int16 n )
{
SbxValues aTmp;
start:
@@ -249,7 +251,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // frome here no longer
+ // from here no tests needed
case SbxINTEGER:
case SbxBOOL:
p->nInteger = n; break;
@@ -260,14 +262,10 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setInt( n );
@@ -304,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;
@@ -314,21 +312,24 @@ 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:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
if( n < 0 )
{
- SbxBase::SetError( SbxERR_OVERFLOW ); *p->puInt64 = 0;
+ SbxBase::SetError( SbxERR_OVERFLOW );
+ *p->puInt64 = 0;
}
else
*p->puInt64 = n;
@@ -338,12 +339,6 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
@@ -385,6 +380,7 @@ sal_uInt64 ImpDoubleToSalUInt64( double d )
return nRes;
}
+
double ImpSalUInt64ToDouble( sal_uInt64 n )
{
double d = 0.0;
@@ -416,33 +412,20 @@ start:
nRes = p->nInteger; break;
case SbxERROR:
case SbxUSHORT:
- nRes = p->nUShort; break;
+ nRes = (sal_Int64) p->nUShort; break;
case SbxLONG:
- nRes = p->nLong; break;
+ nRes = (sal_Int64) p->nLong; break;
case SbxULONG:
nRes = (sal_Int64) p->nULong; break;
case SbxSINGLE:
- nRes = ImpDoubleToSalInt64( (double)p->nSingle );
+ nRes = (sal_Int64) p->nSingle;
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
- {
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else
- dVal = p->nDouble;
-
- nRes = ImpDoubleToSalInt64( dVal );
+ nRes = (sal_Int64) p->nDouble;
break;
- }
+ case SbxCURRENCY:
+ nRes = p->nInt64 / CURRENCY_FACTOR; break;
case SbxSALINT64:
nRes = p->nInt64; break;
case SbxSALUINT64:
@@ -472,7 +455,7 @@ start:
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else
- nRes = ImpDoubleToSalInt64( d );
+ nRes = (sal_Int64) d;
}
}
break;
@@ -499,10 +482,15 @@ start:
nRes = *p->pLong; break;
case SbxBYREF | SbxULONG:
nRes = *p->pULong; break;
+ case SbxBYREF | SbxCURRENCY:
+ nRes = p->nInt64 / CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
nRes = *p->pnInt64; break;
// from here the values has to be checked
+ case SbxBYREF | SbxSALUINT64:
+ aTmp.uInt64 = *p->puInt64; goto ref;
+
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
aTmp.nUShort = *p->pUShort; goto ref;
@@ -511,13 +499,6 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
- case SbxBYREF | SbxSALUINT64:
- aTmp.uInt64 = *p->puInt64; goto ref;
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -543,11 +524,6 @@ start:
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
case SbxERROR:
@@ -555,6 +531,9 @@ start:
aTmp.pUShort = &p->nUShort; goto direct;
case SbxLONG:
aTmp.pnInt64 = &p->nInt64; goto direct;
+ case SbxCURRENCY:
+ case SbxSALINT64:
+ aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
aTmp.puInt64 = &p->uInt64; goto direct;
@@ -562,9 +541,6 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // Check not neccessary
- case SbxSALINT64:
- p->nInt64 = n; break;
case SbxSINGLE:
p->nSingle = (float) n; break;
case SbxDATE:
@@ -611,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 )
@@ -622,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 )
@@ -633,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 )
{
@@ -643,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 )
{
@@ -653,23 +629,14 @@ 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:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
case SbxBYREF | SbxCURRENCY:
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = (sal_Int64) SbxMAXCURR;
- }
- else if( n < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = (sal_Int64) SbxMINCURR;
- }
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
-
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
@@ -710,27 +677,16 @@ start:
case SbxULONG:
nRes = (sal_uInt64) p->nULong; break;
case SbxSINGLE:
- nRes = ImpDoubleToSalUInt64( (double)p->nSingle );
- break;
+ nRes = (sal_uInt64) p->nSingle; break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
{
- double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else
- dVal = p->nDouble;
-
- nRes = ImpDoubleToSalUInt64( dVal );
+//TODO overflow check
+ nRes = (sal_uInt64) p->nDouble;
break;
}
+ case SbxCURRENCY:
+ nRes = p->nInt64 * CURRENCY_FACTOR; break;
case SbxSALINT64:
if( p->nInt64 < 0 )
{
@@ -738,6 +694,7 @@ start:
}
else
nRes = (sal_uInt64) p->nInt64;
+ break;
case SbxSALUINT64:
nRes = p->uInt64; break;
@@ -805,7 +762,7 @@ start:
case SbxBYREF | SbxSALUINT64:
nRes = *p->puInt64; break;
- // from here the values has to be checked
+ // from here on the value has to be checked
case SbxBYREF | SbxERROR:
case SbxBYREF | SbxUSHORT:
aTmp.nUShort = *p->pUShort; goto ref;
@@ -814,11 +771,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
ref:
@@ -846,11 +799,6 @@ start:
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
case SbxERROR:
@@ -858,6 +806,7 @@ start:
aTmp.pUShort = &p->nUShort; goto direct;
case SbxLONG:
aTmp.pnInt64 = &p->nInt64; goto direct;
+ case SbxCURRENCY:
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSINGLE:
@@ -908,45 +857,43 @@ 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:
case SbxBYREF | SbxDOUBLE:
+
*p->pDouble = ImpSalUInt64ToDouble( n ); break;
case SbxBYREF | SbxCURRENCY:
- if( n > SbxMAXSALINT64 || (sal_Int64)n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); n = (sal_Int64) SbxMAXCURR;
- }
- *p->pLong64 = ImpDoubleToCurrency( (double)(sal_Int64) n ); break;
-
+ if ( n > ( SbxMAXSALINT64 / CURRENCY_FACTOR ) )
+ SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXSALINT64;
+ *p->pnInt64 = ( sal_Int64) ( n * CURRENCY_FACTOR ); break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
case SbxBYREF | SbxSALINT64:
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index 748034171d..654bc86dd0 100644
--- 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,30 +73,30 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINLNG;
}
else
- nRes = (INT32) ImpRound( p->nSingle );
+ nRes = (sal_Int32) ImpRound( p->nSingle );
break;
- case SbxDATE:
- case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
case SbxSALINT64:
+ nRes = p->nInt64;
+ break;
case SbxSALUINT64:
+ nRes = p->uInt64;
+ break;
case SbxCURRENCY:
+ {
+ sal_Int64 tstVal = p->nInt64 / CURRENCY_FACTOR;
+ nRes = (sal_Int32) (tstVal);
+ if( tstVal < SbxMINLNG || SbxMAXLNG < tstVal ) SbxBase::SetError( SbxERR_OVERFLOW );
+ if( SbxMAXLNG < tstVal ) nRes = SbxMAXLNG;
+ if( tstVal < SbxMINLNG ) nRes = SbxMINLNG;
+ break;
+ }
+ case SbxDATE:
+ case SbxDOUBLE:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxSALINT64 )
- dVal = static_cast< double >(p->nInt64);
- else if( p->eType == SbxSALUINT64 )
- dVal = ImpSalUInt64ToDouble( p->uInt64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -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:
@@ -173,15 +173,12 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
aTmp.uInt64 = *p->puInt64; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
+
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -192,7 +189,7 @@ start:
return nRes;
}
-void ImpPutLong( SbxValues* p, INT32 n )
+void ImpPutLong( SbxValues* p, sal_Int32 n )
{
SbxValues aTmp;
@@ -207,11 +204,6 @@ start:
case SbxINTEGER:
case SbxBOOL:
aTmp.pInteger = &p->nInteger; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxULONG:
aTmp.pULong = &p->nULong; goto direct;
case SbxSALUINT64:
@@ -231,6 +223,8 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxDECIMAL:
@@ -273,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 )
@@ -284,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 )
@@ -295,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:
@@ -303,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:
@@ -320,21 +314,7 @@ start:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
case SbxBYREF | SbxCURRENCY:
- double d;
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMAXCURR;
- }
- else if( n < SbxMINCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMINCURR;
- }
- else
- {
- d = n;
- }
- *p->pLong64 = ImpDoubleToCurrency( d ); break;
-
+ *p->pnInt64 = (sal_Int64)n * (sal_Int64)CURRENCY_FACTOR; break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index afc7debdc9..2ad0e4ef6e 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -31,7 +31,6 @@
#include <tools/stream.hxx>
#include <vcl/sound.hxx>
#include <basic/sbx.hxx>
-#include <basic/sbxbase.hxx>
#include "sbxres.hxx"
#include <svl/brdcst.hxx>
@@ -42,11 +41,9 @@ 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;
-/////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////
SbxObject::SbxObject( const XubString& rClass )
: SbxVariable( SbxOBJECT ), aClassName( rClass )
@@ -79,27 +76,27 @@ SbxObject& SbxObject::operator=( const SbxObject& r )
pMethods = new SbxArray;
pProps = new SbxArray;
pObjs = new SbxArray( SbxOBJECT );
- // Die Arrays werden kopiert, die Inhalte uebernommen
+ // The arrays were copied, the content taken over
*pMethods = *r.pMethods;
*pProps = *r.pProps;
*pObjs = *r.pObjs;
- // Da die Variablen uebernommen wurden, ist dies OK
+ // Because the variables were taken over, this is OK
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 );
- // Hat das Element mehr als eine Referenz und noch einen Listener?
+ pObj->EndListening( rRef->GetBroadcaster(), sal_True );
+ // Did the element have more then one reference and still a Listener?
if( rRef->GetRefCount() > 1 )
{
rRef->SetParent( NULL );
@@ -113,6 +110,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
@@ -137,7 +137,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&,
@@ -146,14 +146,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 ) )
{
@@ -174,12 +174,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;
@@ -189,17 +189,17 @@ SbxVariable* SbxObject::FindUserData( UINT32 nData )
pRes = pProps->FindUserData( nData );
if( !pRes )
pRes = pObjs->FindUserData( nData );
- // Search in den Parents?
+ // Search in the parents?
if( !pRes && IsSet( SBX_GBLSEARCH ) )
{
SbxObject* pCur = this;
while( !pRes && pCur->pParent )
{
- // Ich selbst bin schon durchsucht worden!
- USHORT nOwn = pCur->GetFlags();
+ // I myself was already searched through!
+ sal_uInt16 nOwn = pCur->GetFlags();
pCur->ResetFlag( SBX_EXTSEARCH );
- // Ich suche bereits global!
- USHORT nPar = pCur->pParent->GetFlags();
+ // I search already global!
+ sal_uInt16 nPar = pCur->pParent->GetFlags();
pCur->pParent->ResetFlag( SBX_GBLSEARCH );
pRes = pCur->pParent->FindUserData( nData );
pCur->SetFlags( nOwn );
@@ -213,7 +213,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 );
@@ -251,22 +251,22 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t )
if( pArray )
pRes = pArray->Find( rName, t );
}
- // Extended Search im Objekt-Array?
- // Fuer Objekte und DontCare ist das Objektarray bereits
- // durchsucht worden
+ // ExtendedsSearch in the Object-Array?
+ // For objects and DontCare is the Objektarray already
+ // searched through
if( !pRes && ( t == SbxCLASS_METHOD || t == SbxCLASS_PROPERTY ) )
pRes = pObjs->Find( rName, t );
- // Search in den Parents?
+ // Search in the parents?
if( !pRes && IsSet( SBX_GBLSEARCH ) )
{
SbxObject* pCur = this;
while( !pRes && pCur->pParent )
{
- // Ich selbst bin schon durchsucht worden!
- USHORT nOwn = pCur->GetFlags();
+ // I myself was already searched through!
+ sal_uInt16 nOwn = pCur->GetFlags();
pCur->ResetFlag( SBX_EXTSEARCH );
- // Ich suche bereits global!
- USHORT nPar = pCur->pParent->GetFlags();
+ // I search already global!
+ sal_uInt16 nPar = pCur->pParent->GetFlags();
pCur->pParent->ResetFlag( SBX_GBLSEARCH );
pRes = pCur->pParent->Find( rName, t );
pCur->SetFlags( nOwn );
@@ -287,27 +287,27 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t )
return pRes;
}
-// Kurzform: Die Parent-Kette wird durchsucht
-// Das ganze rekursiv, da Call() ueberladen sein kann
-// Qualified Names sind zugelassen
+// Abbreviated version: The parent-string will be searched through
+// 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) )
{
- // FindQualified() koennte schon zugeschlagen haben!
+ // FindQualified() might have been stroked!
if( 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()
+SbxProperty* SbxObject::GetDfltProperty()
{
if ( !pDfltProp && aDfltPropName.Len() )
{
@@ -320,16 +320,16 @@ SbxProperty* SbxObject::GetDfltProperty()
void SbxObject::SetDfltProperty( const XubString& rName )
{
if ( rName != aDfltPropName )
- pDfltProp = NULL;
+ 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 )
@@ -337,14 +337,14 @@ void SbxObject::SetDfltProperty( SbxProperty* p )
Broadcast( SBX_HINT_OBJECTCHANGED );
}
pDfltProp = p;
- SetModified( TRUE );
+ SetModified( sal_True );
}
-// Suchen einer bereits vorhandenen Variablen. Falls sie gefunden wurde,
-// wird der Index gesetzt, sonst wird der Count des Arrays geliefert.
-// In jedem Fall wird das korrekte Array geliefert.
+// 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() )
@@ -359,11 +359,11 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, USHORT& nArrayIdx )
if( pArray )
{
nArrayIdx = pArray->Count();
- // ist die Variable per Name vorhanden?
+ // Is the variable per name available?
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 )
@@ -375,12 +375,12 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, USHORT& nArrayIdx )
return pArray;
}
-// Falls ein neues Objekt eingerichtet wird, wird es, falls es bereits
-// eines mit diesem Namen gibt, indiziert.
+// If a new object will be established, this object will be indexed,
+// if an object of this name exists already.
SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataType dt )
{
- // Ist das Objekt bereits vorhanden?
+ // Is the object already available?
SbxArray* pArray = NULL;
switch( ct )
{
@@ -393,26 +393,12 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
}
if( !pArray )
return NULL;
- // Collections duerfen gleichnamige Objekte enthalten
+ // Collections may contain objects of the same name
if( !( ct == SbxCLASS_OBJECT && ISA(SbxCollection) ) )
{
SbxVariable* pRes = pArray->Find( rName, ct );
if( pRes )
{
-/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus
-#ifdef DBG_UTIL
- if( pRes->GetHashCode() != nNameHash
- && pRes->GetHashCode() != nParentHash )
- {
- XubString aMsg( "SBX-Element \"" );
- aMsg += pRes->GetName();
- aMsg += "\"\n in Objekt \"";
- aMsg += GetName();
- aMsg += "\" bereits vorhanden";
- DbgError( (const char*)aMsg.GetStr() );
- }
-#endif
-*/
return pRes;
}
}
@@ -433,35 +419,21 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
}
pVar->SetParent( this );
pArray->Put( pVar, pArray->Count() );
- SetModified( TRUE );
- // Das Objekt lauscht immer
- StartListening( pVar->GetBroadcaster(), TRUE );
+ SetModified( sal_True );
+ // The object listen always
+ StartListening( pVar->GetBroadcaster(), sal_True );
Broadcast( SBX_HINT_OBJECTCHANGED );
return pVar;
}
SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClass )
{
- // Ist das Objekt bereits vorhanden?
+ // Is the object already available?
if( !ISA(SbxCollection) )
{
SbxVariable* pRes = pObjs->Find( rName, SbxCLASS_OBJECT );
if( pRes )
{
-/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus
-#ifdef DBG_UTIL
- if( pRes->GetHashCode() != nNameHash
- && pRes->GetHashCode() != nParentHash )
- {
- XubString aMsg( "SBX-Objekt \"" );
- aMsg += pRes->GetName();
- aMsg += "\"\n in Objekt \"";
- aMsg += GetName();
- aMsg += "\" bereits vorhanden";
- DbgError( (const char*)aMsg.GetStr() );
- }
-#endif
-*/
return PTR_CAST(SbxObject,pRes);
}
}
@@ -471,9 +443,9 @@ SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClas
pVar->SetName( rName );
pVar->SetParent( this );
pObjs->Put( pVar, pObjs->Count() );
- SetModified( TRUE );
- // Das Objekt lauscht immer
- StartListening( pVar->GetBroadcaster(), TRUE );
+ SetModified( sal_True );
+ // The object listen always
+ StartListening( pVar->GetBroadcaster(), sal_True );
Broadcast( SBX_HINT_OBJECTCHANGED );
}
return pVar;
@@ -481,39 +453,25 @@ 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 )
{
- // Hinein damit. Man sollte allerdings auf die Pointer aufpassen!
+ // Into with it. But you should pay attention at the Pointer!
if( nIdx < pArray->Count() )
{
- // dann gibt es dieses Element bereits
- // Bei Collections duerfen gleichnamige Objekte hinein
+ // Then this element exists already
+ // There are objects of the same name allowed at collections
if( pArray == pObjs && ISA(SbxCollection) )
nIdx = pArray->Count();
else
{
SbxVariable* pOld = pArray->Get( nIdx );
- // schon drin: ueberschreiben
+ // already inside: overwrite
if( pOld == pVar )
return;
-/* Wegen haeufiger Probleme (z.B. #67000) erstmal ganz raus
-#ifdef DBG_UTIL
- if( pOld->GetHashCode() != nNameHash
- && pOld->GetHashCode() != nParentHash )
- {
- XubString aMsg( "SBX-Element \"" );
- aMsg += pVar->GetName();
- aMsg += "\"\n in Objekt \"";
- aMsg += GetName();
- aMsg += "\" bereits vorhanden";
- DbgError( (const char*)aMsg.GetStr() );
- }
-#endif
-*/
- EndListening( pOld->GetBroadcaster(), TRUE );
+ EndListening( pOld->GetBroadcaster(), sal_True );
if( pVar->GetClass() == SbxCLASS_PROPERTY )
{
if( pOld == pDfltProp )
@@ -521,11 +479,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[] =
@@ -543,8 +501,8 @@ void SbxObject::Insert( SbxVariable* pVar )
}
}
-// AB 23.4.1997, Optimierung, Einfuegen ohne Ueberpruefung auf doppelte
-// Eintraege und ohne Broadcasts, wird nur in SO2/auto.cxx genutzt
+// Optimisation, Insertion without checking about
+// double entry and without broadcasts, will only be used in SO2/auto.cxx
void SbxObject::QuickInsert( SbxVariable* pVar )
{
SbxArray* pArray = NULL;
@@ -562,11 +520,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" };
@@ -583,7 +541,7 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Spezial-Methode, gleichnamige Controls zulassen
+// special method, allow controls of the same name
void SbxObject::VCPtrInsert( SbxVariable* pVar )
{
SbxArray* pArray = NULL;
@@ -601,11 +559,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 );
}
}
@@ -617,7 +575,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() )
{
@@ -630,40 +588,40 @@ 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 );
}
}
-// AB 23.3.1997, Loeschen per Pointer fuer Controls (doppelte Namen!)
+// cleanup per Pointer for Controls (double names!)
void SbxObject::VCPtrRemove( SbxVariable* pVar )
{
- USHORT nIdx;
- // Neu FindVar-Methode, sonst identisch mit normaler Methode
+ 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 );
}
}
-// AB 23.3.1997, Zugehoerige Spezial-Methode, nur ueber Pointer suchen
-SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, USHORT& nArrayIdx )
+// associated special method, search only by Pointer
+SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
{
SbxArray* pArray = NULL;
if( pVar ) switch( pVar->GetClass() )
@@ -678,7 +636,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 )
@@ -692,9 +650,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 )
{
@@ -707,53 +665,51 @@ void SbxObject::SetPos( SbxVariable* pVar, USHORT nPos )
pArray->Insert( refVar, nPos );
}
}
-// SetModified( 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;
}
-// Der Load eines Objekts ist additiv!
+// The load of an object is additive!
-BOOL SbxObject::LoadData( SvStream& rStrm, USHORT nVer )
+sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
- // Hilfe fuer das Einlesen alter Objekte: einfach TRUE zurueck,
- // LoadPrivateData() muss Default-Zustand herstellen
+ // 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;
- // Wenn kein fremdes Objekt enthalten ist, uns selbst eintragen
+ return sal_False;
+ // If it contains no alien object, insert ourselves
if( aData.eType == SbxOBJECT && !aData.pObj )
aData.pObj = this;
sal_uInt32 nSize;
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 )
@@ -761,49 +717,49 @@ BOOL SbxObject::LoadData( SvStream& rStrm, USHORT nVer )
if( !LoadArray( rStrm, this, pMethods )
|| !LoadArray( rStrm, this, pProps )
|| !LoadArray( rStrm, this, pObjs ) )
- return FALSE;
- // Properties setzen
+ 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,
const SbxObject* )
{
- // Properties in einem String einsammeln
+ // Collect the properties in a String
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() );
@@ -811,7 +767,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
&& !( xProp->GetHashCode() == nNameHash
&& aPropName.EqualsIgnoreCaseAscii( pNameProp ) ) )
{
- // ausser vor dem ersten Property immer einen Umbruch einfuegen
+ // Insert a break except in front of the first property
if ( bLineFeed )
aSource.AppendAscii( "\n" );
else
@@ -822,17 +778,17 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
aSource += aPropName;
aSource.AppendAscii( " = " );
- // den Property-Wert textuell darstellen
+ // Display the property value textual
switch ( xProp->GetType() )
{
case SbxEMPTY:
case SbxNULL:
- // kein Wert
+ // no value
break;
case SbxSTRING:
{
- // Strings in Anf"uhrungszeichen
+ // Strings in quotation mark
aSource.AppendAscii( "\"" );
aSource += xProp->GetString();
aSource.AppendAscii( "\"" );
@@ -841,7 +797,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
default:
{
- // sonstiges wie z.B. Zahlen direkt
+ // miscellaneous, such as e.g.numerary directly
aSource += xProp->GetString();
break;
}
@@ -851,7 +807,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() )
@@ -879,19 +835,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 )
{
- // Einr"uckung
- static USHORT nLevel = 0;
+ // Shifting
+ static sal_uInt16 nLevel = 0;
if ( nLevel > 10 )
{
rStrm << "<too deep>" << endl;
@@ -899,18 +855,18 @@ 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( " " );
- // ggf. Objekt vervollst"andigen
+ // if necessary complete the object
if ( bFill )
GetAll( SbxCLASS_DONTCARE );
- // Daten des Objekts selbst ausgeben
+ // Output the data of the object itself
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 "
@@ -920,7 +876,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
@@ -939,7 +895,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;
@@ -955,7 +911,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill )
aLine.AppendAscii( " !! Not a Method !!" );
rStrm.WriteByteString( aLine, RTL_TEXTENCODING_ASCII_US );
- // bei Object-Methods auch das Object ausgeben
+ // Output also the object at object-methods
if ( pVar->GetValues_Impl().eType == SbxOBJECT &&
pVar->GetValues_Impl().pObj &&
pVar->GetValues_Impl().pObj != this &&
@@ -972,7 +928,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;
@@ -988,7 +944,7 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill )
aLine.AppendAscii( " !! Not a Property !!" );
rStrm.WriteByteString( aLine, RTL_TEXTENCODING_ASCII_US );
- // bei Object-Properties auch das Object ausgeben
+ // output also the object at object properties
if ( pVar->GetValues_Impl().eType == SbxOBJECT &&
pVar->GetValues_Impl().pObj &&
pVar->GetValues_Impl().pObj != this &&
@@ -1006,7 +962,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;
@@ -1030,7 +986,7 @@ SvDispatch* SbxObject::GetSvDispatch()
return NULL;
}
-BOOL SbxMethod::Run( SbxValues* pValues )
+sal_Bool SbxMethod::Run( SbxValues* pValues )
{
SbxValues aRes;
if( !pValues )
@@ -1049,16 +1005,15 @@ SbxClassType SbxProperty::GetClass() const
return SbxCLASS_PROPERTY;
}
-void SbxObject::GarbageCollection( ULONG /*nObjects*/ )
+void SbxObject::GarbageCollection( sal_uIntPtr /* nObjects */ )
-/* [Beschreibung]
+/* [Description]
- Diese statische Methode durchsucht die n"achsten 'nObjects' der zur Zeit
- existierenden <SbxObject>-Instanzen nach zyklischen Referenzen, die sich
- nur noch selbst am Leben erhalten. Ist 'nObjects==0', dann werden
- alle existierenden durchsucht.
+ This statistic method browse the next 'nObjects' of the currently existing
+ <SbxObject>-Instances for cyclic references, which keep only themselfes alive
+ If there is 'nObjects==0', then all existing will be browsed.
- zur Zeit nur implementiert: Object -> Parent-Property -> Parent -> Object
+ currently only implemented: Object -> Parent-Property -> Parent -> Object
*/
{
diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx
index 612911aaad..1db3372b9e 100644
--- 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 eb2e202665..483302da95 100644
--- 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 aeff9a4108..a1df7f7e7b 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -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;
@@ -262,7 +262,6 @@ SbxError SbxValue::ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle
return nRetError;
}
-////////////////////////////////////////////////////////////////////////////
static double roundArray[] = {
5.0e+0, 0.5e+0, 0.5e-1, 0.5e-2, 0.5e-3, 0.5e-4, 0.5e-5, 0.5e-6, 0.5e-7,
@@ -270,26 +269,26 @@ 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
short nDig = nPrec + 1; // Anzahl Digits in Zahl
short nDec; // Anzahl Vorkommastellen
- register int i, digit;
+ register int i;
// Komma besorgen
sal_Unicode cDecimalSep, cThousandSep;
@@ -339,6 +338,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
// Zahl ausgeben:
if( nDig > 0 )
{
+ register int digit;
for( i = 0 ; ; ++i )
{
if( i < 16 )
@@ -390,7 +390,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;
@@ -406,7 +406,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--;
@@ -421,13 +421,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-Fälle behandeln, als Default tun wir nichts
+ // Nur Spezial-F�lle behandeln, als Default tun wir nichts
switch( eTargetType )
{
// Bei Fliesskomma International beruecksichtigen
@@ -450,25 +450,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;
}
@@ -489,7 +489,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
@@ -498,10 +498,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;
@@ -517,7 +517,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 = '$';
@@ -536,7 +536,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:
@@ -550,14 +550,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?
@@ -572,12 +572,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();
@@ -602,12 +602,11 @@ 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() )
@@ -626,10 +625,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;
}
@@ -647,7 +646,7 @@ ResMgr* implGetResMgr( void )
class SbxValueFormatResId : public ResId
{
public:
- SbxValueFormatResId( USHORT nId )
+ SbxValueFormatResId( sal_uInt16 nId )
: ResId( nId, *implGetResMgr() )
{}
};
@@ -662,7 +661,7 @@ enum VbaFormatType
struct VbaFormatInfo
{
- VbaFormatType meType;
+ VbaFormatType meType;
const char* mpVbaFormat; // Format string in vba
NfIndexTableOffset meOffset; // SvNumberFormatter format index, if meType = VBA_FORMAT_TYPE_OFFSET
const char* mpOOoFormat; // if meType = VBA_FORMAT_TYPE_USERDEFINED
@@ -674,12 +673,12 @@ struct VbaFormatInfo
#define VBA_FORMAT_USERDEFINED( pcUtf8, pcDefinedUtf8 ) \
{ VBA_FORMAT_TYPE_USERDEFINED, pcUtf8, NF_NUMBER_STANDARD, pcDefinedUtf8 }
-static VbaFormatInfo pFormatInfoTable[] =
+static VbaFormatInfo pFormatInfoTable[] =
{
VBA_FORMAT_OFFSET( "Long Date", NF_DATE_SYSTEM_LONG ),
VBA_FORMAT_USERDEFINED( "Medium Date", "DD-MMM-YY" ),
VBA_FORMAT_OFFSET( "Short Date", NF_DATE_SYSTEM_SHORT ),
- VBA_FORMAT_USERDEFINED( "Long Time", "H:MM:SS AM/PM" ),
+ VBA_FORMAT_USERDEFINED( "Long Time", "H:MM:SS AM/PM" ),
VBA_FORMAT_OFFSET( "Medium Time", NF_TIME_HHMMAMPM ),
VBA_FORMAT_OFFSET( "Short Time", NF_TIME_HHMM ),
VBA_FORMAT_OFFSET( "ddddd", NF_DATE_SYSTEM_SHORT ),
@@ -692,12 +691,12 @@ 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 ) )
break;
- i++;
+ i++;
}
return pInfo;
}
@@ -712,11 +711,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
{
@@ -724,7 +723,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
double d = 0;
// pflin, It is better to use SvNumberFormatter to handle the date/time/number format.
- // the SvNumberFormatter output is mostly compatible with
+ // the SvNumberFormatter output is mostly compatible with
// VBA output besides the OOo-basic output
if( pFmt && !SbxBasicFormater::isBasicFormat( *pFmt ) )
{
@@ -742,21 +741,21 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
}
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
xFactory = comphelper::getProcessServiceFactory();
SvNumberFormatter aFormatter( xFactory, eLangType );
sal_uInt32 nIndex;
- xub_StrLen nCheckPos = 0;
- short nType;
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.
+ // number format, use SvNumberFormatter to handle it.
if( bSuccess )
{
+ xub_StrLen nCheckPos = 0;
+ short nType;
String aFmtStr = *pFmt;
VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
if( pInfo && pInfo->meType != VBA_FORMAT_TYPE_NULL )
@@ -773,14 +772,14 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
}
else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_GENERALDATE )
- || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_C ))
+ || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_C ))
{
if( nNumber <=-1.0 || nNumber >= 1.0 )
{
- // short date
+ // short date
nIndex = aFormatter.GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLangType );
aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
-
+
// long time
if( floor( nNumber ) != nNumber )
{
@@ -801,9 +800,9 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
}
}
else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_N )
- || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ))
+ || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ))
{
- INT32 nMin = implGetMinute( nNumber );
+ sal_Int32 nMin = implGetMinute( nNumber );
if( nMin < 10 && aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ) )
{
// Minute in two digits
@@ -818,15 +817,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
@@ -931,8 +930,6 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
rRes = pData->pBasicFormater->BasicFormatNull( *pFmt );
}
- // Die alte Implementierung:
- //old: printfmtnum( GetDouble(), rRes, *pFmt );
}
else
{
@@ -947,7 +944,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 21dd38f444..5c7f0c74a1 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -59,10 +59,6 @@ start:
nRes = (float) p->nULong; break;
case SbxSINGLE:
nRes = p->nSingle; break;
- case SbxSALINT64:
- nRes = (float) p->nInt64; break;
- case SbxSALUINT64:
- nRes = (float) ImpSalUInt64ToDouble( p->uInt64 ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
if( p->pDecimal )
@@ -72,17 +68,17 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
case SbxCURRENCY:
+ case SbxSALINT64:
+ case SbxSALUINT64:
{
double dVal;
if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
+ dVal = ImpCurrencyToDouble( p->nInt64 );
+ else if( p->eType == SbxSALINT64 )
+ dVal = (float) p->nInt64;
+ else if( p->eType == SbxSALUINT64 )
+ dVal = (float) p->uInt64;
else
dVal = p->nDouble;
@@ -96,6 +92,7 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW );
nRes = static_cast< float >(SbxMINSNG);
}
+ // tests for underflow - storing value too small for precision of single
else if( dVal > 0 && dVal < SbxMAXSNG2 )
{
SbxBase::SetError( SbxERR_OVERFLOW );
@@ -167,15 +164,11 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxSALINT64:
- nRes = (float) *p->pnInt64; break;
- case SbxBYREF | SbxSALUINT64:
- nRes = (float) ImpSalUInt64ToDouble( *p->puInt64 ); break;
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
+ aTmp.nInt64 = *p->pnInt64; goto ref;
+ case SbxBYREF | SbxSALUINT64:
+ aTmp.uInt64 = *p->puInt64; goto ref;
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -206,11 +199,7 @@ start:
case SbxERROR:
case SbxUSHORT:
aTmp.pUShort = &p->nUShort; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
case SbxSALINT64:
aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
@@ -271,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 )
@@ -282,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 )
@@ -293,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;
@@ -307,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;
@@ -324,7 +313,7 @@ start:
}
else
{
- i = sal::static_int_cast< UINT32 >(n);
+ i = sal::static_int_cast< sal_uInt32 >(n);
}
*p->pULong = i; break;
}
@@ -334,9 +323,9 @@ start:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = (double) n; break;
case SbxBYREF | SbxSALINT64:
- *p->pnInt64 = ImpDoubleToSalInt64( (double) n ); break;
+ *p->pnInt64 = (sal_Int64)n; break;
case SbxBYREF | SbxSALUINT64:
- *p->puInt64 = ImpDoubleToSalUInt64( (double) n ); break;
+ *p->puInt64 = (sal_uInt64)n; break;
case SbxBYREF | SbxCURRENCY:
double d;
if( n > SbxMAXCURR )
@@ -351,7 +340,7 @@ start:
{
d = n;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( d ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index ebfc7a01c2..4ac819c717 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -35,8 +35,8 @@
#include "runtime.hxx"
#include <rtl/ustrbuf.hxx>
-// Die Konversion eines Items auf String wird ueber die Put-Methoden
-// der einzelnen Datentypen abgewickelt, um doppelten Code zu vermeiden.
+// The conversion of an item onto String was handled via the Put-Methods
+// of the several data types to avoid double code.
::rtl::OUString ImpGetString( const SbxValues* p )
{
@@ -69,7 +69,7 @@
case SbxDOUBLE:
ImpPutDouble( &aTmp, p->nDouble ); break;
case SbxCURRENCY:
- ImpPutCurrency( &aTmp, p->nLong64 ); break;
+ ImpPutCurrency( &aTmp, p->nInt64 ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpPutDecimal( &aTmp, p->pDecimal ); break;
@@ -101,7 +101,7 @@
break;
}
case SbxERROR:
- // Hier wird der String "Error n" erzeugt
+ // Here will be created the String "Error n"
aRes = SbxRes( STRING_ERRORMSG );
aRes += ::rtl::OUString( p->nUShort ); break;
case SbxDATE:
@@ -127,7 +127,7 @@
case SbxBYREF | SbxDOUBLE:
ImpPutDouble( &aTmp, *p->pDouble ); break;
case SbxBYREF | SbxCURRENCY:
- ImpPutCurrency( &aTmp, *p->pLong64 ); break;
+ ImpPutCurrency( &aTmp, *p->pnInt64 ); break;
case SbxBYREF | SbxSALINT64:
ImpPutInt64( &aTmp, *p->pnInt64 ); break;
case SbxBYREF | SbxSALUINT64:
@@ -138,19 +138,19 @@
return aRes;
}
-// AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString()
+// From 1997-04-10, new function for SbxValue::GetCoreString()
::rtl::OUString ImpGetCoreString( const SbxValues* p )
{
- // Vorerst nur fuer double
+ // For now only for double
if( ( p->eType & (~SbxBYREF) ) == SbxDOUBLE )
{
SbxValues aTmp;
XubString aRes;
aTmp.eType = SbxSTRING;
if( p->eType == SbxDOUBLE )
- ImpPutDouble( &aTmp, p->nDouble, /*bCoreString=*/TRUE );
+ ImpPutDouble( &aTmp, p->nDouble, sal_True ); // true = bCoreString
else
- ImpPutDouble( &aTmp, *p->pDouble, /*bCoreString=*/TRUE );
+ ImpPutDouble( &aTmp, *p->pDouble, sal_True ); // true = bCoreString
return aRes;
}
else
@@ -162,7 +162,7 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
SbxValues aTmp;
aTmp.eType = SbxSTRING;
::rtl::OUString* pTmp = NULL;
- // Sicherheitshalber, falls ein NULL-Ptr kommt
+ // as a precaution, if a NULL-Ptr appears
if( !n )
n = pTmp = new ::rtl::OUString;
aTmp.pOUString = (::rtl::OUString*)n;
@@ -188,8 +188,8 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
p->nDouble = ImpGetDate( &aTmp ); break;
case SbxDOUBLE:
p->nDouble = ImpGetDouble( &aTmp ); break;
- case SbxULONG64:
- p->nLong64 = ImpGetCurrency( &aTmp ); break;
+ case SbxCURRENCY:
+ p->nInt64 = ImpGetCurrency( &aTmp ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
releaseDecimalPtr( p->pDecimal );
@@ -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:
@@ -244,13 +244,18 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
case SbxBYREF | SbxDOUBLE:
*p->pDouble = ImpGetDouble( p ); break;
case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpGetCurrency( p ); break;
+ *p->pnInt64 = ImpGetCurrency( p ); break;
+ case SbxBYREF | SbxSALINT64:
+ *p->pnInt64 = ImpGetInt64( p ); break;
+ case SbxBYREF | SbxSALUINT64:
+ *p->puInt64 = ImpGetUInt64( p ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
delete pTmp;
}
+
// Convert string to an array of bytes, preserving unicode (2bytes per character)
SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
{
@@ -270,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 );
@@ -286,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 )
@@ -312,4 +317,5 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
return aStrBuf.makeStringAndClear();
}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index d5123b814a..4a368c0ec6 100644
--- 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,19 @@ 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 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXUINT;
+ }
+ else if( p->nInt64 < 0 )
+ {
+ SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
+ }
+ else
+ nRes = (sal_uInt16) (p->nInt64 / CURRENCY_FACTOR);
break;
case SbxSALINT64:
if( p->nInt64 > SbxMAXUINT )
@@ -91,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 )
@@ -99,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 )
@@ -111,24 +123,15 @@ 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:
- case SbxLONG64:
- case SbxULONG64:
- case SbxCURRENCY:
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
double dVal;
- if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
- else if( p->eType == SbxDECIMAL )
+ if( p->eType == SbxDECIMAL )
{
dVal = 0.0;
if( p->pDecimal )
@@ -146,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:
@@ -169,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:
@@ -190,7 +193,7 @@ start:
case SbxBYREF | SbxUSHORT:
nRes = *p->pUShort; break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYREF | SbxCHAR:
aTmp.nChar = *p->pChar; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -205,11 +208,7 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
@@ -224,7 +223,7 @@ start:
return nRes;
}
-void ImpPutUShort( SbxValues* p, UINT16 n )
+void ImpPutUShort( SbxValues* p, sal_uInt16 n )
{
SbxValues aTmp;
@@ -243,22 +242,18 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
+ p->nInt64 = n * CURRENCY_FACTOR; break;
case SbxSALINT64:
p->nInt64 = n; break;
case SbxSALUINT64:
p->uInt64 = n; break;
- case SbxULONG64:
- p->nULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxLONG64:
- p->nLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxCURRENCY:
- p->nLong64 = ImpDoubleToCurrency( (double)n ); break;
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
ImpCreateDecimal( p )->setUInt( n );
break;
- // Tests ab hier
+ // from here on tests
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -294,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;
@@ -314,16 +309,12 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxULONG64:
- *p->pULong64 = ImpDoubleToUINT64( (double)n ); break;
- case SbxBYREF | SbxLONG64:
- *p->pLong64 = ImpDoubleToINT64( (double)n ); break;
- case SbxBYREF | SbxCURRENCY:
- *p->pLong64 = ImpDoubleToCurrency( (double)n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index 13c91f8e52..d1d876324d 100644
--- 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,12 +81,10 @@ 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:
- case SbxLONG64:
- case SbxULONG64:
case SbxSALINT64:
case SbxSALUINT64:
case SbxCURRENCY:
@@ -95,11 +93,7 @@ start:
{
double dVal;
if( p->eType == SbxCURRENCY )
- dVal = ImpCurrencyToDouble( p->nLong64 );
- else if( p->eType == SbxLONG64 )
- dVal = ImpINT64ToDouble( p->nLong64 );
- else if( p->eType == SbxULONG64 )
- dVal = ImpUINT64ToDouble( p->nULong64 );
+ dVal = ImpCurrencyToDouble( p->nInt64 );
else if( p->eType == SbxSALINT64 )
dVal = static_cast< double >(p->nInt64);
else if( p->eType == SbxSALUINT64 )
@@ -122,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:
@@ -145,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:
@@ -168,7 +162,7 @@ start:
case SbxBYREF | SbxULONG:
nRes = *p->pULong; break;
- // Tests ab hier
+ // from here on tests
case SbxBYREF | SbxCHAR:
aTmp.nChar = *p->pChar; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -181,15 +175,11 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
aTmp.nDouble = *p->pDouble; goto ref;
+ case SbxBYREF | SbxCURRENCY:
case SbxBYREF | SbxSALINT64:
aTmp.nInt64 = *p->pnInt64; goto ref;
case SbxBYREF | SbxSALUINT64:
aTmp.uInt64 = *p->puInt64; goto ref;
- case SbxBYREF | SbxULONG64:
- aTmp.nULong64 = *p->pULong64; goto ref;
- case SbxBYREF | SbxLONG64:
- case SbxBYREF | SbxCURRENCY:
- aTmp.nLong64 = *p->pLong64; goto ref;
ref:
aTmp.eType = SbxDataType( p->eType & 0x0FFF );
p = &aTmp; goto start;
@@ -200,7 +190,7 @@ start:
return nRes;
}
-void ImpPutULong( SbxValues* p, UINT32 n )
+void ImpPutULong( SbxValues* p, sal_uInt32 n )
{
SbxValues aTmp;
start:
@@ -213,8 +203,9 @@ start:
case SbxDATE:
case SbxDOUBLE:
p->nDouble = n; break;
+ case SbxCURRENCY:
case SbxSALINT64:
- p->nInt64 = n; break;
+ aTmp.pnInt64 = &p->nInt64; goto direct;
case SbxSALUINT64:
p->uInt64 = n; break;
case SbxDECIMAL:
@@ -222,7 +213,7 @@ start:
ImpCreateDecimal( p )->setULong( n );
break;
- // Tests ab hier
+ // from here on tests
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxUINT:
@@ -235,11 +226,6 @@ start:
case SbxERROR:
case SbxUSHORT:
aTmp.pUShort = &p->nUShort; goto direct;
- case SbxULONG64:
- aTmp.pULong64 = &p->nULong64; goto direct;
- case SbxLONG64:
- case SbxCURRENCY:
- aTmp.pLong64 = &p->nLong64; goto direct;
direct:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
@@ -271,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:
@@ -299,21 +285,12 @@ start:
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
*p->pDouble = n; break;
+ case SbxBYREF | SbxCURRENCY:
+ *p->pnInt64 = n * CURRENCY_FACTOR; break;
case SbxBYREF | SbxSALINT64:
*p->pnInt64 = n; break;
case SbxBYREF | SbxSALUINT64:
*p->puInt64 = n; break;
- case SbxBYREF | SbxCURRENCY:
- double d;
- if( n > SbxMAXCURR )
- {
- SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMAXCURR;
- }
- else
- {
- d = n;
- }
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
diff --git a/basic/source/sbx/sbxvals.cxx b/basic/source/sbx/sbxvals.cxx
index 4f08b3ba5f..443089a123 100644
--- a/basic/source/sbx/sbxvals.cxx
+++ b/basic/source/sbx/sbxvals.cxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,21 +48,21 @@ SbxValues::SbxValues( const BigInt &rBig ) : eType(SbxCURRENCY)
#pragma warning(disable: 4273)
#endif
-BOOL BigInt::INT64( SbxINT64 *p ) const
+sal_Bool BigInt::INT64( SbxINT64 *p ) const
{
if( bIsBig ) {
if( nLen > 4 || (nNum[3] & 0x8000) )
- return FALSE;
+ return sal_False;
- p->nLow = ((UINT32)nNum[1] << 16) | (UINT32)nNum[0];
- p->nHigh = ((UINT32)nNum[3] << 16) | (UINT32)nNum[2];
+ 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( (INT32)nVal );
+ p->Set( (sal_Int32)nVal );
- return TRUE;
+ return sal_True;
}
BigInt::BigInt( const SbxINT64 &r )
@@ -73,28 +72,28 @@ BigInt::BigInt( const SbxINT64 &r )
*this = r.nHigh;
if( r.nHigh )
*this *= a10000;
- *this += (USHORT)(r.nLow >> 16);
+ *this += (sal_uInt16)(r.nLow >> 16);
*this *= a10000;
- *this += (USHORT)r.nLow;
+ *this += (sal_uInt16)r.nLow;
}
-BOOL BigInt::UINT64( SbxUINT64 *p ) const
+sal_Bool BigInt::UINT64( SbxUINT64 *p ) const
{
if( bIsBig ) {
if( bIsNeg || nLen > 4 )
- return FALSE;
+ return sal_False;
- p->nLow = ((UINT32)nNum[1] << 16) | (UINT32)nNum[0];
- p->nHigh = ((UINT32)nNum[3] << 16) | (UINT32)nNum[2];
+ 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 FALSE;
+ return sal_False;
- p->Set( (UINT32)nVal );
+ p->Set( (sal_uInt32)nVal );
}
- return TRUE;
+ return sal_True;
}
BigInt::BigInt( const SbxUINT64 &r )
@@ -104,9 +103,7 @@ BigInt::BigInt( const SbxUINT64 &r )
*this = BigInt(r.nHigh);
if( r.nHigh )
*this *= a10000;
- *this += (USHORT)(r.nLow >> 16);
+ *this += (sal_uInt16)(r.nLow >> 16);
*this *= a10000;
- *this += (USHORT)r.nLow;
+ *this += (sal_uInt16)r.nLow;
}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 2c22aa246f..e21234ccac 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -29,154 +29,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#define _TLBIGINT_INT64
-#include <tools/bigint.hxx>
+#include <math.h>
#include <tools/stream.hxx>
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
-#include <math.h>
#include "runtime.hxx"
TYPEINIT1(SbxValue,SbxBase)
-/////////////////////////// SbxINT64 /////////////////////////////////////
-SbxINT64 &SbxINT64::operator -= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b -= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator += ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b += BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator *= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b *= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator %= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b %= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator /= ( const SbxINT64 &r )
-{
- BigInt b( *this );
- b /= BigInt( r );
- b.INT64( this );
- return *this;
-}
-SbxINT64 &SbxINT64::operator &= ( const SbxINT64 &r )
-{
- nHigh &= r.nHigh;
- nLow &= r.nLow;
- return *this;
-}
-SbxINT64 &SbxINT64::operator |= ( const SbxINT64 &r )
-{
- nHigh |= r.nHigh;
- nLow |= r.nLow;
- return *this;
-}
-SbxINT64 &SbxINT64::operator ^= ( const SbxINT64 &r )
-{
- nHigh ^= r.nHigh;
- nLow ^= r.nLow;
- return *this;
-}
-
-SbxINT64 operator - ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a -= r;
- return a;
-}
-SbxINT64 operator + ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a += r;
- return a;
-}
-SbxINT64 operator / ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a /= r;
- return a;
-}
-SbxINT64 operator % ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a %= r;
- return a;
-}
-SbxINT64 operator * ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a(l);
- a *= r;
- return a;
-}
-SbxINT64 operator & ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a;
- a.nHigh = r.nHigh & l.nHigh;
- a.nLow = r.nLow & l.nLow;
- return a;
-}
-SbxINT64 operator | ( const SbxINT64 &l, const SbxINT64 &r )
-{
- SbxINT64 a;
- a.nHigh = r.nHigh | l.nHigh;
- a.nLow = r.nLow | l.nLow;
- return a;
-}
-SbxINT64 operator ^ ( const SbxINT64 &r, const SbxINT64 &l )
-{
- SbxINT64 a;
- a.nHigh = r.nHigh ^ l.nHigh;
- a.nLow = r.nLow ^ l.nLow;
- return a;
-}
-
-SbxINT64 operator - ( const SbxINT64 &r )
-{
- SbxINT64 a( r );
- a.CHS();
- return a;
-}
-SbxINT64 operator ~ ( const SbxINT64 &r )
-{
- SbxINT64 a;
- a.nHigh = ~r.nHigh;
- a.nLow = ~r.nLow;
- return a;
-}
-
-SbxUINT64 &SbxUINT64::operator %= ( const SbxUINT64 &r )
-{
- BigInt b( *this );
- b %= BigInt( r );
- b.UINT64( this );
- return *this;
-}
-SbxUINT64 &SbxUINT64::operator /= ( const SbxUINT64 &r )
-{
- BigInt b( *this );
- b /= BigInt( r );
- b.UINT64( this );
- return *this;
-}
-/////////////////////////// Error processing /////////////////////////////
+///////////////////////////// error handling //////////////////////////////
+// bring back ?? was ever in ?? currently ifdef out ?
#ifdef _USED
// STILL Reverse ENGINEERING!
@@ -198,13 +62,12 @@ int matherr( struct _exception* p )
#endif
default: SbxBase::SetError( SbxERR_NOTIMP ); break;
}
- return TRUE;
+ return sal_True;
}
#endif
#endif // _USED
-
///////////////////////////// constructors //////////////////////////////
SbxValue::SbxValue() : SbxBase()
@@ -224,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 SbxULONG64: n |= SbxBYREF; aData.pULong64 = (SbxUINT64*) p; break;
- case SbxLONG64:
- case SbxCURRENCY: n |= SbxBYREF; aData.pLong64 = (SbxINT64*) p; break;
- case SbxLONG: n |= SbxBYREF; aData.pLong = (INT32*) 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 = (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 SbxCHAR: n |= SbxBYREF; aData.pChar = (xub_Unicode*) p; break;
- case SbxBYTE: n |= SbxBYREF; aData.pByte = (BYTE*) 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 = (sal_uInt8*) p; break;
case SbxINT: n |= SbxBYREF; aData.pInt = (int*) p; break;
case SbxOBJECT:
aData.pObj = (SbxBase*) p;
@@ -359,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();
}
@@ -390,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();
}
@@ -416,7 +279,7 @@ void SbxValue::Clear()
// Dummy
-void SbxValue::Broadcast( ULONG )
+void SbxValue::Broadcast( sal_uIntPtr )
{}
//////////////////////////// Readout data //////////////////////////////
@@ -428,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( ;; )
@@ -449,7 +314,7 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
// If this is an object and contains itself,
// we cannot access on it
- // #55226# The old condition to set an error
+ // The old condition to set an error
// is not correct, because e.g. a regular variant variable with an object
// could be affected thereof, if another value should be assigned.
// Therefore with flag.
@@ -457,15 +322,15 @@ 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;
- /* ALT:
- else
- p = pDflt ? pDflt : (SbxVariable*) pObj;
- */
break;
}
// Did we have an array?
@@ -501,9 +366,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();
@@ -534,11 +399,11 @@ BOOL SbxValue::Get( SbxValues& rRes ) const
case SbxSALUINT64: rRes.uInt64 = ImpGetUInt64( &p->aData ); break;
case SbxSINGLE: rRes.nSingle = ImpGetSingle( &p->aData ); break;
case SbxDOUBLE: rRes.nDouble = ImpGetDouble( &p->aData ); break;
- case SbxCURRENCY:rRes.nLong64 = ImpGetCurrency( &p->aData ); break;
+ case SbxCURRENCY:rRes.nInt64 = ImpGetCurrency( &p->aData ); break;
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;
@@ -593,18 +458,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;
}
@@ -644,7 +509,7 @@ const XubString& SbxValue::GetCoreString() const
return aResult;
}
-BOOL SbxValue::HasObject() const
+sal_Bool SbxValue::HasObject() const
{
ErrCode eErr = GetError();
SbxValues aRes;
@@ -654,43 +519,41 @@ 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( GetChar, SbxCHAR, xub_Unicode, nChar )
-GET( GetCurrency, SbxCURRENCY, SbxINT64, nLong64 )
-GET( GetDate, SbxDATE, double, nDouble )
-GET( GetData, SbxDATAOBJECT, void*, pData )
-GET( GetDouble, SbxDOUBLE, double, nDouble )
-GET( GetErr, SbxERROR, UINT16, nUShort )
-GET( GetInt, SbxINT, int, nInt )
-GET( GetInteger, SbxINTEGER, INT16, nInteger )
-GET( GetLong, SbxLONG, INT32, nLong )
-GET( GetLong64, SbxLONG64, SbxINT64, nLong64 )
-GET( GetObject, SbxOBJECT, SbxBase*, pObj )
-GET( GetSingle, SbxSINGLE, float, nSingle )
-GET( GetULong, SbxULONG, UINT32, nULong )
-GET( GetULong64, SbxULONG64, SbxUINT64, nULong64 )
-GET( GetUShort, SbxUSHORT, UINT16, nUShort )
-GET( GetInt64, SbxSALINT64, sal_Int64, nInt64 )
-GET( GetUInt64, SbxSALUINT64, sal_uInt64, uInt64 )
-GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal )
+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, sal_uInt16, nUShort )
+GET( GetInt, SbxINT, int, nInt )
+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, 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 )
//////////////////////////// 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();
@@ -704,7 +567,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() )
@@ -721,7 +584,7 @@ BOOL SbxValue::Put( const SbxValues& rVal )
case SbxSALUINT64: ImpPutUInt64( &p->aData, rVal.uInt64 ); break;
case SbxSINGLE: ImpPutSingle( &p->aData, rVal.nSingle ); break;
case SbxDOUBLE: ImpPutDouble( &p->aData, rVal.nDouble ); break;
- case SbxCURRENCY: ImpPutCurrency( &p->aData, rVal.nLong64 ); break;
+ case SbxCURRENCY: ImpPutCurrency( &p->aData, rVal.nInt64 ); break;
case SbxDECIMAL: ImpPutDecimal( &p->aData, rVal.pDecimal ); break;
case SbxDATE: ImpPutDate( &p->aData, rVal.nDouble ); break;
case SbxBOOL: ImpPutBool( &p->aData, rVal.nInteger ); break;
@@ -733,16 +596,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:
@@ -763,12 +626,12 @@ BOOL SbxValue::Put( const SbxValues& rVal )
{
if ( p != this )
{
- DBG_ERROR( "TheRealValue" );
+ OSL_FAIL( "TheRealValue" );
}
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();
}
@@ -788,11 +651,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;
}
}
}
@@ -806,7 +669,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 );
@@ -821,7 +684,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
@@ -829,7 +692,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 )
@@ -841,7 +704,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)
@@ -852,104 +715,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( PutChar, SbxCHAR, xub_Unicode, nChar )
-PUT( PutCurrency, SbxCURRENCY, const SbxINT64&, nLong64 )
+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( PutLong64, SbxLONG64, const SbxINT64&, nLong64 )
+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( PutULong64, SbxULONG64, const SbxUINT64&, nULong64 )
-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 )
@@ -957,7 +818,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;
}
@@ -966,22 +827,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) )
@@ -994,14 +855,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 ) );
}
@@ -1021,19 +882,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;
}
@@ -1041,7 +902,7 @@ BOOL SbxValue::SetType( SbxDataType t )
{
if( !CanWrite() || IsFixed() )
{
- SetError( SbxERR_CONVERSION ); return FALSE;
+ SetError( SbxERR_CONVERSION ); return sal_False;
}
else
{
@@ -1056,12 +917,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();
}
@@ -1073,31 +934,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:
@@ -1111,17 +972,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();
@@ -1183,34 +1044,24 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
else if( eOpType == SbxSTRING && rOp.IsFixed() )
{ // Numeric: there is no String allowed on the right side
SetError( SbxERR_CONVERSION );
+ // falls all the way out
}
else if( ( eOp >= SbxIDIV && eOp <= SbxNOT ) || eOp == SbxMOD )
{
if( GetType() == eOpType )
{
- if( GetType() == SbxULONG64
- || GetType() == SbxLONG64
- || GetType() == SbxCURRENCY
- || GetType() == SbxULONG )
+ if( GetType() == SbxSALUINT64 || GetType() == SbxSALINT64
+ || GetType() == SbxCURRENCY || GetType() == SbxULONG )
aL.eType = aR.eType = GetType();
-// else if( GetType() == SbxDouble || GetType() == SbxSingle )
-// aL.eType = aR.eType = SbxLONG64;
else if ( bVBAInterop && eOpType == SbxBOOL )
aL.eType = aR.eType = SbxBOOL;
else
aL.eType = aR.eType = SbxLONG;
}
- else if( GetType() == SbxCURRENCY || eOpType == SbxCURRENCY
- || GetType() == SbxULONG64 || eOpType == SbxULONG64
- || GetType() == SbxLONG64 || eOpType == SbxLONG64 )
- aL.eType = aR.eType = SbxLONG64;
-// else if( GetType() == SbxDouble || rOP.GetType() == SbxDouble
-// || GetType() == SbxSingle || rOP.GetType() == SbxSingle )
-// aL.eType = aR.eType = SbxLONG64;
else
aL.eType = aR.eType = SbxLONG;
- if( rOp.Get( aR ) )
+ if( rOp.Get( aR ) ) // re-do Get after type assigns above
{
if( rOp.GetType() == SbxEMPTY )
{
@@ -1221,13 +1072,17 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
case SbxIDIV:
if( aL.eType == SbxCURRENCY )
- aL.eType = SbxLONG64;
- if( aL.eType == SbxLONG64 )
- if( !aR.nLong64 ) SetError( SbxERR_ZERODIV );
- else aL.nLong64 /= aR.nLong64;
- else if( aL.eType == SbxULONG64 )
- if( !aR.nULong64 ) SetError( SbxERR_ZERODIV );
- else aL.nULong64 /= aR.nULong64;
+ if( !aR.nInt64 ) SetError( SbxERR_ZERODIV );
+ else {
+ aL.nInt64 /= aR.nInt64;
+ aL.nInt64 *= CURRENCY_FACTOR;
+ }
+ else if( aL.eType == SbxSALUINT64 )
+ if( !aR.uInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.uInt64 /= aR.uInt64;
+ else if( aL.eType == SbxSALINT64 )
+ if( !aR.nInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.nInt64 /= aR.nInt64;
else if( aL.eType == SbxLONG )
if( !aR.nLong ) SetError( SbxERR_ZERODIV );
else aL.nLong /= aR.nLong;
@@ -1236,14 +1091,12 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
else aL.nULong /= aR.nULong;
break;
case SbxMOD:
- if( aL.eType == SbxCURRENCY )
- aL.eType = SbxLONG64;
- if( aL.eType == SbxLONG64 )
- if( !aR.nLong64 ) SetError( SbxERR_ZERODIV );
- else aL.nLong64 %= aR.nLong64;
- else if( aL.eType == SbxULONG64 )
- if( !aR.nULong64 ) SetError( SbxERR_ZERODIV );
- else aL.nULong64 %= aR.nULong64;
+ if( aL.eType == SbxCURRENCY || aL.eType == SbxSALINT64 )
+ if( !aR.nInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.nInt64 %= aR.nInt64;
+ else if( aL.eType == SbxSALUINT64 )
+ if( !aR.uInt64 ) SetError( SbxERR_ZERODIV );
+ else aL.uInt64 %= aR.uInt64;
else if( aL.eType == SbxLONG )
if( !aR.nLong ) SetError( SbxERR_ZERODIV );
else aL.nLong %= aR.nLong;
@@ -1253,31 +1106,31 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
break;
case SbxAND:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 &= aR.nLong64;
+ aL.nInt64 &= aR.nInt64;
else
aL.nLong &= aR.nLong;
break;
case SbxOR:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 |= aR.nLong64;
+ aL.nInt64 |= aR.nInt64;
else
aL.nLong |= aR.nLong;
break;
case SbxXOR:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 ^= aR.nLong64;
+ aL.nInt64 ^= aR.nInt64;
else
aL.nLong ^= aR.nLong;
break;
case SbxEQV:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = (aL.nLong64 & aR.nLong64) | (~aL.nLong64 & ~aR.nLong64);
+ aL.nInt64 = (aL.nInt64 & aR.nInt64) | (~aL.nInt64 & ~aR.nInt64);
else
aL.nLong = (aL.nLong & aR.nLong) | (~aL.nLong & ~aR.nLong);
break;
case SbxIMP:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = ~aL.nLong64 | aR.nLong64;
+ aL.nInt64 = ~aL.nInt64 | aR.nInt64;
else
aL.nLong = ~aL.nLong | aR.nLong;
break;
@@ -1285,7 +1138,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
{
if ( aL.eType != SbxBOOL )
- aL.nLong64 = ~aL.nLong64;
+ aL.nInt64 = ~aL.nInt64;
else
aL.nLong = ~aL.nLong;
}
@@ -1296,8 +1149,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
}
}
- else if( ( GetType() == SbxDECIMAL || rOp.GetType() == SbxDECIMAL ) &&
- ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS || eOp == SbxNEG ) )
+ else if( ( GetType() == SbxDECIMAL || rOp.GetType() == SbxDECIMAL )
+ && ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS || eOp == SbxNEG ) )
{
aL.eType = aR.eType = SbxDECIMAL;
bDecimal = true;
@@ -1353,52 +1206,81 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
if( rOp.Get( aR ) )
{
- static BigInt n10K( 10000 );
-
if( rOp.GetType() == SbxEMPTY )
goto Lbl_OpIsEmpty;
if( Get( aL ) ) switch( eOp )
{
+ double dTest;
case SbxMUL:
- {
- // #i20704 Implement directly
- BigInt b1( aL.nLong64 );
- BigInt b2( aR.nLong64 );
- b1 *= b2;
- b1 /= n10K;
- double d = double( b1 ) / 10000.0;
- if( d > SbxMAXCURR || d < SbxMINCURR )
+ // first overflow check: see if product will fit - test real value of product (hence 2 curr factors)
+ dTest = (double)aL.nInt64 * (double)aR.nInt64 / (double)CURRENCY_FACTOR_SQUARE;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
+ {
+ aL.nInt64 = SAL_MAX_INT64;
+ if( dTest < SbxMINCURR ) aL.nInt64 = SAL_MIN_INT64;
SetError( SbxERR_OVERFLOW );
- else
- b1.INT64( &aL.nLong64 );
+ break;
+ }
+ // second overflow check: see if unscaled product overflows - if so use doubles
+ dTest = (double)aL.nInt64 * (double)aR.nInt64;
+ if( dTest < SAL_MIN_INT64 || SAL_MAX_INT64 < dTest)
+ {
+ aL.nInt64 = (sal_Int64)( dTest / (double)CURRENCY_FACTOR );
+ break;
+ }
+ // precise calc: multiply then scale back (move decimal pt)
+ aL.nInt64 *= aR.nInt64;
+ aL.nInt64 /= CURRENCY_FACTOR;
break;
- }
+
case SbxDIV:
- if( !aR.nLong64 )
+ if( !aR.nInt64 )
{
SetError( SbxERR_ZERODIV );
+ break;
}
- else
+ // first overflow check: see if quotient will fit - calc real value of quotient (curr factors cancel)
+ dTest = (double)aL.nInt64 / (double)aR.nInt64;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
{
- // #i20704 Implement directly
- BigInt b1( aL.nLong64 );
- BigInt b2( aR.nLong64 );
- b1 *= n10K;
- b1 /= b2;
- double d = double( b1 ) / 10000.0;
- if( d > SbxMAXCURR || d < SbxMINCURR )
- SetError( SbxERR_OVERFLOW );
- else
- b1.INT64( &aL.nLong64 );
+ SetError( SbxERR_OVERFLOW );
+ break;
+ }
+ // second overflow check: see if scaled dividend overflows - if so use doubles
+ dTest = (double)aL.nInt64 * (double)CURRENCY_FACTOR;
+ if( dTest < SAL_MIN_INT64 || SAL_MAX_INT64 < dTest)
+ {
+ aL.nInt64 = (sal_Int64)(dTest / (double)aR.nInt64);
+ break;
}
+ // precise calc: scale (move decimal pt) then divide
+ aL.nInt64 *= CURRENCY_FACTOR;
+ aL.nInt64 /= aR.nInt64;
break;
+
case SbxPLUS:
- aL.nLong64 += aR.nLong64; break;
+ dTest = ( (double)aL.nInt64 + (double)aR.nInt64 ) / (double)CURRENCY_FACTOR;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
+ {
+ SetError( SbxERR_OVERFLOW );
+ break;
+ }
+ aL.nInt64 += aR.nInt64;
+ break;
+
case SbxMINUS:
- aL.nLong64 -= aR.nLong64; break;
+ dTest = ( (double)aL.nInt64 - (double)aR.nInt64 ) / (double)CURRENCY_FACTOR;
+ if( dTest < SbxMINCURR || SbxMAXCURR < dTest)
+ {
+ SetError( SbxERR_OVERFLOW );
+ break;
+ }
+ aL.nInt64 -= aR.nInt64;
+ break;
case SbxNEG:
- aL.nLong64 = -aL.nLong64; break;
+ aL.nInt64 = -aL.nInt64;
+ break;
default:
SetError( SbxERR_NOTIMP );
}
@@ -1406,7 +1288,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
else
Lbl_OpIsDouble:
- { // other operators
+ { // other types and operators including Date, Double and Single
aL.eType = aR.eType = SbxDOUBLE;
if( rOp.Get( aR ) )
{
@@ -1429,6 +1311,9 @@ Lbl_OpIsDouble:
else aL.nDouble /= aR.nDouble; break;
case SbxPLUS:
aL.nDouble += aR.nDouble; break;
+ // #45465 Date needs with "+" a special handling: forces date type
+ if( GetType() == SbxDATE || rOp.GetType() == SbxDATE )
+ aL.eType = SbxDATE;
case SbxMINUS:
aL.nDouble -= aR.nDouble; break;
case SbxNEG:
@@ -1437,9 +1322,6 @@ Lbl_OpIsDouble:
SetError( SbxERR_NOTIMP );
}
- // #45465 Date needs with "+" a special handling
- if( eOp == SbxPLUS && (GetType() == SbxDATE || rOp.GetType() == SbxDATE ) )
- aL.eType = SbxDATE;
}
}
@@ -1454,7 +1336,7 @@ Lbl_OpIsDouble:
}
Lbl_OpIsEmpty:
- BOOL bRes = BOOL( !IsError() );
+ sal_Bool bRes = sal_Bool( !IsError() );
if( bRes && eOld != SbxERR_OK )
SetError( eOld );
return bRes;
@@ -1462,11 +1344,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();
@@ -1474,24 +1356,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;
@@ -1503,17 +1385,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 );
}
@@ -1527,17 +1409,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 );
}
@@ -1553,17 +1435,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 );
}
@@ -1579,24 +1461,23 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
else
{
aL.eType = aR.eType = SbxDOUBLE;
- //if( Get( aL ) && rOp.Get( aR ) )
bool bGetL = Get( aL );
bool bGetR = rOp.Get( aR );
if( bGetL && bGetR )
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 );
}
@@ -1608,7 +1489,7 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION )
{
ResetError();
- bRes = FALSE;
+ bRes = sal_False;
}
}
}
@@ -1620,10 +1501,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 )
@@ -1643,7 +1526,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;
@@ -1658,19 +1541,25 @@ 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;
}
- case SbxULONG64:
- {
- r >> aData.nULong64.nHigh >> aData.nULong64.nLow;
+ case SbxSALUINT64:
+ case SbxSALINT64:
+ // Rather ugly use of the union here because we only
+ // have a SvStream& SvStream::operator>>(sal_uInt64&) available to us
+ // There is no SvStream::operator>>(sal_Int64&) due to conflict with
+ // SvStream::operator>>(long&) ( at least on 64 bit linux )
+ r >> aData.uInt64;
break;
- }
- case SbxLONG64:
case SbxCURRENCY:
{
- r >> aData.nLong64.nHigh >> aData.nLong64.nLow;
+ sal_uInt32 tmpHi = 0;
+ sal_uInt32 tmpLo = 0;
+ r >> tmpHi >> tmpLo;
+ aData.nInt64 = ((sal_Int64)tmpHi << 32);
+ aData.nInt64 |= (sal_Int64)tmpLo;
break;
}
case SbxSTRING:
@@ -1688,7 +1577,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
r >> aData.nUShort; break;
case SbxOBJECT:
{
- BYTE nMode;
+ sal_uInt8 nMode;
r >> nMode;
switch( nMode )
{
@@ -1697,7 +1586,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;
@@ -1717,7 +1606,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 )
@@ -1728,7 +1617,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 )
@@ -1753,14 +1642,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 )
{
@@ -1779,15 +1668,16 @@ BOOL SbxValue::StoreData( SvStream& r ) const
case SbxDOUBLE:
r.WriteByteString( GetCoreString(), RTL_TEXTENCODING_ASCII_US );
break;
- case SbxULONG64:
- {
- r << aData.nULong64.nHigh << aData.nULong64.nLow;
+ case SbxSALUINT64:
+ case SbxSALINT64:
+ // see comment in SbxValue::StoreData
+ r << aData.uInt64;
break;
- }
- case SbxLONG64:
case SbxCURRENCY:
{
- r << aData.nLong64.nHigh << aData.nLong64.nLow;
+ sal_Int32 tmpHi = ( (aData.nInt64 >> 32) & 0xFFFFFFFF );
+ sal_Int32 tmpLo = ( sal_Int32 )aData.nInt64;
+ r << tmpHi << tmpLo;
break;
}
case SbxSTRING:
@@ -1810,14 +1700,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:
{
@@ -1831,13 +1721,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;
}
@@ -1854,9 +1744,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 9ea647e673..b91eb87b11 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -34,7 +34,6 @@
#include "svl/brdcst.hxx"
#include <basic/sbx.hxx>
-#include <basic/sbxbase.hxx>
#include "sbxres.hxx"
#include "sbxconv.hxx"
#include <math.h>
@@ -48,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 ////////////////////////////
@@ -60,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 )
+ {
+ }
};
@@ -81,16 +84,21 @@ SbxVariable::SbxVariable() : SbxValue()
nHash = 0;
#ifdef DBG_UTIL
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#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() )
{
@@ -110,7 +118,6 @@ SbxVariable::SbxVariable( const SbxVariable& r )
if ( maName.EqualsAscii( aCellsStr ) )
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#endif
}
@@ -123,10 +130,11 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
nHash = 0;
#ifdef DBG_UTIL
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#endif
}
+void removeDimAsNewRecoverItem( SbxVariable* pVar );
+
SbxVariable::~SbxVariable()
{
#ifdef DBG_UTIL
@@ -135,8 +143,9 @@ SbxVariable::~SbxVariable()
static sal_Char const aCellsStr[] = "Cells";
if ( maName.EqualsAscii( aCellsStr ) )
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
- GetSbxData_Impl()->aVars.Remove( this );
#endif
+ if( IsSet( SBX_DIM_AS_NEW ))
+ removeDimAsNewRecoverItem( this );
delete mpSbxVariableImpl;
delete pCst;
}
@@ -153,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() )
{
@@ -168,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!
@@ -186,7 +195,7 @@ SbxInfo* SbxVariable::GetInfo()
{
Broadcast( SBX_HINT_INFOWANTED );
if( pInfo.Is() )
- SetModified( TRUE );
+ SetModified( sal_True );
}
return pInfo;
}
@@ -233,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;
@@ -267,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 ) );
}
@@ -280,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 ) );
}
@@ -290,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;
}
@@ -316,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;
@@ -339,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;
@@ -355,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 )
@@ -397,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;
}
@@ -425,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
@@ -453,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;
@@ -467,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;
}
@@ -481,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!
@@ -494,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 );
@@ -530,23 +552,21 @@ BOOL SbxVariable::StoreData( SvStream& rStrm ) const
else
bValStore = SbxValue::StoreData( rStrm );
if( !bValStore )
- return 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 ///////////////////////////////////
@@ -554,7 +574,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()
{}
@@ -587,7 +607,7 @@ SbxAlias::~SbxAlias()
EndListening( xAlias->GetBroadcaster() );
}
-void SbxAlias::Broadcast( ULONG nHt )
+void SbxAlias::Broadcast( sal_uIntPtr nHt )
{
if( xAlias.Is() && StaticIsEnabledBroadcasting() )
{
@@ -617,11 +637,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 b4172dd2df..c8da15073d 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include "com/sun/star/resource/XStringResourceWithStorage.hpp"
#include "com/sun/star/resource/XStringResourceWithLocation.hpp"
+#include "com/sun/star/document/XGraphicObjectResolver.hpp"
#include "dlgcont.hxx"
#include "sbmodule.hxx"
#include <comphelper/processfactory.hxx>
@@ -69,11 +70,14 @@ using namespace com::sun::star::script;
using namespace com::sun::star::xml::sax;
using namespace com::sun::star;
using namespace cppu;
-using namespace rtl;
using namespace osl;
+using ::rtl::OUString;
+
using com::sun::star::uno::Reference;
+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+
//============================================================================
// Implementation class SfxDialogLibraryContainer
@@ -140,7 +144,7 @@ bool writeOasis2OOoLibraryElement(
if (! xSMgr.is())
{
- return FALSE;
+ return sal_False;
}
Reference< xml::sax::XParser > xParser(
@@ -162,7 +166,7 @@ bool writeOasis2OOoLibraryElement(
if ( !xParser.is() || !xWriter.is() )
{
- return FALSE;
+ return sal_False;
}
Sequence<Any> aArgs( 1 );
@@ -183,7 +187,7 @@ bool writeOasis2OOoLibraryElement(
xParser->parseStream( source );
- return TRUE;
+ return sal_True;
}
void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement
@@ -202,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() );
@@ -225,6 +229,35 @@ void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement
xInput->closeInput();
}
+void lcl_deepInspectForEmbeddedImages( const Reference< XInterface >& xIf, std::vector< rtl::OUString >& rvEmbedImgUrls )
+{
+ static rtl::OUString sImageURL= OUString(RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) );
+ Reference< beans::XPropertySet > xProps( xIf, UNO_QUERY );
+ if ( xProps.is() )
+ {
+
+ if ( xProps->getPropertySetInfo()->hasPropertyByName( sImageURL ) )
+ {
+ rtl::OUString sURL;
+ xProps->getPropertyValue( sImageURL ) >>= sURL;
+ if ( sURL.getLength() && sURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 )
+ rvEmbedImgUrls.push_back( sURL );
+ }
+ }
+ Reference< XNameContainer > xContainer( xIf, UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ Sequence< rtl::OUString > sNames = xContainer->getElementNames();
+ sal_Int32 nContainees = sNames.getLength();
+ for ( sal_Int32 index = 0; index < nContainees; ++index )
+ {
+ Reference< XInterface > xCtrl;
+ xContainer->getByName( sNames[ index ] ) >>= xCtrl;
+ lcl_deepInspectForEmbeddedImages( xCtrl, rvEmbedImgUrls );
+ }
+ }
+}
+
void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< embed::XStorage >& xStorage ) throw ( RuntimeException )
{
LibraryContainerMethodGuard aGuard( *this );
@@ -247,12 +280,60 @@ 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);
}
}
SfxLibraryContainer::storeLibrariesToStorage( xStorage );
+ // we need to export out any embedded image object(s)
+ // associated with any Dialogs. First, we need to actually gather any such urls
+ // for each dialog in this container
+ Sequence< OUString > sLibraries = getElementNames();
+ for ( sal_Int32 i=0; i < sLibraries.getLength(); ++i )
+ {
+ // libraries will already be loaded from above
+ Reference< XNameContainer > xLib;
+ getByName( sLibraries[ i ] ) >>= xLib;
+ if ( xLib.is() )
+ {
+ Sequence< OUString > sDialogs = xLib->getElementNames();
+ sal_Int32 nDialogs( sDialogs.getLength() );
+ for ( sal_Int32 j=0; j < nDialogs; ++j )
+ {
+ // Each Dialog has an associated xISP
+ Reference< io::XInputStreamProvider > xISP;
+ xLib->getByName( sDialogs[ j ] ) >>= xISP;
+ if ( xISP.is() )
+ {
+ Reference< io::XInputStream > xInput( xISP->createInputStream() );
+ Reference< XNameContainer > xDialogModel( mxMSF->createInstance
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
+ Reference< XComponentContext > xContext;
+ Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
+ std::vector< rtl::OUString > vEmbeddedImageURLs;
+ lcl_deepInspectForEmbeddedImages( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
+ if ( vEmbeddedImageURLs.size() )
+ {
+ // Export the images to the storage
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= xStorage;
+ Reference< document::XGraphicObjectResolver > xGraphicResolver( mxMSF->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Svx.GraphicExportHelper" ) ), aArgs ), UNO_QUERY );
+ std::vector< rtl::OUString >::iterator it = vEmbeddedImageURLs.begin();
+ std::vector< rtl::OUString >::iterator it_end = vEmbeddedImageURLs.end();
+ if ( xGraphicResolver.is() )
+ {
+ for ( sal_Int32 count = 0; it != it_end; ++it, ++count )
+ xGraphicResolver->resolveGraphicObjectURL( *it );
+ }
+ }
+ }
+ }
+ }
+ }
mbOasis2OOoFormat = sal_False;
}
@@ -268,7 +349,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
//Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() );
//if( !xMSF.is() )
//{
- // OSL_ENSURE( 0, "### couln't get ProcessServiceFactory\n" );
+ // OSL_FAIL( "### couln't get ProcessServiceFactory\n" );
// return aRetAny;
//}
@@ -276,7 +357,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
if( !xParser.is() )
{
- OSL_ENSURE( 0, "### couln't create sax parser component\n" );
+ OSL_FAIL( "### couln't create sax parser component\n" );
return aRetAny;
}
@@ -284,7 +365,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
if( !xDialogModel.is() )
{
- OSL_ENSURE( 0, "### couln't create com.sun.star.awt.UnoControlDialogModel component\n" );
+ OSL_FAIL( "### couln't create com.sun.star.awt.UnoControlDialogModel component\n" );
return aRetAny;
}
@@ -328,9 +409,9 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
}
catch( Exception& )
{
- OSL_ENSURE( 0, "Parsing error\n" );
+ OSL_FAIL( "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 52e7f7004c..52e7f7004c 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 cec28757c8..eac3ac2ff9 100644
--- a/basic/source/uno/modsizeexceeded.cxx
+++ b/basic/source/uno/modsizeexceeded.cxx
@@ -28,16 +28,17 @@
// 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;
using namespace cppu;
-using namespace rtl;
using namespace osl;
+using ::rtl::OUString;
+
ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& sModules )
{
script::ModuleSizeExceededRequest aReq;
@@ -45,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;
@@ -55,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 9efa92eec6..444a4edd24 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -69,6 +69,7 @@
#include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
+#include <boost/scoped_ptr.hpp>
namespace basic
{
@@ -89,11 +90,15 @@ using namespace com::sun::star::frame;
using namespace com::sun::star::deployment;
using namespace com::sun::star;
using namespace cppu;
-using namespace rtl;
using namespace osl;
using com::sun::star::uno::Reference;
+using ::rtl::OUString;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringToOString;
+using ::rtl::Uri;
+
// #i34411: Flag for error handling during migration
static bool GbMigrationSuppressErrors = false;
@@ -323,7 +328,7 @@ DBG_NAME( SfxLibraryContainer )
// Ctor
SfxLibraryContainer::SfxLibraryContainer( void )
: LibraryContainerHelper( maMutex )
- , mbVBACompat( sal_False )
+ , mbVBACompat( sal_False )
, maModifiable( *this, maMutex )
, maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) )
, mbOldInfoFormat( sal_False )
@@ -336,21 +341,21 @@ SfxLibraryContainer::SfxLibraryContainer( void )
mxMSF = comphelper::getProcessServiceFactory();
if( !mxMSF.is() )
{
- OSL_ENSURE( 0, "### couln't get ProcessServiceFactory\n" );
+ OSL_FAIL( "### couln't get ProcessServiceFactory\n" );
}
mxSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
if( !mxSFI.is() )
{
- OSL_ENSURE( 0, "### couln't create SimpleFileAccess component\n" );
+ OSL_FAIL( "### couln't create SimpleFileAccess component\n" );
}
mxStringSubstitution = Reference< XStringSubstitution >( mxMSF->createInstance
( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")) ), UNO_QUERY );
if( !mxStringSubstitution.is() )
{
- OSL_ENSURE( 0, "### couln't create PathSubstitution component\n" );
+ OSL_FAIL( "### couln't create PathSubstitution component\n" );
}
}
@@ -625,7 +630,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
if( !xParser.is() )
{
- OSL_ENSURE( 0, "### couln't create sax parser component\n" );
+ OSL_FAIL( "### couln't create sax parser component\n" );
return sal_False;
}
@@ -638,7 +643,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
// #110009: Scope to force the StorageRefs to be destructed and
// so the streams to be closed before the preload operation
{
- // #110009
uno::Reference< embed::XStorage > xLibrariesStor;
String aFileName;
@@ -656,9 +660,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
{
uno::Reference< io::XStream > xStream;
xLibrariesStor = xStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
- //if ( !xLibrariesStor.is() )
- // TODO: the method must either return a storage or throw an exception
- //throw uno::RuntimeException();
if ( xLibrariesStor.is() )
{
@@ -733,7 +734,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 );
}
}
@@ -755,7 +756,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 );
}
}
@@ -780,13 +781,13 @@ sal_Bool SfxLibraryContainer::init_Impl(
catch ( xml::sax::SAXException& e )
{
(void) e; // avoid warning
- OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ OSL_FAIL( OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
return sal_False;
}
catch ( io::IOException& e )
{
(void) e; // avoid warning
- OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ OSL_FAIL( OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
return sal_False;
}
@@ -879,7 +880,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
aMessage.append( ::rtl::OUStringToOString( rLib.aName, osl_getThreadTextEncoding() ) );
aMessage.append( "'.\n\nException:" );
aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
}
}
@@ -891,7 +892,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
sal_Bool bLoaded = implLoadLibraryIndexFile( pImplLib, rLib, xLibraryStor, aIndexFileName );
if( bLoaded && aLibName != rLib.aName )
{
- OSL_ENSURE( 0, "Different library names in library"
+ OSL_FAIL( "Different library names in library"
" container and library info files!\n" );
}
if( GbMigrationSuppressErrors && !bLoaded )
@@ -931,7 +932,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
// #110009: END Scope to force the StorageRefs to be destructed
}
- // #110009
if( !bStorage && meInitMode == DEFAULT )
{
@@ -942,11 +942,11 @@ sal_Bool SfxLibraryContainer::init_Impl(
catch( uno::Exception& )
{
// TODO: error handling?
- OSL_ASSERT( "Cannot access extensions!" );
+ OSL_FAIL( "Cannot access extensions!" );
}
}
- // #110009 Preload?
+ // Preload?
{
Sequence< OUString > aNames = maNameContainer.getElementNames();
const OUString* pNames = aNames.getConstArray();
@@ -960,7 +960,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
}
}
- // #118803# upgrade installation 7.0 -> 8.0
if( meInitMode == DEFAULT )
{
INetURLObject aUserBasicInetObj( String(maLibraryPath).GetToken(1) );
@@ -980,10 +979,9 @@ sal_Bool SfxLibraryContainer::init_Impl(
{
INetURLObject aPrevUserBasicInetObj = aPrevUserBasicInetObj_1;
String aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
- bool bSecondTime = false;
if( mxSFI->isFolder( aPrevFolder ) )
{
- // #110101 Check if Standard folder exists and is complete
+ // Check if Standard folder exists and is complete
INetURLObject aUserBasicStandardInetObj( aUserBasicInetObj );
aUserBasicStandardInetObj.insertName( aStandardStr, sal_True, INetURLObject::LAST_SEGMENT,
sal_True, INetURLObject::ENCODE_ALL );
@@ -1026,7 +1024,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
}
else
{
- bSecondTime = true;
aPrevUserBasicInetObj = aPrevUserBasicInetObj_2;
aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
}
@@ -1160,7 +1157,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
// #i93163
if( bCleanUp )
{
- DBG_ERROR( "Upgrade of Basic installation failed somehow" );
+ OSL_FAIL( "Upgrade of Basic installation failed somehow" );
static char strErrorSavFolderName[] = "__basic_80_err";
INetURLObject aPrevUserBasicInetObj_Err( aUserBasicInetObj );
@@ -1204,7 +1201,7 @@ void SfxLibraryContainer::implScanExtensions( void )
bool bPureDialogLib = false;
while( (aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).getLength() > 0 )
{
- if( bPureDialogLib && maInfoFileName.equalsAscii( "script" ) )
+ if( bPureDialogLib && maInfoFileName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "script" ) ) )
continue;
// Extract lib name
@@ -1368,7 +1365,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
OUString aStreamName = aElementName;
aStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
- /*Any aElement = pLib->getByName( aElementName );*/
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
@@ -1376,7 +1372,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
aMessage.append( "invalid library element '" );
aMessage.append( ::rtl::OUStringToOString( aElementName, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
continue;
}
@@ -1384,7 +1380,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
uno::Reference< io::XStream > xElementStream = xStorage->openStreamElement(
aStreamName,
embed::ElementModes::READWRITE );
- //if ( !xElementStream.is() )
// throw uno::RuntimeException(); // TODO: method must either return the stream or throw an exception
String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) );
@@ -1393,27 +1388,23 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
uno::Reference< beans::XPropertySet > xProps( xElementStream, uno::UNO_QUERY );
OSL_ENSURE( xProps.is(), "The StorageStream must implement XPropertySet interface!\n" );
//if ( !xProps.is() ) //TODO
- // throw uno::RuntimeException();
if ( xProps.is() )
{
xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
// #87671 Allow encryption
-//REMOVE aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") );
aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "UseCommonStoragePasswordEncryption" ) );
xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) );
Reference< XOutputStream > xOutput = xElementStream->getOutputStream();
Reference< XNameContainer > xLib( pLib );
writeLibraryElement( xLib, aElementName, xOutput );
- // writeLibraryElement closes the stream
- // xOutput->closeOutput();
}
}
catch( uno::Exception& )
{
- OSL_ENSURE( sal_False, "Problem during storing of library!\n" );
+ OSL_FAIL( "Problem during storing of library!\n" );
// TODO: error handling?
}
}
@@ -1458,7 +1449,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
aElementInetObj.setExtension( maLibElementFileExtension );
String aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
- /*Any aElement = pLib->getByName( aElementName );*/
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
@@ -1466,7 +1456,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
aMessage.append( "invalid library element '" );
aMessage.append( ::rtl::OUStringToOString( aElementName, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
continue;
}
@@ -1487,7 +1477,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 );
}
}
@@ -1519,7 +1509,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
if( !xHandler.is() )
{
- OSL_ENSURE( 0, "### couln't create sax-writer component\n" );
+ OSL_FAIL( "### couln't create sax-writer component\n" );
return;
}
@@ -1538,7 +1528,6 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
xInfoStream = xStorage->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
OSL_ENSURE( xInfoStream.is(), "No stream!\n" );
uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY );
- //if ( !xProps.is() )
// throw uno::RuntimeException(); // TODO
if ( xProps.is() )
@@ -1548,7 +1537,6 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
// #87671 Allow encryption
-//REMOVE aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") );
aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "UseCommonStoragePasswordEncryption" ) );
xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) );
@@ -1557,7 +1545,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
}
catch( uno::Exception& )
{
- OSL_ENSURE( sal_False, "Problem during storing of library index file!\n" );
+ OSL_FAIL( "Problem during storing of library index file!\n" );
// TODO: error handling?
}
}
@@ -1600,13 +1588,13 @@ 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 );
}
}
if( !xOut.is() )
{
- OSL_ENSURE( 0, "### couln't open output stream\n" );
+ OSL_FAIL( "### couln't open output stream\n" );
return;
}
@@ -1624,7 +1612,7 @@ sal_Bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
if( !xParser.is() )
{
- OSL_ENSURE( 0, "### couln't create sax parser component\n" );
+ OSL_FAIL( "### couln't create sax parser component\n" );
return sal_False;
}
@@ -1675,14 +1663,13 @@ 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 );
}
}
}
if( !xInput.is() )
{
- // OSL_ENSURE( 0, "### couln't open input stream\n" );
return sal_False;
}
@@ -1697,9 +1684,9 @@ sal_Bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
}
catch( Exception& )
{
- OSL_ENSURE( 0, "Parsing error\n" );
+ OSL_FAIL( "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;
}
@@ -1760,7 +1747,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if( !nLibsToSave )
return;
- ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave );
+ boost::scoped_ptr< ::xmlscript::LibDescriptorArray > pLibArray(new ::xmlscript::LibDescriptorArray(nLibsToSave));
// Write to storage?
sal_Bool bStorage = i_rStorage.is();
@@ -1771,7 +1758,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if ( bStorage )
{
// Don't write if only empty standard lib exists
- if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) )
+ if ( ( nNameCount == 1 ) && ( aNames[0].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Standard" ) ) ) )
{
Any aLibAny = maNameContainer.getByName( aNames[0] );
Reference< XNameAccess > xNameAccess;
@@ -1892,7 +1879,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
aMessage.append( ::rtl::OUStringToOString( rLib.aName, osl_getThreadTextEncoding() ) );
aMessage.append( "'.\n\nException:" );
aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
return;
}
@@ -1997,7 +1984,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
if( !xHandler.is() )
{
- OSL_ENSURE( 0, "### couln't create sax-writer component\n" );
+ OSL_FAIL( "### couln't create sax-writer component\n" );
return;
}
@@ -2028,7 +2015,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 );
}
}
@@ -2050,14 +2037,14 @@ 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 );
}
}
if( !xOut.is() )
{
- OSL_ENSURE( 0, "### couln't open output stream\n" );
+ OSL_FAIL( "### couln't open output stream\n" );
return;
}
@@ -2066,7 +2053,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
try
{
- xmlscript::exportLibraryContainer( xHandler, pLibArray );
+ xmlscript::exportLibraryContainer( xHandler, pLibArray.get() );
if ( bStorage )
{
uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY );
@@ -2079,12 +2066,10 @@ 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;
+ OSL_FAIL( "Problem during storing of libraries!\n" );
+ sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
ErrorHandler::HandleError( nErrorCode );
}
-
- delete pLibArray;
}
@@ -2315,7 +2300,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
aMessage.append( ::rtl::OUStringToOString( Name, osl_getThreadTextEncoding() ) );
aMessage.append( "'.\n\nException:" );
aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
return;
}
@@ -2365,7 +2350,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
aMessage.append( "couln't open library element stream - attempted to open library '" );
aMessage.append( ::rtl::OUStringToOString( Name, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
return;
}
@@ -2381,7 +2366,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
}
Reference< XNameContainer > xLib( pImplLib );
- Any aAny = importLibraryElement( xLib, aElementName,
+ Any aAny = importLibraryElement( xLib, aElementName,
aFile, xInStream );
if( pImplLib->hasByName( aElementName ) )
{
@@ -2809,19 +2794,49 @@ 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)
+{
+ msProjectName = _projectname;
+ BasicManager* pBasMgr = getBasicManager();
+ // Temporary HACK
+ // Some parts of the VBA handling ( e.g. in core basic )
+ // code expect the name of the VBA project to be set as the name of
+ // the basic manager. Provide fail back here.
+ if( pBasMgr )
+ pBasMgr->SetName( msProjectName );
}
// Methods XServiceInfo
@@ -2904,21 +2919,11 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType )
{
Any aRet;
- /*
- if( mbReadOnly )
- {
- aRet = Any( ::cppu::queryInterface( rType,
- static_cast< XContainer * >( this ),
- static_cast< XNameAccess * >( this ) ) );
- }
- else
- {
- */
- aRet = Any( ::cppu::queryInterface( rType,
- static_cast< XContainer * >( this ),
- static_cast< XNameContainer * >( this ),
- static_cast< XNameAccess * >( this ) ) );
- //}
+ aRet = Any( ::cppu::queryInterface( rType,
+ static_cast< XContainer * >( this ),
+ static_cast< XNameContainer * >( this ),
+ static_cast< XNameAccess * >( this ) ) );
+
if( !aRet.hasValue() )
aRet = OComponentHelper::queryInterface( rType );
return aRet;
@@ -3107,8 +3112,8 @@ void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerLi
//============================================================================
// Implementation class ScriptExtensionIterator
-static rtl::OUString aBasicLibMediaType(RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.basic-library"));
-static rtl::OUString aDialogLibMediaType(RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.dialog-library"));
+#define sBasicLibMediaType "application/vnd.sun.star.basic-library"
+#define sDialogLibMediaType "application/vnd.sun.star.dialog-library"
ScriptExtensionIterator::ScriptExtensionIterator( void )
: m_eState( USER_EXTENSIONS )
@@ -3168,7 +3173,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
}
case BUNDLED_EXTENSIONS:
{
- Reference< deployment::XPackage > xScriptPackage =
+ Reference< deployment::XPackage > xScriptPackage =
implGetNextBundledScriptPackage( rbPureDialogLib );
if( !xScriptPackage.is() )
break;
@@ -3177,7 +3182,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
break;
}
case END_REACHED:
- OSL_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
+ OSL_FAIL( "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
break;
}
}
@@ -3259,11 +3264,11 @@ Reference< deployment::XPackage > ScriptSubPackageIterator::implDetectScriptPack
{
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType();
rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
- if( aMediaType.equals( aBasicLibMediaType ) )
+ if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBasicLibMediaType)) )
{
xScriptPackage = xPackage;
}
- else if( aMediaType.equals( aDialogLibMediaType ) )
+ else if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDialogLibMediaType)) )
{
rbPureDialogLib = true;
xScriptPackage = xPackage;
@@ -3305,12 +3310,12 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetScriptPackageF
const Reference< deployment::XPackage > xSubPkg = pSeq[ iPkg ];
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xSubPkg->getPackageType();
rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
- if( aMediaType.equals( aBasicLibMediaType ) )
+ if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBasicLibMediaType)) )
{
xScriptPackage = xSubPkg;
break;
}
- else if( aMediaType.equals( aDialogLibMediaType ) )
+ else if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDialogLibMediaType)) )
{
rbPureDialogLib = true;
xScriptPackage = xSubPkg;
@@ -3322,11 +3327,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetScriptPackageF
{
const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType();
rtl::OUString aMediaType = xPackageTypeInfo->getMediaType();
- if( aMediaType.equals( aBasicLibMediaType ) )
+ if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBasicLibMediaType)) )
{
xScriptPackage = xPackage;
}
- else if( aMediaType.equals( aDialogLibMediaType ) )
+ else if( aMediaType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDialogLibMediaType)) )
{
rbPureDialogLib = true;
xScriptPackage = xPackage;
@@ -3401,7 +3406,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
try
{
Reference< XExtensionManager > xSharedManager =
- ExtensionManager::get( m_xContext );
+ ExtensionManager::get( m_xContext );
m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
@@ -3454,7 +3459,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
try
{
Reference< XExtensionManager > xManager =
- ExtensionManager::get( m_xContext );
+ ExtensionManager::get( m_xContext );
m_aBundledPackagesSeq = xManager->getDeployedExtensions
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index cc5c26e3d4..766951286a 100644
--- 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>
@@ -80,10 +80,11 @@ using namespace com::sun::star::script;
using namespace com::sun::star::xml::sax;
using namespace com::sun::star;
using namespace cppu;
-using namespace rtl;
using namespace osl;
-using com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+using ::rtl::OUString;
//============================================================================
// Implementation class SfxScriptLibraryContainer
@@ -197,7 +198,7 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
if( !xHandler.is() )
{
- OSL_ENSURE( 0, "### couln't create sax-writer component\n" );
+ OSL_FAIL( "### couln't create sax-writer component\n" );
return;
}
@@ -254,7 +255,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
if( !xParser.is() )
{
- OSL_ENSURE( 0, "### couln't create sax parser component\n" );
+ OSL_FAIL( "### couln't create sax parser component\n" );
return aRetAny;
}
@@ -299,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 );
}
@@ -310,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;
@@ -352,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&)
{
@@ -402,8 +396,6 @@ void SAL_CALL SfxScriptLibraryContainer::importFromOldStorage( const ::rtl::OUSt
SotStorageRef xStorage = new SotStorage( sal_False, aFile );
if( xStorage.Is() && xStorage->GetError() == ERRCODE_NONE )
{
- // We need a BasicManager to avoid problems
- // StarBASIC* pBas = new StarBASIC();
BasicManager* pBasicManager = new BasicManager( *(SotStorage*)xStorage, aFile );
// Set info
@@ -647,7 +639,6 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
SbModule* pMod = pBasicLib->FindModule( aElementName );
if( pMod )
{
- //OUString aCodeStreamName( RTL_CONSTASCII_USTRINGPARAM("code.bin") );
OUString aCodeStreamName = aElementName;
aCodeStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".bin") );
@@ -660,7 +651,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 );
@@ -682,7 +673,6 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
if( pLib->mbPasswordVerified || pLib->mbDoc50Password )
{
- /*Any aElement = pLib->getByName( aElementName );*/
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
@@ -690,7 +680,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
aMessage.append( "invalid library element '" );
aMessage.append( ::rtl::OUStringToOString( aElementName, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
continue;
}
@@ -716,12 +706,10 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
Reference< XOutputStream > xOutput = xSourceStream->getOutputStream();
Reference< XNameContainer > xLib( pLib );
writeLibraryElement( xLib, aElementName, xOutput );
- // writeLibraryElement should have the stream already closed
- // xOutput->closeOutput();
}
catch( uno::Exception& )
{
- OSL_ENSURE( sal_False, "Problem on storing of password library!\n" );
+ OSL_FAIL( "Problem on storing of password library!\n" );
// TODO: error handling
}
}
@@ -768,7 +756,6 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
aElementInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("pba") ) );
String aElementPath = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
- /*Any aElement = pLib->getByName( aElementName );*/
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
@@ -776,7 +763,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
aMessage.append( "invalid library element '" );
aMessage.append( ::rtl::OUStringToOString( aElementName, osl_getThreadTextEncoding() ) );
aMessage.append( "'." );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
#endif
continue;
}
@@ -801,7 +788,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 );
@@ -867,13 +854,10 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
// TODO: handle error
}
- // Storage Dtor commits too, that makes problems
- // xElementRootStorage->Commit();
}
}
catch( Exception& )
{
- //throw e;
}
}
return sal_True;
@@ -942,7 +926,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
}
catch( uno::Exception& )
{
- OSL_ENSURE( 0, "### couln't open sub storage for library\n" );
+ OSL_FAIL( "### couln't open sub storage for library\n" );
return sal_False;
}
}
@@ -958,10 +942,9 @@ 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") );
OUString aCodeStreamName= aElementName;
aCodeStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".bin") );
@@ -980,7 +963,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;
@@ -1070,7 +1053,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
if( !pMod )
{
pMod = pBasicLib->MakeModule( aElementName, String() );
- pBasicLib->SetModified( FALSE );
+ pBasicLib->SetModified( sal_False );
}
try {
@@ -1089,7 +1072,7 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
nError );
}
- /*BOOL bRet = */pMod->LoadBinaryData( *pStream );
+ /*sal_Bool bRet = */pMod->LoadBinaryData( *pStream );
// TODO: Check return value
delete pStream;
@@ -1151,11 +1134,6 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
}
}
-//REMOVE // If the password is verified the library must remain modified, because
-//REMOVE // otherwise for saving the storage would be copied and that doesn't work
-//REMOVE // with mtg's storages when the password is verified
-//REMOVE if( !pLib->mbPasswordVerified )
-//REMOVE pLib->mbModified = sal_False;
return bRet;
}
@@ -1195,9 +1173,9 @@ Sequence< ::rtl::OUString > SAL_CALL SfxScriptLibraryContainer::getSupportedServ
Sequence< OUString > SfxScriptLibraryContainer::getSupportedServiceNames_static()
{
Sequence< OUString > aServiceNames( 2 );
- aServiceNames[0] = OUString::createFromAscii( "com.sun.star.script.DocumentScriptLibraryContainer" );
+ aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentScriptLibraryContainer" ));
// plus, for compatibility:
- aServiceNames[1] = OUString::createFromAscii( "com.sun.star.script.ScriptLibraryContainer" );
+ aServiceNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.ScriptLibraryContainer" ));
return aServiceNames;
}
@@ -1209,7 +1187,7 @@ OUString SfxScriptLibraryContainer::getImplementationName_static()
MutexGuard aGuard( Mutex::getGlobalMutex() );
if( bNeedsInit )
{
- aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.ScriptLibraryContainer" );
+ aImplName = OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sfx2.ScriptLibraryContainer" ));
bNeedsInit = sal_False;
}
return aImplName;
diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk
index 7340d08139..635b293698 100644..100755
--- a/basic/util/makefile.mk
+++ b/basic/util/makefile.mk
@@ -64,10 +64,6 @@ SHL1STDLIBS= \
$(SOTLIB) \
$(XMLSCRIPTLIB)
-.IF "$(SOLAR_JAVA)" != "TRUE"
-SHL1STDLIBS+=$(SJLIB)
-.ENDIF
-
.IF "$(GUI)"=="WNT"
SHL1STDLIBS+= \
$(UWINAPILIB) \
@@ -141,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 0000000000..4687bd1e7d
--- /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/workben/makefile.mk b/basic/workben/makefile.mk
deleted file mode 100644
index 42b65cbb04..0000000000
--- a/basic/workben/makefile.mk
+++ /dev/null
@@ -1,89 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..
-
-PRJNAME=basic
-TARGET=miniapp
-TARGETTYPE=GUI
-
-# --- Settings ---------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# --- SBASIC IDE --------------------------------------------------------
-
-APP1TARGET=$(PRJNAME)app
-APP1STDLIBS= \
- $(SALLIB) \
- $(TOOLSLIB) \
- $(UNOTOOLSLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
- $(VCLLIB) \
- $(COMPHELPERLIB) \
- $(UCBHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SJLIB) \
- $(SOTLIB) \
-
-
-#.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC"
-#APP1STDLIBS+=$(CPPULIB)
-#.ENDIF
-#.IF "$(GUI)"=="UNX"
-#APP1STDLIBS+= \
-# \
-# $(SALLIB)
-#.ENDIF
-
-.IF "$(GUI)"!="OS2"
-APP1LIBS= \
- $(LB)$/basic.lib
-.ENDIF
-APP1LIBS+= \
- $(LB)$/app.lib \
- $(LB)$/sample.lib
-.IF "$(GUI)"=="UNX" || "$(GUI)"=="OS2"
-APP1STDLIBS+= \
- $(BASICLIB)
-.ENDIF
-
-
-APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/basic.lib $(LB)$/app.lib $(LB)$/sample.lib
-
-APP1OBJS = $(OBJ)$/ttbasic.obj
-
-.IF "$(GUI)" != "UNX"
-APP1OBJS+= \
- $(OBJ)$/app.obj \
- $(SLO)$/sbintern.obj
-.ENDIF
-
-.INCLUDE : target.mk
-
diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx
index dfdf83a661..824966b23e 100644
--- a/basic/workben/mgrtest.cxx
+++ b/basic/workben/mgrtest.cxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -38,6 +37,10 @@
#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
@@ -82,7 +85,7 @@ private:
BasicManager* pBasMgr;
void CheckError();
- USHORT nLibX;
+ sal_uInt16 nLibX;
DECL_LINK( BasicErrorHdl, StarBASIC * );
@@ -122,7 +125,7 @@ TestWindow::TestWindow() :
aFont.SetSize( Size( 0, 6 ) );
aFont.SetPitch( PITCH_VARIABLE );
aFont.SetFamily( FAMILY_SWISS );
- aFont.SetTransparent( TRUE );
+ aFont.SetTransparent( sal_True );
aFont.SetAlign( ALIGN_TOP );
aToolBox.SetFont( aFont );
SetFont( aFont );
@@ -194,7 +197,7 @@ void TestWindow::ShowInfo()
if ( pBasMgr )
{
Point aPos( 10, aToolBox.GetSizePixel().Height()+5 );
- for ( USHORT nLib = 0; nLib < pBasMgr->GetLibCount(); nLib++ )
+ for ( sal_uInt16 nLib = 0; nLib < pBasMgr->GetLibCount(); nLib++ )
{
String aOutStr( nLib );
aOutStr +=": ";
@@ -209,7 +212,7 @@ void TestWindow::ShowInfo()
aOutStr += ">, Storage='";
aOutStr += pBasMgr->GetLibStorageName( nLib );
aOutStr += "', bLoaded=";
- aOutStr += (USHORT)pBasMgr->IsLibLoaded( nLib );
+ aOutStr += (sal_uInt16)pBasMgr->IsLibLoaded( nLib );
DrawText( aPos, aOutStr );
aPos.Y() += nH;
}
@@ -220,22 +223,22 @@ void TestWindow::UpdateToolBox()
{
// View of some buttons as checked or disabled if
// wished by tests
- aToolBox.EnableItem( TB_ORG, (BOOL)(ULONG)pBasMgr );
+ aToolBox.EnableItem( TB_ORG, (sal_Bool)(sal_uIntPtr)pBasMgr );
- aToolBox.EnableItem( TB_CREATELIB1, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_CREATELIB2, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_CREATELIB3, (BOOL)(ULONG)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, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_LOADLIB2, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_LOADLIB3, (BOOL)(ULONG)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, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_EXECX, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_UNLOADX, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_LOADX, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_REMOVEX, (BOOL)(ULONG)pBasMgr );
- aToolBox.EnableItem( TB_REMOVEDELX, (BOOL)(ULONG)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 );
@@ -245,8 +248,8 @@ void TestWindow::UpdateToolBox()
IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
- USHORT nId = aToolBox.GetCurItemId();
- BOOL bChecked = aToolBox.IsItemChecked( nId );
+ sal_uInt16 nId = aToolBox.GetCurItemId();
+ sal_Bool bChecked = aToolBox.IsItemChecked( nId );
switch ( nId )
{
case TB_NEW:
@@ -286,7 +289,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib1Str ) );
+ sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib1Str ) );
if ( nLib != LIB_NOTFOUND )
{
pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" );
@@ -306,7 +309,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib2Str ) );
+ sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib2Str ) );
if ( nLib != LIB_NOTFOUND )
{
pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" );
@@ -324,8 +327,8 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- // is located in another storage !!!
- USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) );
+ // liegt in einem anderen Storage !!!
+ sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) );
if ( nLib != LIB_NOTFOUND )
{
pBasMgr->SetLibStorageName( nLib, "d:\\mystore2.svs" );
@@ -344,7 +347,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
if ( pBasMgr )
{
SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" );
- if ( !pBasMgr->AddLib( *xStorage, pLib1Str, FALSE ) )
+ if ( !pBasMgr->AddLib( *xStorage, pLib1Str, sal_False ) )
Sound::Beep();
}
}
@@ -354,7 +357,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
if ( pBasMgr )
{
SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" );
- if ( !pBasMgr->AddLib( *xStorage, pLib2Str, FALSE ) )
+ if ( !pBasMgr->AddLib( *xStorage, pLib2Str, sal_False ) )
Sound::Beep();
}
}
@@ -363,9 +366,9 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- // is located in another storage !!!
+ // liegt in einem anderen Storage !!!
SvStorageRef xStorage = new SvStorage( "d:\\mystore2.svs" );
- if ( !pBasMgr->AddLib( *xStorage, pLib3Str, FALSE ) )
+ if ( !pBasMgr->AddLib( *xStorage, pLib3Str, sal_False ) )
Sound::Beep();
}
}
@@ -391,13 +394,13 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
case TB_REMOVEX:
{
if ( pBasMgr )
- pBasMgr->RemoveLib( nLibX, FALSE );
+ pBasMgr->RemoveLib( nLibX, sal_False );
}
break;
case TB_REMOVEDELX:
{
if ( pBasMgr )
- pBasMgr->RemoveLib( nLibX, TRUE );
+ pBasMgr->RemoveLib( nLibX, sal_True );
}
break;
case TB_EXECX:
@@ -524,9 +527,9 @@ void __EXPORT TestWindow::Resize()
void __EXPORT TestWindow::KeyInput( const KeyEvent& rKEvt )
{
char nCharCode = rKEvt.GetCharCode();
- USHORT nCode = rKEvt.GetKeyCode().GetCode();
+ sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- // Only at Alt-Return
+ // Nur bei Alt-Return
if ( ( nCode == KEY_RETURN ) && rKEvt.GetKeyCode().IsMod2() )
;
else
@@ -586,5 +589,3 @@ void __EXPORT TestApp::Main( int, char*[] )
TestApp aTestApp;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */