summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2011-02-11 16:23:20 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2011-02-11 16:23:20 -0600
commit3d5879def00b372b4fc43ecb0a78ca643ad3c5b8 (patch)
tree6ceb9df646025cd3b944d54f77d9dbbb0c9045f7
parent95565916b0f9bc46521bead9ae148f73e6beda61 (diff)
merge non-conflicting changes to basic
-rw-r--r--basic/inc/basic/basicmanagerrepository.hxx2
-rw-r--r--basic/inc/basic/basicrt.hxx2
-rw-r--r--basic/inc/basic/basmgr.hxx9
-rw-r--r--basic/inc/basic/basrdll.hxx3
-rw-r--r--basic/inc/basic/dispdefs.hxx2
-rw-r--r--basic/inc/basic/modsizeexceeded.hxx2
-rw-r--r--basic/inc/basic/mybasic.hxx25
-rw-r--r--basic/inc/basic/process.hxx5
-rw-r--r--basic/inc/basic/sbdef.hxx3
-rw-r--r--basic/inc/basic/sberrors.hxx3
-rw-r--r--basic/inc/basic/sbmeth.hxx8
-rw-r--r--basic/inc/basic/sbmod.hxx3
-rw-r--r--basic/inc/basic/sbprop.hxx3
-rw-r--r--basic/inc/basic/sbstar.hxx4
-rw-r--r--basic/inc/basic/sbstdobj.hxx5
-rw-r--r--basic/inc/basic/sbuno.hxx3
-rw-r--r--basic/inc/basic/sbx.hxx19
-rw-r--r--basic/inc/basic/sbxbase.hxx5
-rw-r--r--basic/inc/basic/sbxcore.hxx3
-rw-r--r--basic/inc/basic/sbxdef.hxx480
-rw-r--r--basic/inc/basic/sbxfac.hxx3
-rw-r--r--basic/inc/basic/sbxform.hxx2
-rw-r--r--basic/inc/basic/sbxmeth.hxx2
-rw-r--r--basic/inc/basic/sbxmstrm.hxx3
-rw-r--r--basic/inc/basic/sbxobj.hxx3
-rw-r--r--basic/inc/basic/sbxprop.hxx3
-rw-r--r--basic/inc/basic/sbxvar.hxx279
-rw-r--r--basic/inc/basic/testtool.hxx4
-rw-r--r--basic/inc/basic/ttstrhlp.hxx2
-rw-r--r--basic/inc/basrid.hxx3
-rw-r--r--basic/inc/pch/precompiled_basic.cxx2
-rw-r--r--basic/inc/pch/precompiled_basic.hxx9
-rw-r--r--basic/inc/sb.hxx3
-rwxr-xr-x[-rw-r--r--]basic/prj/build.lst0
-rw-r--r--basic/source/app/app.cxx361
-rw-r--r--basic/source/app/app.hxx25
-rw-r--r--basic/source/app/appbased.cxx23
-rw-r--r--basic/source/app/appbased.hxx7
-rw-r--r--basic/source/app/appedit.cxx22
-rw-r--r--basic/source/app/appedit.hxx5
-rw-r--r--basic/source/app/apperror.cxx5
-rw-r--r--basic/source/app/apperror.hxx2
-rw-r--r--basic/source/app/appwin.cxx16
-rw-r--r--basic/source/app/appwin.hxx9
-rw-r--r--basic/source/app/basic.src8
-rw-r--r--basic/source/app/basicrt.cxx3
-rw-r--r--basic/source/app/basmsg.hrc12
-rw-r--r--basic/source/app/basmsg.src13
-rw-r--r--basic/source/app/brkpnts.cxx148
-rw-r--r--basic/source/app/brkpnts.hxx57
-rw-r--r--basic/source/app/dataedit.hxx3
-rw-r--r--basic/source/app/dialogs.cxx46
-rw-r--r--basic/source/app/dialogs.hxx24
-rw-r--r--basic/source/app/msgedit.cxx13
-rw-r--r--basic/source/app/msgedit.hxx5
-rw-r--r--basic/source/app/mybasic.cxx64
-rw-r--r--basic/source/app/printer.cxx12
-rw-r--r--basic/source/app/printer.hxx3
-rw-r--r--basic/source/app/process.cxx77
-rw-r--r--basic/source/app/processw.cxx10
-rw-r--r--basic/source/app/processw.hxx5
-rw-r--r--basic/source/app/status.cxx4
-rw-r--r--basic/source/app/status.hxx3
-rw-r--r--basic/source/app/svtmsg.src12
-rw-r--r--basic/source/app/testbasi.cxx3
-rw-r--r--basic/source/app/textedit.cxx69
-rw-r--r--basic/source/app/textedit.hxx4
-rw-r--r--basic/source/app/ttbasic.cxx3
-rw-r--r--basic/source/app/ttbasic.hxx2
-rw-r--r--basic/source/app/ttmsg.src13
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx6
-rw-r--r--basic/source/basmgr/basmgr.cxx226
-rw-r--r--basic/source/classes/disas.cxx6
-rw-r--r--basic/source/classes/eventatt.cxx46
-rw-r--r--basic/source/classes/image.cxx7
-rw-r--r--basic/source/classes/propacc.cxx10
-rw-r--r--basic/source/classes/sb.cxx78
-rw-r--r--basic/source/classes/sbintern.cxx2
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx975
-rwxr-xr-xbasic/source/classes/sbxmod.cxx363
-rw-r--r--basic/source/comp/buffer.cxx26
-rw-r--r--basic/source/comp/codegen.cxx41
-rw-r--r--basic/source/comp/dim.cxx172
-rw-r--r--basic/source/comp/exprgen.cxx32
-rw-r--r--basic/source/comp/exprnode.cxx50
-rw-r--r--basic/source/comp/exprtree.cxx14
-rw-r--r--basic/source/comp/io.cxx2
-rw-r--r--basic/source/comp/loops.cxx2
-rw-r--r--basic/source/comp/parser.cxx17
-rwxr-xr-xbasic/source/comp/sbcomp.cxx6
-rw-r--r--basic/source/comp/scanner.cxx3
-rw-r--r--basic/source/comp/symtbl.cxx2
-rw-r--r--basic/source/comp/token.cxx3
-rw-r--r--basic/source/inc/buffer.hxx3
-rw-r--r--basic/source/inc/codegen.hxx3
-rw-r--r--basic/source/inc/collelem.hxx3
-rw-r--r--basic/source/inc/disas.hxx3
-rw-r--r--basic/source/inc/dlgcont.hxx8
-rw-r--r--basic/source/inc/expr.hxx3
-rw-r--r--basic/source/inc/filefmt.hxx3
-rw-r--r--basic/source/inc/image.hxx5
-rw-r--r--basic/source/inc/iosys.hxx4
-rw-r--r--basic/source/inc/namecont.hxx234
-rw-r--r--basic/source/inc/object.hxx5
-rw-r--r--basic/source/inc/opcodes.hxx3
-rw-r--r--basic/source/inc/parser.hxx4
-rw-r--r--basic/source/inc/propacc.hxx11
-rw-r--r--basic/source/inc/runtime.hxx13
-rw-r--r--basic/source/inc/sbcomp.hxx3
-rw-r--r--basic/source/inc/sbintern.hxx2
-rw-r--r--basic/source/inc/sbjsmeth.hxx3
-rw-r--r--basic/source/inc/sbjsmod.hxx2
-rw-r--r--basic/source/inc/sbunoobj.hxx27
-rw-r--r--basic/source/inc/scanner.hxx5
-rw-r--r--basic/source/inc/scriptcont.hxx6
-rw-r--r--basic/source/inc/stdobj.hxx3
-rw-r--r--basic/source/inc/symtbl.hxx2
-rw-r--r--basic/source/inc/token.hxx7
-rw-r--r--basic/source/runtime/basrdll.cxx2
-rw-r--r--basic/source/runtime/ddectrl.cxx4
-rw-r--r--basic/source/runtime/ddectrl.hxx5
-rw-r--r--basic/source/runtime/dllmgr-none.cxx64
-rw-r--r--basic/source/runtime/dllmgr-x64.cxx772
-rw-r--r--basic/source/runtime/dllmgr-x86.cxx722
-rw-r--r--basic/source/runtime/dllmgr.hxx3
-rw-r--r--basic/source/runtime/inputbox.cxx4
-rw-r--r--basic/source/runtime/iosys.cxx57
-rw-r--r--basic/source/runtime/methods.cxx273
-rwxr-xr-xbasic/source/runtime/methods1.cxx585
-rw-r--r--basic/source/runtime/props.cxx2
-rw-r--r--basic/source/runtime/rtlproto.hxx17
-rw-r--r--basic/source/runtime/runtime.cxx50
-rw-r--r--basic/source/runtime/stdobj.cxx124
-rw-r--r--basic/source/runtime/stdobj1.cxx2
-rw-r--r--basic/source/runtime/step0.cxx120
-rw-r--r--basic/source/runtime/step1.cxx21
-rwxr-xr-xbasic/source/runtime/step2.cxx12
-rw-r--r--basic/source/sample/collelem.cxx2
-rw-r--r--basic/source/sample/makefile.mk3
-rw-r--r--basic/source/sample/object.cxx6
-rw-r--r--basic/source/sbx/sbxarray.cxx59
-rw-r--r--basic/source/sbx/sbxbase.cxx28
-rw-r--r--basic/source/sbx/sbxbool.cxx41
-rw-r--r--basic/source/sbx/sbxbyte.cxx45
-rw-r--r--basic/source/sbx/sbxchar.cxx54
-rw-r--r--basic/source/sbx/sbxcoll.cxx12
-rw-r--r--basic/source/sbx/sbxconv.hxx46
-rw-r--r--basic/source/sbx/sbxcurr.cxx450
-rw-r--r--basic/source/sbx/sbxdate.cxx36
-rw-r--r--basic/source/sbx/sbxdbl.cxx25
-rw-r--r--basic/source/sbx/sbxdec.cxx101
-rw-r--r--basic/source/sbx/sbxdec.hxx2
-rw-r--r--basic/source/sbx/sbxexec.cxx72
-rw-r--r--basic/source/sbx/sbxform.cxx2
-rw-r--r--basic/source/sbx/sbxint.cxx171
-rw-r--r--basic/source/sbx/sbxlng.cxx68
-rw-r--r--basic/source/sbx/sbxmstrm.cxx3
-rw-r--r--basic/source/sbx/sbxobj.cxx218
-rw-r--r--basic/source/sbx/sbxres.cxx4
-rw-r--r--basic/source/sbx/sbxres.hxx9
-rw-r--r--basic/source/sbx/sbxscan.cxx30
-rw-r--r--basic/source/sbx/sbxsng.cxx45
-rw-r--r--basic/source/sbx/sbxstr.cxx40
-rw-r--r--basic/source/sbx/sbxuint.cxx49
-rw-r--r--basic/source/sbx/sbxulng.cxx41
-rwxr-xr-xbasic/source/sbx/sbxvalue.cxx603
-rw-r--r--basic/source/sbx/sbxvar.cxx75
-rw-r--r--basic/source/uno/dlgcont.cxx106
-rw-r--r--basic/source/uno/modsizeexceeded.cxx2
-rw-r--r--basic/source/uno/namecont.cxx68
-rw-r--r--basic/source/uno/sbmodule.cxx2
-rw-r--r--basic/source/uno/sbmodule.hxx2
-rw-r--r--basic/source/uno/sbservices.cxx2
-rw-r--r--basic/source/uno/scriptcont.cxx26
-rw-r--r--basic/util/makefile.mk4
-rw-r--r--basic/workben/makefile.mk2
-rw-r--r--basic/workben/mgrtest.cxx29
177 files changed, 6266 insertions, 3608 deletions
diff --git a/basic/inc/basic/basicmanagerrepository.hxx b/basic/inc/basic/basicmanagerrepository.hxx
index 964b76c9e2..9af9f1603f 100644
--- a/basic/inc/basic/basicmanagerrepository.hxx
+++ b/basic/inc/basic/basicmanagerrepository.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -144,3 +145,4 @@ namespace basic
#endif // BASICMANAGERREPOSITORY_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/basicrt.hxx b/basic/inc/basic/basicrt.hxx
index 5bbe7d31c2..5366d9bf10 100644
--- a/basic/inc/basic/basicrt.hxx
+++ b/basic/inc/basic/basicrt.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -77,3 +78,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx
index 886aa7f544..6b3a024ec4 100644
--- a/basic/inc/basic/basmgr.hxx
+++ b/basic/inc/basic/basmgr.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -166,7 +167,7 @@ protected:
BasicLibInfo* FindLibInfo( StarBASIC* pBasic ) const;
void CheckModules( StarBASIC* pBasic, BOOL bReference ) const;
void SetFlagToAllLibs( short nFlag, BOOL bSet ) const;
- BasicManager(); // Nur zum anpassen von Pfaden bei 'Speichern unter'.
+ BasicManager(); // This is used only to customize the paths for 'Save as'.
~BasicManager();
public:
@@ -211,7 +212,7 @@ public:
BOOL LoadLib( USHORT nLib );
BOOL RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage );
- // Modify-Flag wird nur beim Speichern zurueckgesetzt.
+ // Modify-Flag will be reset only during save.
BOOL IsModified() const;
BOOL IsBasicModified() const;
@@ -236,7 +237,7 @@ public:
takes the names of modules whose size exceeds the legacy limit
*/
bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
-
+ bool HasExeCode( const String& );
private:
BOOL IsReference( USHORT nLib );
@@ -259,3 +260,5 @@ private:
void SetAppBasicManager( BasicManager* pBasMgr );
#endif //_BASMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/basrdll.hxx b/basic/inc/basic/basrdll.hxx
index 8695c63291..c8a59a32fa 100644
--- a/basic/inc/basic/basrdll.hxx
+++ b/basic/inc/basic/basrdll.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -57,3 +58,5 @@ public:
#define BASIC_DLL() (*(BasicDLL**)GetAppData( SHL_BASIC ) )
#endif //_BASRDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/dispdefs.hxx b/basic/inc/basic/dispdefs.hxx
index e9dcc1fd4d..75b7ce2f11 100644
--- a/basic/inc/basic/dispdefs.hxx
+++ b/basic/inc/basic/dispdefs.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,3 +37,4 @@
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/modsizeexceeded.hxx b/basic/inc/basic/modsizeexceeded.hxx
index 9b347a3cae..6e290b82a9 100644
--- a/basic/inc/basic/modsizeexceeded.hxx
+++ b/basic/inc/basic/modsizeexceeded.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -59,3 +60,4 @@ class ModuleSizeExceeded : public ::cppu::WeakImplHelper1< ::com::sun::star::tas
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/mybasic.hxx b/basic/inc/basic/mybasic.hxx
index b3964fac25..371badaee4 100644
--- a/basic/inc/basic/mybasic.hxx
+++ b/basic/inc/basic/mybasic.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,11 +30,16 @@
#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;
@@ -43,11 +49,7 @@ public:
void Show();
};
-DECLARE_LIST( ErrorList, BasicError* )
-
-#define SBXID_MYBASIC 0x594D // MyBasic: MY
-#define SBXCR_TEST 0x54534554 // TEST
-
+//-----------------------------------------------------------------------------
class MyBasic : public StarBASIC
{
SbError nError;
@@ -55,6 +57,8 @@ class MyBasic : public StarBASIC
virtual USHORT BreakHdl();
protected:
+ ::std::vector< BasicError* > aErrors;
+ size_t CurrentError;
Link GenLogHdl();
Link GenWinInfoHdl();
Link GenModuleWinExistsHdl();
@@ -67,19 +71,22 @@ protected:
public:
SBX_DECL_PERSIST_NODATA(SBXCR_TEST,SBXID_MYBASIC,1);
TYPEINFO();
- ErrorList aErrors;
MyBasic();
virtual ~MyBasic();
virtual 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
+ // Determines the extended symbol type for syntax highlighting
virtual SbTextType GetSymbolType( const String &Symbol, BOOL bWasTTControl );
virtual const String GetSpechialErrorText();
virtual void ReportRuntimeError( AppBasEd *pEditWin );
@@ -92,3 +99,5 @@ public:
SV_DECL_IMPL_REF(MyBasic)
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/process.hxx b/basic/inc/basic/process.hxx
index 2890d9a910..6c35174b63 100644
--- a/basic/inc/basic/process.hxx
+++ b/basic/inc/basic/process.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,7 +30,7 @@
#define _PROCESS_HXX
#include <tools/string.hxx>
-#include <vos/process.hxx>
+#include <osl/process.h>
#include <map>
@@ -61,3 +62,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbdef.hxx b/basic/inc/basic/sbdef.hxx
index 4be25089b4..03ae7c4dfe 100644
--- a/basic/inc/basic/sbdef.hxx
+++ b/basic/inc/basic/sbdef.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -108,3 +109,5 @@ enum PropertyMode
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sberrors.hxx b/basic/inc/basic/sberrors.hxx
index 92866fd81a..1a7d630f66 100644
--- a/basic/inc/basic/sberrors.hxx
+++ b/basic/inc/basic/sberrors.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -560,3 +561,5 @@ typedef ULONG SbError;
// OLE messages from 31000-31999
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbmeth.hxx b/basic/inc/basic/sbmeth.hxx
index 38319ac4e6..defc2c6418 100644
--- a/basic/inc/basic/sbmeth.hxx
+++ b/basic/inc/basic/sbmeth.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,6 +47,7 @@ class SbMethod : public SbxMethod
friend class SbIfaceMapperMethod;
SbMethodImpl* mpSbMethodImpl; // Impl data
+ SbxVariable* mCaller; // caller
SbModule* pMod;
USHORT nDebugFlags;
USHORT nLine1, nLine2;
@@ -71,8 +73,8 @@ public:
void SetDebugFlags( USHORT n ) { nDebugFlags = n; }
void GetLineRange( USHORT&, USHORT& );
- // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
- virtual ErrCode Call( SbxValue* pRet = NULL );
+ // Interface to execute a method from the applications
+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
virtual void Broadcast( ULONG nHintId );
};
@@ -99,3 +101,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index 047f16bf38..acf674aa59 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -192,3 +193,5 @@ SV_DECL_IMPL_REF(SbClassModuleObject);
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbprop.hxx b/basic/inc/basic/sbprop.hxx
index e7ac3bf3fe..e2920dffb0 100644
--- a/basic/inc/basic/sbprop.hxx
+++ b/basic/inc/basic/sbprop.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -78,3 +79,5 @@ SV_DECL_IMPL_REF(SbProcedureProperty)
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index 858c818b45..b9b52773f0 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <basic/sbx.hxx>
#include <basic/sbxobj.hxx>
-#ifndef _RTL_USTRING_HXX
#include <rtl/ustring.hxx>
-#endif
#include <osl/mutex.hxx>
#include <basic/sbdef.hxx>
@@ -223,3 +222,4 @@ SV_DECL_IMPL_REF(StarBASIC)
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbstdobj.hxx b/basic/inc/basic/sbstdobj.hxx
index b3a3c99fa7..3ae022073c 100644
--- a/basic/inc/basic/sbstdobj.hxx
+++ b/basic/inc/basic/sbstdobj.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _SBSTDOBJ1_HXX
#include <basic/sbxobj.hxx>
-#ifndef _GRAPH_HXX //autogen
#include <vcl/graph.hxx>
-#endif
#include <basic/sbxfac.hxx>
class StarBASIC;
class SbStdFactory;
@@ -143,3 +142,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbuno.hxx b/basic/inc/basic/sbuno.hxx
index 27fe320dd8..cb0c670fbe 100644
--- a/basic/inc/basic/sbuno.hxx
+++ b/basic/inc/basic/sbuno.hxx
@@ -1,3 +1,4 @@
+/* -*- 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 +39,7 @@ SbxObjectRef GetSbUnoObject( const String& aName, const com::sun::star::uno::Any
// Force creation of all properties for debugging
void createAllObjectProperties( SbxObject* pObj );
+void SetSbUnoObjectDfltPropName( SbxObject* pObj );
::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
@@ -45,3 +47,4 @@ void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx
index 647aeea7f7..0b28e0ded1 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,14 +35,10 @@
#include "svl/lstner.hxx"
#include <basic/sbxdef.hxx>
#include <basic/sbxform.hxx>
-
-#ifndef __SBX_SBXOBJECT_HXX
#include <basic/sbxobj.hxx>
-#endif
#include <basic/sbxprop.hxx>
#include <basic/sbxmeth.hxx>
-class BigInt;
class String;
class UniString;
class SvStream;
@@ -53,8 +50,6 @@ class SbxObject;
class SbxArray;
class SbxDimArray;
class SbxFactory;
-struct SbxINT64;
-struct SbxUINT64;
class SfxBroadcaster;
class SvDispatch;
@@ -79,11 +74,7 @@ struct SbxParamInfo
~SbxParamInfo() {}
};
-//#if 0 // _SOLAR__PRIVATE
SV_DECL_PTRARR_DEL(SbxParams,SbxParamInfo*,4,4)
-//#else
-//typedef SvPtrarr SbxParams;
-//#endif
#endif
@@ -158,9 +149,9 @@ public:
#ifndef __SBX_SBXARRAY
#define __SBX_SBXARRAY
-// SbxArray ist ein eindimensionales, dynamisches Array
-// von SbxVariablen. Put()/Insert() konvertieren die Variablen in den
-// angegebenen Datentyp, falls er nicht SbxVARIANT ist.
+// SbxArray is an unidimensional, dynamic Array
+// The variables convert from SbxVariablen. Put()/Insert() into the
+// declared datatype, if they are not SbxVARIANT.
class SbxVarRefs;
class SbxVariableRef;
@@ -367,3 +358,5 @@ SV_IMPL_REF(SbxDimArray)
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx
index c4519a9a86..65554ef7f0 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,14 +39,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;
@@ -58,3 +57,5 @@ struct SbxAppData
SbxAppData* GetSbxData_Impl();
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxcore.hxx b/basic/inc/basic/sbxcore.hxx
index df156dae97..5f37de70c2 100644
--- a/basic/inc/basic/sbxcore.hxx
+++ b/basic/inc/basic/sbxcore.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -179,3 +180,5 @@ inline BOOL SbxBase::IsVisible() const
{ DBG_CHKTHIS( SbxBase, 0 ); return IsReset( SBX_INVISIBLE ); }
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx
index 393a3773e7..0c4020d3e2 100644
--- a/basic/inc/basic/sbxdef.hxx
+++ b/basic/inc/basic/sbxdef.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,22 +32,20 @@
#ifndef __RSC
-#ifndef _SOLAR_H
#include <tools/solar.h>
-#endif
#include "tools/errcode.hxx"
#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
@@ -55,54 +54,61 @@ 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, // * Anzeige fuer varianten Datentyp
- 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, // AB 10.4.97, fuer GetCoreString(), nur zum Konvertieren
- SbxWSTRING = 33, // AB 4.10.2000 Reimplemented for backwards compatibility (#78919)
- SbxWCHAR = 34, // AB 4.10.2000 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 (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)
+
+//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;
@@ -115,31 +121,34 @@ const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no c
#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 (max 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
@@ -147,156 +156,89 @@ 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
-// AB: 20.3.96: New error messages
-typedef ULONG SbxError; // Preserve old type
+// from 1996/3/20: New error messages
+typedef ULONG 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 ist 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
-
-
-/* Old codes with VB error codes
-enum SbxError { // Ergebnis einer Rechenoperation/Konversion
- SbxERR_OK = 0, // durchgefuehrt
- SbxERR_SYNTAX = 2, // Syntaxfehler im Parser
- SbxERR_NOTIMP = 5, // nicht moeglich
- SbxERR_OVERFLOW = 6, // Ueberlauf
- SbxERR_BOUNDS = 9, // Array-Index ungueltig
- SbxERR_ZERODIV = 11, // Division durch Null
- SbxERR_CONVERSION = 13, // falscher Datentyp
- SbxERR_BAD_PARAMETER = 14, // ungltiger Parameter
- SbxERR_PROC_UNDEFINED = 35, // BASIC-Sub oder Function undefiniert
- SbxERR_ERROR = 51, // andere Fehler
- // Objektbezogene Fehler
- SbxERR_NO_OBJECT = 91, // Objektvariable nicht belegt
- SbxERR_CANNOT_LOAD = 323, // Objekt kann nicht geladen/eingerichtet werden
- SbxERR_BAD_INDEX = 341, // Invalid object index
- SbxERR_NO_ACTIVE_OBJECT=366,// Objekt ist nicht aktiviert
- SbxERR_BAD_PROP_VALUE = 380,// Bad property value
- SbxERR_PROP_READONLY = 382, // Property is read only
- SbxERR_PROP_WRITEONLY = 394,// Property is write only
- SbxERR_INVALID_OBJECT = 420,// Invalid object reference
- SbxERR_NO_METHOD = 423, // Property oder Methode unbekannt
- SbxERR_INVALID_USAGE_OBJECT=425,// Falsche Verwendung eines Objekts
- SbxERR_NO_OLE = 430, // Kein OLE-Objekt
- SbxERR_BAD_METHOD = 438, // Methode nicht untersttzt
- SbxERR_OLE_ERROR = 440, // OLE Automation-Fehler
- SbxERR_BAD_ACTION = 445, // Aktion nicht untersttzt
- SbxERR_NO_NAMED_ARGS = 446, // Keine benannten Argumente
- SbxERR_BAD_LOCALE = 447, // Laenderspezifische Einstellungen nicht untersttzt
- SbxERR_NAMED_NOT_FOUND = 448,// Unbekanntes benanntes Argument
- SbxERR_NOT_OPTIONAL = 449, // Argument nicht optional
- SbxERR_WRONG_ARGS = 450, // Falsche Zahl von Argumenten
- SbxERR_NOT_A_COLL = 451 // Objekt enth„lt keine Elemente
-};
-*/
+#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
@@ -322,66 +264,74 @@ enum SbxError { // Ergebnis einer Rechenoperation/Konversion
// 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 ((UINT16) 65535)
+#define SbxMAXLNG ( 2147483647)
+#define SbxMINLNG ((INT32)(-2147483647-1))
+#define SbxMAXULNG ((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
enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 };
-#endif // __RSC
+#endif //ifndef __RSC
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxfac.hxx b/basic/inc/basic/sbxfac.hxx
index b410ed3a53..bb58cf2d76 100644
--- a/basic/inc/basic/sbxfac.hxx
+++ b/basic/inc/basic/sbxfac.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,3 +47,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxform.hxx b/basic/inc/basic/sbxform.hxx
index 46eb030eb8..e1d25b979f 100644
--- a/basic/inc/basic/sbxform.hxx
+++ b/basic/inc/basic/sbxform.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -179,3 +180,4 @@ class SbxBasicFormater {
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxmeth.hxx b/basic/inc/basic/sbxmeth.hxx
index b2c84a3440..875627f233 100644
--- a/basic/inc/basic/sbxmeth.hxx
+++ b/basic/inc/basic/sbxmeth.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -60,3 +61,4 @@ SV_IMPL_REF(SbxMethod)
#endif
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxmstrm.hxx b/basic/inc/basic/sbxmstrm.hxx
index 1ffdceea62..dfee8ecade 100644
--- a/basic/inc/basic/sbxmstrm.hxx
+++ b/basic/inc/basic/sbxmstrm.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,3 +48,5 @@ class SbxMemoryStream : public SbxBase, public SvMemoryStream
SV_IMPL_REF(SbxMemoryStream)
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxobj.hxx b/basic/inc/basic/sbxobj.hxx
index 4d17fe4a56..cdcced040b 100644
--- a/basic/inc/basic/sbxobj.hxx
+++ b/basic/inc/basic/sbxobj.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -123,3 +124,5 @@ SV_IMPL_REF(SbxObject)
#endif /* __SBX_SBXOBJECTREF_HXX */
#endif /* _SBX_SBXOBJECT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxprop.hxx b/basic/inc/basic/sbxprop.hxx
index 3c31d9f90e..33bbdd4188 100644
--- a/basic/inc/basic/sbxprop.hxx
+++ b/basic/inc/basic/sbxprop.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -59,3 +60,5 @@ SV_IMPL_REF(SbxProperty)
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index 72615f8c66..d452b7b8e1 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,143 +34,25 @@
#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_Unicode nChar;
BYTE nByte;
- INT16 nInteger;
- INT32 nLong;
UINT16 nUShort;
+ sal_Unicode nChar;
+ INT16 nInteger;
UINT32 nULong;
+ INT32 nLong;
+ unsigned int nUInt;
+ int nInt;
+ sal_uInt64 uInt64;
+ sal_Int64 nInt64;
+
float nSingle;
double nDouble;
SbxINT64 nLong64;
@@ -182,20 +65,21 @@ struct SbxValues
SbxDecimal* pDecimal;
SbxBase* pObj;
- sal_Unicode* pChar;
+
BYTE* pByte;
- INT16* pInteger;
- INT32* pLong;
UINT16* pUShort;
+ sal_Unicode* pChar;
+ INT16* pInteger;
UINT32* pULong;
+ 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;
@@ -208,15 +92,13 @@ struct SbxValues
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( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
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
@@ -254,28 +136,28 @@ public:
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 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 SbxClassType GetClass() const;
@@ -310,18 +192,45 @@ public:
BOOL HasObject() const;
void* GetData() const;
sal_Unicode GetChar() const;
- BYTE GetByte() const;
- UINT16 GetUShort() const;
- 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 );
+ UINT16 GetUShort() const;
+ UINT32 GetULong() const;
+ int GetInt() const;
+ INT16 GetInteger() const;
+ 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;
+
+ const String& GetString() const;
+ const String& GetCoreString() const;
+ rtl::OUString GetOUString() const;
+
+ SbxBase* GetObject() const;
+ BOOL HasObject() const;
+ void* GetData() const;
+
+
+ BOOL PutEmpty();
+ BOOL PutNull();
+ BOOL PutErr( USHORT );
+
+ BOOL PutBool( BOOL );
+ BOOL PutByte( BYTE );
+ BOOL PutChar( sal_Unicode );
+ BOOL PutUShort( UINT16 );
+ BOOL PutULong( UINT32 );
+ BOOL PutInt( int );
BOOL PutInteger( INT16 );
BOOL PutLong( INT32 );
+ BOOL PutInt64( sal_Int64 );
+ BOOL PutUInt64( sal_uInt64 );
+
BOOL PutSingle( float );
BOOL PutDouble( double );
BOOL PutDate( double );
@@ -331,20 +240,17 @@ public:
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
+ // Special methods
BOOL PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
BOOL fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
+ BOOL PutDecimal( SbxDecimal* pDecimal );
+ BOOL PutCurrency( const sal_Int64& );
+ // Interface for CDbl in Basic
+ static SbxError ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle=FALSE );
+
+ BOOL PutObject( SbxBase* );
+ BOOL PutData( void* );
virtual BOOL Convert( SbxDataType );
virtual BOOL Compute( SbxOperator, const SbxValue& );
@@ -352,12 +258,9 @@ public:
BOOL Scan( const String&, USHORT* = 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;
@@ -446,7 +349,7 @@ 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
@@ -515,3 +418,5 @@ SV_DECL_REF(SbxVariable)
#endif
#endif // _SBXVAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/testtool.hxx b/basic/inc/basic/testtool.hxx
index 9a299d35b1..80a8dc4b90 100644
--- a/basic/inc/basic/testtool.hxx
+++ b/basic/inc/basic/testtool.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,7 +43,6 @@
// this routine became necessary
BOOL IsTTSignatureForUnicodeTextfile( String aLine );
-//#include "testapp.hxx"
#define ADD_ERROR_QUIET(nNr, aStr) \
{ \
ErrorEntry *pErr; \
@@ -158,3 +158,5 @@ public:
};
#endif // _BASIC_TESTTOOL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/ttstrhlp.hxx b/basic/inc/basic/ttstrhlp.hxx
index b971d5c1d1..c517e9cc87 100644
--- a/basic/inc/basic/ttstrhlp.hxx
+++ b/basic/inc/basic/ttstrhlp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -74,3 +75,4 @@ UniString GEN_RES_STR3( ULONG nResId, const UniString &Text1, const UniString &T
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basrid.hxx b/basic/inc/basrid.hxx
index 883b2c973b..a08e5d51e9 100644
--- a/basic/inc/basrid.hxx
+++ b/basic/inc/basrid.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,3 +44,5 @@ class BasResId : public ResId
};
#endif //_BASRID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/pch/precompiled_basic.cxx b/basic/inc/pch/precompiled_basic.cxx
index 0746e87f95..6c546e131b 100644
--- a/basic/inc/pch/precompiled_basic.cxx
+++ b/basic/inc/pch/precompiled_basic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,3 +28,4 @@
#include "precompiled_basic.hxx"
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/pch/precompiled_basic.hxx b/basic/inc/pch/precompiled_basic.hxx
index 845421bef8..48570c92c7 100644
--- a/basic/inc/pch/precompiled_basic.hxx
+++ b/basic/inc/pch/precompiled_basic.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -148,6 +149,7 @@
#include "i18npool/lang.h"
+#include "osl/diagnose.h"
#include "osl/file.hxx"
#include "osl/module.h"
#include "osl/mutex.hxx"
@@ -275,14 +277,11 @@
#include "tools/wintypes.hxx"
#include "vcl/wrkwin.hxx"
-#include "vos/diagnose.hxx"
-#include "vos/macros.hxx"
-#include "vos/mutex.hxx"
-#include "vos/process.hxx"
-
#include "xmlscript/xmldlg_imexp.hxx"
#include "xmlscript/xmllib_imexp.hxx"
#include "xmlscript/xmlmod_imexp.hxx"
//---MARKER---
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/sb.hxx b/basic/inc/sb.hxx
index e194719866..19b72d1a22 100644
--- a/basic/inc/sb.hxx
+++ b/basic/inc/sb.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,3 +41,5 @@
#include <basic/sbstar.hxx>
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index 8eab007313..8eab007313 100644..100755
--- a/basic/prj/build.lst
+++ b/basic/prj/build.lst
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index f8b2d66239..f50a491a3f 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,20 +29,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <tools/fsys.hxx>
-#ifndef _SV_FILEDLG_HXX //autogen
#include <svtools/filedlg.hxx>
-#endif
#include <tools/config.hxx>
#include <vcl/font.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include <basic/sbx.hxx>
#include <svtools/filedlg.hxx>
@@ -60,9 +55,7 @@
#include <basic/basrdll.hxx>
#include "basrid.hxx"
-#ifndef _RUNTIME_HXX
#include "runtime.hxx"
-#endif
#include "sbintern.hxx"
#ifdef _USE_UNO
@@ -161,20 +154,20 @@ 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;
}
+
void SAL_CALL DBG_TestToolDebugMessageFilter( const sal_Char *pString )
{
TestToolDebugMessageFilter( pString, FALSE );
}
+
extern "C" void SAL_CALL osl_TestToolDebugMessageFilter( const sal_Char *pString )
{
if ( !getenv( "DISABLE_SAL_DBGBOX" ) )
TestToolDebugMessageFilter( pString, TRUE );
}
+
#endif
// #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors
@@ -209,38 +202,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;
}
@@ -252,17 +225,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
@@ -289,8 +255,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;
@@ -322,31 +288,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 );
@@ -370,7 +317,6 @@ void BasicApp::Main( )
PostUserEvent( LINK( this, BasicApp, LateInit ) );
Execute();
-// delete pHelp;
delete pFrame;
RemoveAccel( pMainAccel );
@@ -390,6 +336,7 @@ void BasicApp::Main( )
InfoBox( NULL, String::CreateFromAscii( "unknown Exception not caught" ) ).Execute();
throw;
}
+ return EXIT_SUCCESS;
}
void BasicApp::LoadIniFile()
@@ -405,7 +352,7 @@ void BasicApp::SetFocus()
IMPL_LINK( BasicApp, LateInit, void *, pDummy )
{
- (void) pDummy; /* avoid warning about unused parameter */
+ (void) pDummy; /* avoid warning about unused parameter */
USHORT i;
for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
{
@@ -513,7 +460,7 @@ 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;
}
@@ -547,12 +494,10 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
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 ) );
}
@@ -625,7 +570,6 @@ BasicFrame::BasicFrame() : WorkWindow( NULL,
LoadIniFile();
UpdateTitle();
-// SetIcon( aAppIcon );
// Size: half width, 0.75 * height - 2 * IconSize
{
@@ -634,15 +578,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();
@@ -688,17 +627,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 );
@@ -707,12 +644,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:
@@ -762,8 +697,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 )
{
@@ -810,19 +745,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;
}
@@ -849,11 +775,10 @@ 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();
}
}
@@ -873,42 +798,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();
+ 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, 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() )
+ 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
@@ -927,17 +868,26 @@ 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 );
+ for ( size_t i = 0, n = pList->size(); i < n && !bHasFullscreenWin; ++i )
+ {
+ p = pList->at( i );
+ bHasFullscreenWin = ( p->GetWinState() == TT_WIN_STATE_MAX );
+ }
GetMenuBar()->ShowButtons( bHasFullscreenWin, FALSE, FALSE );
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();
@@ -947,7 +897,8 @@ void BasicFrame::RemoveWindow( AppWin *pWin )
WinMax_Restore();
Menu* pMenu = GetMenuBar();
- if( pList->Count() == 0 ) {
+ if( pList->empty() )
+ {
pMenu->EnableItem( RID_APPEDIT, FALSE );
pMenu->EnableItem( RID_APPRUN, FALSE );
pMenu->EnableItem( RID_APPWINDOW, FALSE );
@@ -966,14 +917,15 @@ 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 ) {
+ if( !pList->empty() )
+ {
pMenu->EnableItem( RID_APPEDIT, TRUE );
pMenu->EnableItem( RID_APPRUN, TRUE );
pMenu->EnableItem( RID_APPWINDOW, TRUE );
@@ -1011,8 +963,15 @@ void BasicFrame::WindowRenamed( AppWin *pWin )
void BasicFrame::FocusWindow( AppWin *pWin )
{
pWork = pWin;
- pList->Remove( pWin );
- pList->Insert( pWin, LIST_APPEND );
+ for ( EditList::iterator it = pList->begin(); it < pList->end(); ++it )
+ {
+ if ( *it == pWin )
+ {
+ pList->erase( it );
+ break;
+ }
+ }
+ pList->push_back( pWin );
pWin->Minimize( FALSE );
aAppFile = pWin->GetText();
@@ -1049,8 +1008,8 @@ BOOL BasicFrame::Close()
BOOL BasicFrame::CloseAll()
{
- while ( pList->Count() )
- if ( !pList->Last()->Close() )
+ while ( !pList->empty() )
+ if ( !pList->back()->Close() )
return FALSE;
return TRUE;
}
@@ -1058,8 +1017,11 @@ BOOL BasicFrame::CloseAll()
BOOL BasicFrame::CompileAll()
{
AppWin* p;
- for( p = pList->First(); p; p = pList->Next() )
- if( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE;
+ for ( size_t i = 0, n = pList->size(); i < n; ++i )
+ {
+ p = pList->at( i );
+ if ( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE;
+ }
return TRUE;
}
@@ -1159,10 +1121,8 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
BOOL bNormal = BOOL( !bInBreak );
pMenu->EnableItem( RID_RUNCOMPILE, bNormal );
- BOOL bHasEdit = BOOL( /*bNormal &&*/ pWork != NULL );
+ BOOL bHasEdit = 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 );
@@ -1174,18 +1134,18 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
BOOL bHasErr = BOOL( bNormal && pBasic->GetErrors() != 0 );
BOOL bNext = bHasErr & bNormal;
BOOL bPrev = bHasErr & bNormal;
- if( bHasErr )
+ if( bHasErr )
{
- ULONG n = pBasic->aErrors.GetCurPos();
+ size_t n = pBasic->GetCurrentError();
if( n == 0 )
bPrev = FALSE;
- if( USHORT(n+1) == pBasic->GetErrors() )
+ if( SbError(n+1) == pBasic->GetErrors() )
bNext = 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;
@@ -1193,21 +1153,8 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu )
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 );
-*/
+ (void) pMenu; /* avoid warning about unused parameter */
+
SetAutoRun( FALSE );
String aString;
pStatus->Message( aString );
@@ -1240,7 +1187,7 @@ 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))
{
@@ -1341,7 +1288,6 @@ 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:
{
@@ -1349,7 +1295,6 @@ long BasicFrame::Command( short nID, BOOL bChecked )
if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, FALSE ) ) {
AddToLRU( s );
LoadFile( s );
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
}
} break;
case RID_FILELOADLIB:
@@ -1360,7 +1305,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 )
@@ -1405,7 +1349,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;
@@ -1417,7 +1360,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);
@@ -1444,11 +1394,9 @@ long BasicFrame::Command( short nID, BOOL bChecked )
p->Run();
BasicDLL::SetDebugMode( 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() )
@@ -1464,7 +1412,6 @@ long BasicFrame::Command( short nID, BOOL bChecked )
case RID_RUNBREAK:
if ( Basic().IsRunning() && !bInBreak )
{
-// pINST->CalcBreakCallLevel(SbDEBUG_STEPINTO);
pINST->nBreakCallLvl = pINST->nCallLvl;
}
break;
@@ -1473,11 +1420,11 @@ long BasicFrame::Command( short nID, BOOL bChecked )
bInBreak = 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;
@@ -1494,13 +1441,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;
@@ -1518,10 +1464,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();
}
@@ -1540,16 +1486,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();
}
@@ -1569,26 +1511,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?
@@ -1621,14 +1551,11 @@ 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;
@@ -1637,8 +1564,9 @@ long BasicFrame::Command( short nID, BOOL bChecked )
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++ )
{
+ p = pList->at( i );
USHORT nRes = p->QuerySave( QUERY_DISK_CHANGED );
if( (( nRes == SAVE_RES_ERROR ) && QueryBox(this,SttResId(IDS_ASKSAVEERROR)).Execute() == RET_NO )
|| ( nRes == SAVE_RES_CANCEL ) )
@@ -1657,8 +1585,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);
}
@@ -1668,8 +1597,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);
}
@@ -1679,8 +1609,9 @@ 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;
}
@@ -1690,8 +1621,9 @@ AppWin* BasicFrame::FindWin( const String& rName )
AppWin* BasicFrame::FindWin( USHORT 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;
}
@@ -1701,8 +1633,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;
}
@@ -1711,9 +1644,9 @@ AppWin* BasicFrame::IsWinValid( AppWin* pMaybeWin )
IMPL_LINK( BasicFrame, WriteString, String*, pString )
{
- if ( pList->Last() )
+ if ( !pList->empty() )
{
- pList->Last()->pDataEdit->ReplaceSelected( *pString );
+ pList->back()->pDataEdit->ReplaceSelected( *pString );
return TRUE;
}
else
@@ -1753,8 +1686,6 @@ 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()
@@ -1813,19 +1744,12 @@ 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;
}
@@ -1833,15 +1757,14 @@ BOOL BasicFrame::QueryFileName
USHORT BasicFrame::BreakHandler()
{
bInBreak = TRUE;
-// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN ));
-// MenuBar aBar( ResId( RID_APPMENUBAR ) );
-// aBar.EnableItem( RID_APPEDIT, FALSE );
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;
}
@@ -1910,13 +1833,8 @@ 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( (USHORT)(aValue.ToInt32()) ) );
nInsertPos = nStart;
nStartPos = nStart;
aResult.Erase( nStart, nEnd-nStart+1 );
@@ -1946,3 +1864,4 @@ String BasicFrame::GenRealString( const String &aResString )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index 32b3a051da..bd91e122f5 100644
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,23 +30,17 @@
#define _BASICAPP_HXX
#include <vcl/svapp.hxx>
-#ifndef _HELP_HXX //autogen
#include <vcl/help.hxx>
-#endif
-#ifndef _MENU_HXX //autogen
#include <vcl/menu.hxx>
-#endif
-#ifndef _WRKWIN_HXX //autogen
#include <vcl/wrkwin.hxx>
-#endif
#include <vcl/timer.hxx>
#include <svl/brdcst.hxx>
#include <svl/lstner.hxx>
class BasicFrame;
#include <basic/mybasic.hxx>
+#include <vector>
-class EditList;
class AppWin;
class AppEdit;
class AppBasEd;
@@ -55,15 +50,15 @@ 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();
@@ -95,13 +90,13 @@ class BasicFrame : public WorkWindow, public SfxBroadcaster, public SfxListener
using SystemWindow::Notify;
using Window::Command;
-virtual BOOL Close();
+ virtual BOOL Close();
BOOL CloseAll(); // Close all windows
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;
@@ -194,3 +189,5 @@ public:
extern BasicApp aBasicApp;
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx
index f8377ea440..1f9467b2ab 100644
--- a/basic/source/app/appbased.cxx
+++ b/basic/source/app/appbased.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,18 +29,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <basic/sbx.hxx>
#include <svtools/texteng.hxx>
#include <svtools/textview.hxx>
#include <basic/sbmeth.hxx>
#include <svtools/stringtransfer.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "basic.hrc"
#include "status.hxx"
@@ -59,10 +56,8 @@ AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p )
pBreakpoints->Show();
-
((TextEdit*)pDataEdit)->GetTextEditImp().pTextView->SetAutoIndentMode( TRUE );
((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetMaxTextLen( STRING_MAXLEN );
-// ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetWordDelimiters( CUniString(" ,.;:(){}[]\"'+-*/<>^\\") );
((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( TRUE );
((TextEdit*)pDataEdit)->SaveAsUTF8( TRUE );
@@ -79,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() );
@@ -125,7 +116,7 @@ FileType AppBasEd::GetFileType()
IMPL_LINK_INLINE_START( AppBasEd, EditChange, void *, p )
{
- (void) p; /* avoid warning about unused parameter */
+ (void) p; /* avoid warning about unused parameter */
bCompiled = FALSE;
return TRUE;
}
@@ -161,7 +152,7 @@ void AppBasEd::Command( const CommandEvent& rCEvt )
void AppBasEd::Resize()
{
- if( pDataEdit )
+ if( pDataEdit )
{
AppEdit::Resize();
@@ -210,7 +201,6 @@ void AppBasEd::LoadSource()
{
BOOL bErr;
-// if( pDataEdit->GetText().Len() != 0 ) return;
String aName = pMod->GetName();
bErr = !pDataEdit->Load( aName );
pBreakpoints->LoadBreakpoints( GetText() );
@@ -250,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;
@@ -287,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() );
}
@@ -297,3 +287,4 @@ void AppBasEd::Run()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx
index eb9bf71aa1..2baf8326c9 100644
--- a/basic/source/app/appbased.hxx
+++ b/basic/source/app/appbased.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,12 +30,8 @@
#define _APPBASED_HXX
#include <basic/sbmod.hxx>
-#ifndef _SB_APPEDIT_HXX
#include "appedit.hxx"
-#endif
-#ifndef _SB_TEXTEDIT_HXX
#include "textedit.hxx"
-#endif
class BasicFrame;
class BreakpointWindow;
@@ -72,3 +69,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx
index 7a919c3416..bf7503b9bc 100644
--- a/basic/source/app/appedit.cxx
+++ b/basic/source/app/appedit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,9 +34,7 @@
#include <svtools/texteng.hxx>
#include <svl/undo.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "basic.hrc"
#include "appedit.hxx"
@@ -53,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 );
@@ -93,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 ) );
aFont.SetHeight( nFontSize );
#if OSL_DEBUG_LEVEL > 1
@@ -104,8 +98,6 @@ void AppEdit::LoadIniFile()
}
#endif
aFont.SetTransparent( FALSE );
-// aFont.SetAlign( ALIGN_BOTTOM );
-// aFont.SetHeight( aFont.GetHeight()+2 );
pDataEdit->SetFont( aFont );
if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() )
@@ -133,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;
@@ -185,8 +177,8 @@ void AppEdit::SetScrollBarRanges()
USHORT AppEdit::GetLineNr()
-{
- return pDataEdit->GetLineNr();
+{
+ return pDataEdit->GetLineNr();
}
FileType AppEdit::GetFileType()
@@ -198,12 +190,12 @@ FileType AppEdit::GetFileType()
long AppEdit::InitMenu( Menu* pMenu )
{
AppWin::InitMenu (pMenu );
-
+
if( pDataEdit )
{
USHORT UndoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetUndoActionCount();
USHORT RedoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetRedoActionCount();
-
+
pMenu->EnableItem( RID_EDITUNDO, UndoCount > 0 );
pMenu->EnableItem( RID_EDITREDO, RedoCount > 0 );
}
@@ -277,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() )
@@ -299,3 +290,4 @@ void AppEdit::Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 )
ToTop();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx
index 92187ff599..5b1a548b40 100644
--- a/basic/source/app/appedit.hxx
+++ b/basic/source/app/appedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
#ifndef _APPEDIT_HXX
#define _APPEDIT_HXX
-#ifndef _SCRBAR_HXX //autogen
#include <vcl/scrbar.hxx>
-#endif
#include "appwin.hxx"
#include "textedit.hxx"
@@ -68,3 +67,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx
index 239b6b4049..512a5ac406 100644
--- a/basic/source/app/apperror.cxx
+++ b/basic/source/app/apperror.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#include "precompiled_basic.hxx"
#include <tools/config.hxx>
#include <svtools/ctrltool.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "basic.hrc"
#include "apperror.hxx"
@@ -113,3 +112,5 @@ void AppError::LoadIniFile()
// aFont.SetHeight( aFont.GetHeight()+2 );
pDataEdit->SetFont( aFont );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx
index af1cc67a61..6e0bdbc7fd 100644
--- a/basic/source/app/apperror.hxx
+++ b/basic/source/app/apperror.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,3 +48,4 @@ public:
DirEntry aBaseDir;
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx
index a3d7f37513..2080305895 100644
--- a/basic/source/app/appwin.cxx
+++ b/basic/source/app/appwin.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#include "precompiled_basic.hxx"
#include <stdio.h>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <tools/fsys.hxx>
#include <svtools/stringtransfer.hxx>
@@ -189,14 +188,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 );
}
@@ -227,7 +226,7 @@ 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
}
@@ -318,7 +317,7 @@ 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;
@@ -655,3 +654,4 @@ void AppWin::Repeat()
pDataEdit->ReplaceSelected( aReplace );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx
index c9550d16b4..f2927d9a42 100644
--- a/basic/source/app/appwin.hxx
+++ b/basic/source/app/appwin.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,13 +29,14 @@
#ifndef _APPWIN_HXX
#define _APPWIN_HXX
-//#include <sb.hxx>
#include <vcl/dockwin.hxx>
#include <tools/fsys.hxx>
#include "app.hxx"
#include "dataedit.hxx"
+#include <vector>
+
typedef USHORT QueryBits;
#define QUERY_NONE ( QueryBits ( 0x00 ) )
#define QUERY_DIRTY ( QueryBits ( 0x01 ) )
@@ -75,7 +77,6 @@ protected:
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
@@ -133,6 +134,8 @@ public:
void SetWinId( USHORT nWId ) { nWinId = nWId; }
};
-DECLARE_LIST( EditList, AppWin* )
+typedef ::std::vector< AppWin* > EditList;
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src
index 045dec2683..32226ebbaa 100644
--- a/basic/source/app/basic.src
+++ b/basic/source/app/basic.src
@@ -148,7 +148,7 @@ ModalDialog IDD_FIND_DIALOG {
Size = MAP_APPFONT( 185, 70 );
SVLook = TRUE;
MOVEABLE = TRUE;
- // CLOSEABLE = TRUE; // Hat cancelbutton
+ // CLOSEABLE = TRUE; // It has a cancelbutton
FixedText RID_FIXEDTEXT1 {
Pos = MAP_APPFONT( 5, 10 );
@@ -184,7 +184,7 @@ ModalDialog IDD_REPLACE_DIALOG {
Size = MAP_APPFONT( 185, 88 );
SVLook = TRUE;
MOVEABLE = TRUE;
- // CLOSEABLE = TRUE; // Hat cancelbutton
+ // CLOSEABLE = TRUE; // It has a cancelbutton
FixedText RID_FIXEDTEXT1 {
Pos = MAP_APPFONT( 5, 10 );
Size = MAP_APPFONT( 55, 10 );
@@ -652,9 +652,9 @@ Menu RID_RUN {
};
};
};
-// Wird nur beim Test Tool eingef³gt
+// This will be inserted from the Test Tool
-// unter Folgendem Name
+// under the following name
String RID_TT_EXTRAS_NAME
{
Text[ en-US ] = "E~xtra";
diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx
index bca8c516ff..94c445dd44 100644
--- a/basic/source/app/basicrt.cxx
+++ b/basic/source/app/basicrt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -142,3 +143,5 @@ BOOL BasicRuntimeAccess::IsRunInit()
{
return GetSbData()->bRunInit;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/basmsg.hrc b/basic/source/app/basmsg.hrc
index e3accf183b..feea22a61d 100644
--- a/basic/source/app/basmsg.hrc
+++ b/basic/source/app/basmsg.hrc
@@ -27,17 +27,17 @@
#include "basic/ttglobal.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+// Here are included the messages of the folder /basic/source/app
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// Die Nummern dürfen sich NIE! ändern,
-// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
-// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+// The numbers must NEVER(!) change,
+// because they are saved in the result files and a renewed display
+// would display new strings or no strings.
///////////////////////////////
#define S_PROG_START ( BAS_START + 0 )
diff --git a/basic/source/app/basmsg.src b/basic/source/app/basmsg.src
index af24ea93a1..ba96cf55f5 100644
--- a/basic/source/app/basmsg.src
+++ b/basic/source/app/basmsg.src
@@ -27,18 +27,19 @@
#include "basmsg.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+// Here are included the messages of the folder /basic/source/app
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// Die Nummern dürfen sich NIE! ändern,
-// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
-// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+// 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
{
Text[ en-US ] = "Program start: ($Arg1); ($Arg2)";
diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx
index 499ea30ff3..ad9d75a6aa 100644
--- a/basic/source/app/brkpnts.cxx
+++ b/basic/source/app/brkpnts.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,9 +38,7 @@
#include <tools/config.hxx>
#include <vcl/gradient.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "brkpnts.hxx"
#include "basic.hrc"
@@ -48,15 +47,12 @@
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 )
@@ -76,13 +72,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();
}
@@ -103,15 +95,15 @@ void BreakpointWindow::SetBPsInModule()
{
pModule->ClearAllBP();
- Breakpoint* pBrk = First();
- while ( pBrk )
+ for ( size_t i = 0, n = BreakpointList.size(); i < n; ++i )
{
+ Breakpoint* pBrk = BreakpointList[ i ];
pModule->SetBP( (USHORT)pBrk->nLine );
#if OSL_DEBUG_LEVEL > 1
DBG_ASSERT( !pModule->IsCompiled() || pModule->IsBP( (USHORT)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" );
#endif
- pBrk = Next();
}
+
for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ )
{
SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod );
@@ -121,27 +113,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();
@@ -166,35 +161,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 )
{
@@ -203,18 +197,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();
}
@@ -241,14 +236,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") ));
@@ -274,16 +267,15 @@ 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 );
}
@@ -291,39 +283,46 @@ void BreakpointWindow::Paint( const Rectangle& )
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;
@@ -367,12 +366,12 @@ void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt )
}
-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();
}
@@ -384,3 +383,4 @@ void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags
Window::Scroll( nHorzScroll, nVertScroll );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx
index a5e3b444ad..0bfa94dff8 100644
--- a/basic/source/app/brkpnts.hxx
+++ b/basic/source/app/brkpnts.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,18 +27,15 @@
************************************************************************/
#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;
@@ -50,45 +48,32 @@ public:
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, USHORT 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 74a0c256e9..bf0761665f 100644
--- a/basic/source/app/dataedit.hxx
+++ b/basic/source/app/dataedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -114,3 +115,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx
index 4236555b87..19828f0057 100644
--- a/basic/source/app/dialogs.cxx
+++ b/basic/source/app/dialogs.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,26 +33,14 @@
#include <algorithm>
#include <tools/rc.hxx>
#include <vcl/metric.hxx>
-#ifndef _DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
-#endif
-#ifndef _BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
-#ifndef _FIXED_HXX //autogen
#include <vcl/fixed.hxx>
-#endif
-#ifndef _EDIT_HXX //autogen
#include <vcl/edit.hxx>
-#endif
#include <tools/config.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <tools/debug.hxx>
-#ifndef _SV_FILEDLG_HXX //autogen
#include <svtools/filedlg.hxx>
-#endif
#include <tools/stream.hxx>
#include <tools/fsys.hxx>
#include <svtools/stringtransfer.hxx>
@@ -61,7 +50,7 @@
#endif
#include <svtools/ctrltool.hxx>
-// Ohne Includeschutz
+
#include <svtools/svtdata.hxx>
#include <svl/solar.hrc>
@@ -327,7 +316,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 );
@@ -481,7 +470,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;
}
@@ -805,7 +794,7 @@ StringList* GenericOptions::GetAllGroups()
for ( USHORT 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;
}
@@ -813,31 +802,29 @@ 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();
@@ -845,7 +832,7 @@ void GenericOptions::ShowSelectPath( const String aType )
aPbSelectPath.Show( TRUE );
aPbSelectPath.Enable( TRUE );
}
- else if ( !aType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath )
+ else if ( !rType.EqualsIgnoreCaseAscii( "PATH" ) && bShowSelectPath )
{ // Hide Path button
nMoveButtons -= nDelta;
aMoveTimer.Start();
@@ -1006,7 +993,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
@@ -1199,8 +1186,6 @@ void DisplayHidDlg::AddData( WinInfoRec* pWinInfo )
if ( pWinInfo->nRType & DH_MODE_DATA_VALID ) // no old office
nDisplayMode = pWinInfo->nRType; // Is used for mode transmission while reset
-// if ( pWinInfo->aUId.GetULONG() & DH_MODE_DATA_VALID ) // kein altes Office
-// nDisplayMode = pWinInfo->aUId.GetULONG(); // Wird im Reset zur �bermittlung des Modus verwendet
return;
}
@@ -1401,7 +1386,7 @@ VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar )
IMPL_LINK( VarEditDialog, OKClick, Button *, pButton )
{
- (void) pButton; /* avoid warning about unused parameter */
+ (void) pButton; /* avoid warning about unused parameter */
BOOL bWasError = SbxBase::IsError(); // Probably an error is thrown
@@ -1431,7 +1416,7 @@ SvNumberformat::
int& nErrno,
const xub_Unicode** ppEnd = NULL );
// Converts just as strtod a decimal string to a double.
- // Decimal and thousand separators come from International,
+ // 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:
@@ -1505,3 +1490,4 @@ SvNumberformat::
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx
index 9b681bc87e..c2ecd100b4 100644
--- a/basic/source/app/dialogs.hxx
+++ b/basic/source/app/dialogs.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,37 +29,26 @@
#ifndef _DIALOGS_HXX
#define _DIALOGS_HXX
-#ifndef _DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
-#endif
-#ifndef _BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
-#ifndef _EDIT_HXX //autogen
#include <vcl/edit.hxx>
-#endif
-#ifndef _FIELD_HXX //autogen
#include <vcl/field.hxx>
-#endif
#include <vcl/fixed.hxx>
#include <vcl/tabdlg.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <tools/config.hxx>
-#ifndef _TOOLS_LIST_HXX
#include <tools/list.hxx>
-#endif
#include <vcl/lstbox.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/toolbox.hxx>
#include <svtools/ctrltool.hxx>
#include <svtools/ctrlbox.hxx>
+#include <vector>
class SbxVariable;
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
class AboutDialog : public ModalDialog {
FixedText a1,a4,aVersionString;
@@ -250,8 +240,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")
@@ -284,7 +273,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* );
@@ -360,12 +349,11 @@ protected:
DECL_LINK( OKClick, Button * );
-// BOOL bCompare = FALSE;
-// String aCompareString;
-
public:
VarEditDialog( Window * pParent, SbxVariable *pPVar );
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx
index 0e592d8e8e..72ccbc0be3 100644
--- a/basic/source/app/msgedit.cxx
+++ b/basic/source/app/msgedit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,18 +38,13 @@ Version 3 Changed Charset from CHARSET_IBMPC to RTL_TEXTENCODING_UTF8
#include <cstdio>
#include <tools/time.hxx>
#include <tools/stream.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _SOUND_HXX //autogen
#include <vcl/sound.hxx>
-#endif
#include <tools/fsys.hxx>
#include <svtools/stringtransfer.hxx>
#include <unotools/syslocale.hxx>
#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "basic.hrc"
#include "msgedit.hxx"
#include "app.hxx"
@@ -217,7 +213,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg )
// restore Original Msg
LogMsg->aDebugData.aMsg = aOriginalMsg;
- printf( ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ printf( "%s", ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
}
}
}
@@ -846,7 +842,7 @@ void TTTreeListBox::SelectHdl()
SelectChildren( pHdlEntry, TRUE );
Select( pHdlEntry, TRUE );
-// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist
+// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // so that delete works correct
}
void TTTreeListBox::DeselectHdl()
@@ -953,7 +949,7 @@ void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
if ( ( aFeatures & HasError ) == HasError )
aCol = Color( 255, 130, 130 ); // Red
else if ( ( aFeatures & HasWarning ) == HasWarning )
- aCol = Color( 255, 200, 120 ); // Ocker oder so
+ aCol = Color( 255, 200, 120 ); // Ochre or so
else if ( ( aFeatures & HasAssertion ) == HasAssertion )
aCol = Color( 0xd0, 0xd0, 0xff ); // blueish
else
@@ -997,3 +993,4 @@ void TTTreeListBox::InitEntry(SvLBoxEntry* pEntry,
pEntry->ReplaceItem( pStr, nColToHilite );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx
index 997b575dc2..7dc7117a8b 100644
--- a/basic/source/app/msgedit.hxx
+++ b/basic/source/app/msgedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,7 +36,7 @@
class BasicFrame;
class AppError;
-#define SelectChildren SelectChilds // Sonst wird mir schlecht
+#define SelectChildren SelectChilds
typedef USHORT TTFeatures; // Bitfield for features of the entries
#define HasNothing TTFeatures(0x00)
@@ -112,3 +113,5 @@ DATA_FUNC_DEF( aEditTree, TTTreeListBox )
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx
index 203e85d125..c7bfd0686d 100644
--- a/basic/source/app/mybasic.cxx
+++ b/basic/source/app/mybasic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,26 +29,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <basic/sbx.hxx>
// AB-Uno-Test
//#define unotest
#ifdef unotest
-#ifndef _USR_UNO_HXX
#include <usr/uno.hxx>
-#endif
#include <basic/sbuno.hxx>
#include <sbunoobj.hxx>
#endif
#include "sbintern.hxx"
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include <basic/mybasic.hxx>
#include "basic.hrc"
#include "appbased.hxx"
@@ -84,6 +79,7 @@ SbxBase* MyFactory::Create( UINT16 nSbxId, UINT32 nCr )
MyBasic::MyBasic() : StarBASIC()
{
nError = 0;
+ CurrentError = 0;
if( !nInst++ )
{
AddFactory( &aFac1 );
@@ -158,15 +154,15 @@ void MyBasic::LoadIniFile()
SbTextType MyBasic::GetSymbolType( const String &rSymbol, 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 );
@@ -177,8 +173,10 @@ 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 )
@@ -187,6 +185,36 @@ BOOL MyBasic::Compile( SbModule* p )
return StarBASIC::Compile( p );
}
+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;
+}
+
BOOL MyBasic::ErrorHdl()
{
AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() );
@@ -198,12 +226,13 @@ 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++;
+ CurrentError = aErrors.size() - 1;
return BOOL( nError < 20 ); // Cancel after 20 errors
}
else
@@ -228,7 +257,7 @@ void MyBasic::ReportRuntimeError( AppBasEd *pEditWin )
void MyBasic::DebugFindNoErrors( BOOL bDebugFindNoErrors )
{
- (void) bDebugFindNoErrors; /* avoid warning about unused parameter */
+ (void) bDebugFindNoErrors; /* avoid warning about unused parameter */
}
const String MyBasic::GetSpechialErrorText()
@@ -291,14 +320,15 @@ 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();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx
index ed314d1f0b..a1e8347b70 100644
--- a/basic/source/app/printer.cxx
+++ b/basic/source/app/printer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,21 +29,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#ifndef _PRINT_HXX //autogen
#include <vcl/print.hxx>
-#endif
-#ifndef _DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
-#endif
-#ifndef _FIXED_HXX //autogen
#include <vcl/fixed.hxx>
-#endif
-#ifndef _BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include <algorithm>
@@ -120,3 +111,4 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame *
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx
index 5251ebcd5d..0fe87f5450 100644
--- a/basic/source/app/printer.hxx
+++ b/basic/source/app/printer.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,3 +51,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx
index 6ade66ef49..a9a2fda227 100644
--- a/basic/source/app/process.cxx
+++ b/basic/source/app/process.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,42 +36,51 @@
#include <tools/postwin.h>
#endif
#include <tools/errcode.hxx>
-#include <vos/process.hxx>
#include <basic/sbxcore.hxx>
#include <tools/string.hxx>
#include <osl/file.hxx>
+#include <osl/process.h>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
-
-//#ifndef _BYTE_STRING_LIST
-//DECLARE_LIST( ByteStringList, ByteString * );
-//#define _BYTE_STRING_LIST
-//#endif
-
#include <basic/process.hxx>
Process::Process()
-: pArgumentList( NULL )
-, pEnvList( NULL )
-, pProcess( NULL )
+: m_nArgumentCount( 0 )
+, m_pArgumentList( NULL )
+, m_nEnvCount( 0 )
+, m_pEnvList( NULL )
+, m_aProcessName()
+, m_pProcess( NULL )
, bWasGPF( FALSE )
, bHasBeenStarted( FALSE )
{
}
+#define FREE_USTRING_LIST( count, list ) \
+ if ( count && list ) \
+ { \
+ for ( unsigned int i = 0; i < count; ++i ) \
+ { \
+ rtl_uString_release( list[i] ); \
+ list[i] = NULL; \
+ } \
+ delete[] list; \
+ } \
+ count = 0; \
+ list = NULL;
+
Process::~Process()
{
-// delete pArgumentList;
-// delete pEnvList;
- delete pProcess;
+ FREE_USTRING_LIST( m_nArgumentCount, m_pArgumentList );
+ FREE_USTRING_LIST( m_nEnvCount, m_pEnvList );
+ if ( m_pProcess )
+ osl_freeProcessHandle( m_pProcess );
}
BOOL Process::ImplIsRunning()
{
- if ( pProcess && bHasBeenStarted )
+ if ( m_pProcess && bHasBeenStarted )
{
vos::OProcess::TProcessInfo aProcessInfo;
pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
@@ -85,7 +95,7 @@ BOOL Process::ImplIsRunning()
long Process::ImplGetExitCode()
{
- if ( pProcess )
+ if ( m_pProcess )
{
vos::OProcess::TProcessInfo aProcessInfo;
pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
@@ -103,13 +113,14 @@ long Process::ImplGetExitCode()
void Process::SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv )
{ // Set image file of executable
- if ( pProcess && ImplIsRunning() )
+ if ( m_pProcess && ImplIsRunning() )
SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
else
{
- delete pArgumentList; pArgumentList = NULL;
- delete pEnvList; pEnvList = NULL;
- delete pProcess; pProcess = NULL;
+ FREE_USTRING_LIST( m_nArgumentCount, m_pArgumentList );
+ FREE_USTRING_LIST( m_nEnvCount, m_pEnvList );
+ osl_freeProcessHandle( m_pProcess );
+ m_pProcess = NULL;
xub_StrLen i, nCount = aAppParams.GetQuotedTokenCount( CUniString("\"\"" ), ' ' );
::rtl::OUString *pParamList = new ::rtl::OUString[nCount];
@@ -127,21 +138,21 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
pArgumentList = new vos::OArgumentList( pParamList, nCount );
- ::rtl::OUString *pEnvArray = NULL;
if ( pEnv )
{
- pEnvArray = new ::rtl::OUString[pEnv->size()];
+ m_pEnvList = new rtl_uString*[pEnv->size()];
- xub_StrLen nEnvCount = 0;
+ m_nEnvCount = 0;
Environment::const_iterator aIter = pEnv->begin();
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 );
- pEnvArray[nEnvCount] = aTemp;
- nEnvCount++;
- aIter++;
+ m_pEnvList[m_nEnvCount] = NULL;
+ rtl_uString_assign( &(m_pEnvList[m_nEnvCount]), aTemp.pData );
+ ++m_nEnvCount;
+ ++aIter;
}
pEnvList = new vos::OEnvironment( pEnvArray, nEnvCount );
}
@@ -151,19 +162,16 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
pProcess = new vos::OProcess( aNormalizedAppPath );
bHasBeenStarted = FALSE;
- delete [] pParamList;
- delete [] pEnvArray;
}
}
BOOL Process::Start()
{ // Start program
BOOL bSuccess=FALSE;
- if ( pProcess && !ImplIsRunning() )
+ if ( m_aProcessName.getLength() && !ImplIsRunning() )
{
bWasGPF = 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
{
@@ -187,7 +195,7 @@ BOOL Process::Start()
}
#ifdef WNT
}
- catch( ... )
+ catch( ... )
{
bWasGPF = TRUE;
// TODO: Output debug message !!
@@ -223,7 +231,8 @@ BOOL Process::WasGPF()
BOOL Process::Terminate()
{
if ( ImplIsRunning() )
- return pProcess->terminate() == vos::OProcess::E_None;
+ return osl_terminateProcess(m_pProcess) == osl_Process_E_None;
return TRUE;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx
index 285c84795b..6d2ffee3ab 100644
--- a/basic/source/app/processw.cxx
+++ b/basic/source/app/processw.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,14 +33,9 @@
#include <tools/errcode.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbx.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
-//#include <osl/thread.h>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "processw.hxx"
@@ -204,8 +200,7 @@ void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
SbxInfo* ProcessWrapper::GetInfo( short nIdx )
{
Methods* p = &pMethods[ nIdx ];
- // Wenn mal eine Hilfedatei zur Verfuegung steht:
- // SbxInfo* pResultInfo = new SbxInfo( Hilfedateiname, p->nHelpId );
+ // In case there is a help file available:
SbxInfo* pResultInfo = new SbxInfo;
short nPar = p->nArgs & _ARGSMASK;
for( short i = 0; i < nPar; i++ )
@@ -280,3 +275,4 @@ SbxObject* ProcessFactory::CreateObject( const String& rClass )
return NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx
index 648716fa84..983f2662ac 100644
--- a/basic/source/app/processw.hxx
+++ b/basic/source/app/processw.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _PROCESSW_HXX
#include <basic/sbxfac.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
#include <basic/sbxobj.hxx>
#include <basic/process.hxx>
@@ -88,3 +87,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx
index d10f84ead3..ab1d1011f2 100644
--- a/basic/source/app/status.cxx
+++ b/basic/source/app/status.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -112,7 +113,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++;
}
@@ -123,3 +124,4 @@ void StatusLine::LoadTaskToolBox()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx
index c0e686e919..e594e80d94 100644
--- a/basic/source/app/status.hxx
+++ b/basic/source/app/status.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,3 +53,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src
index f95e056e87..3bc51c11bc 100644
--- a/basic/source/app/svtmsg.src
+++ b/basic/source/app/svtmsg.src
@@ -27,17 +27,17 @@
#include "basic/svtmsg.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten
+// Here are included the messages of the folder /basic/source/app
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// Die Nummern dürfen sich NIE! ändern,
-// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
-// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+// 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
{
diff --git a/basic/source/app/testbasi.cxx b/basic/source/app/testbasi.cxx
index 50f4518168..e11efa1d74 100644
--- a/basic/source/app/testbasi.cxx
+++ b/basic/source/app/testbasi.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,3 +30,5 @@
#include "precompiled_basic.hxx"
#define testtool
#include "mybasic.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx
index 0d0ec1ed66..cd52b08d4d 100644
--- a/basic/source/app/textedit.cxx
+++ b/basic/source/app/textedit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,9 +33,7 @@
#include <svtools/textview.hxx>
#include <svtools/txtattr.hxx>
#include <basic/sbxmeth.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
-#endif
#include "basic.hrc"
#include "textedit.hxx"
@@ -89,7 +88,7 @@ BOOL TextEditImp::ViewMoved()
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;
@@ -199,10 +198,10 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
return;
SbTextPortion& rLast = aPortionList[nCount-1];
- if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoben
+ if ( rLast.nStart > rLast.nEnd ) // Only up to the bug of MD repaired
{
#if OSL_DEBUG_LEVEL > 1
- DBG_ERROR( "MD-Bug nicht beseitigt!" );
+ DBG_ERROR( "MD-Bug is not repaired!" );
#endif
nCount--;
aPortionList.Remove( nCount);
@@ -216,8 +215,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
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 ) // Nur bis Bug von MD behoben
+ if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired
continue;
SbTextType eType = r.eType;
@@ -247,7 +245,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
}
}
- // Es muessen nur die Blanks und Tabs mit attributiert werden.
+ // Only the blanks and tabs had to be attributed.
// If there are two equal attributes one after another,
// they are optimized by the EditEngine.
xub_StrLen nLastEnd = 0;
@@ -264,8 +262,8 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
if ( r.nStart > nLastEnd )
{
- // Kann ich mich drauf verlassen, dass alle ausser
- // Blank und Tab gehighlightet wird ?!
+ // can I trust that all of them except
+ // blank und tab will be highlighted?!
r.nStart = nLastEnd;
}
nLastEnd = r.nEnd+1;
@@ -277,8 +275,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
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 ) // Nur bis Bug von MD behoben
+ if ( r.nStart > r.nEnd ) // Only up to the bug of MD repaired
continue;
SbTextType eCol = r.eType;
@@ -338,13 +335,11 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff )
void TextEditImp::DoSyntaxHighlight( ULONG nPara )
{
- // Due to delayed syntax highlight it can happend that the
- // paragraph does no longer exist
+ // Due to delayed syntax highlight it can happen that the
+ // paragraph does no longer exist
if ( nPara < pTextEngine->GetParagraphCount() )
{
- // leider weis ich nicht, ob genau diese Zeile Modified() ...
-// if ( pProgress )
-// pProgress->StepProgress();
+ // unfortunatly I don't know if exact this line Modified() ...
pTextEngine->RemoveAttribs( nPara );
String aSource( pTextEngine->GetText( nPara ) );
ImpDoHighlight( aSource, nPara );
@@ -355,8 +350,6 @@ 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 )
{
@@ -382,16 +375,6 @@ IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG )
nLine = (USHORT)aSyntaxLineTable.GetCurKey();
DoSyntaxHighlight( nLine );
aSyntaxLineTable.Remove( nLine );
-/* if ( Application::AnyInput() )
- {
- aSyntaxIdleTimer.Start(); // Starten, falls wir in einem Dialog landen
- pTextView->ShowCursor( TRUE, TRUE );
- pTextEngine->SetUpdateMode( TRUE );
- bHighlightning = FALSE;
- GetpApp()->Reschedule();
- bHighlightning = TRUE;
- pTextEngine->SetUpdateMode( FALSE );
- }*/
}
BOOL bWasModified = pTextEngine->IsModified();
@@ -402,25 +385,17 @@ IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG )
}
else
pTextEngine->SetUpdateMode( TRUE ); // ! With VDev
-// pTextView->ForceUpdate();
// SetUpdateMode( 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;
if ( aSyntaxLineTable.First() )
aImplSyntaxIdleTimer.Start();
-// while ( Application::AnyInput() )
-// Application::Reschedule(); // Reschedule, da der UserEvent keine Paints etc. durchlässt
-
return 0;
}
@@ -451,7 +426,6 @@ void TextEditImp::SyntaxHighlight( BOOL bNew )
for ( ULONG i = 0; i < pTextEngine->GetParagraphCount(); i++ )
pTextEngine->RemoveAttribs( i );
-// pTextEngine->QuickFormatDoc();
pTextEngine->SetUpdateMode( TRUE );
pTextView->ShowCursor(TRUE, TRUE );
}
@@ -482,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 )
@@ -543,7 +519,7 @@ 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 );
@@ -864,3 +840,4 @@ void TextEdit::BuildKontextMenu( PopupMenu *&pMenu )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/textedit.hxx b/basic/source/app/textedit.hxx
index 78ca701592..de176f4a11 100644
--- a/basic/source/app/textedit.hxx
+++ b/basic/source/app/textedit.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,7 +43,6 @@ class BreakpointWindow;
#include "dataedit.hxx"
-//#include <xtextedt.hxx>
class TextEditImp : public Window, public SfxListener
{
@@ -136,3 +136,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/ttbasic.cxx b/basic/source/app/ttbasic.cxx
index a53dbc712e..cbe6e37b22 100644
--- a/basic/source/app/ttbasic.cxx
+++ b/basic/source/app/ttbasic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,3 +35,5 @@ MyBasic* TTBasic::CreateMyBasic()
{
return new MyBasic;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/ttbasic.hxx b/basic/source/app/ttbasic.hxx
index da443f083b..aa00588297 100644
--- a/basic/source/app/ttbasic.hxx
+++ b/basic/source/app/ttbasic.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,3 +31,4 @@ public:
static MyBasic* CreateMyBasic();
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src
index e7909d2365..876a7697f5 100644
--- a/basic/source/app/ttmsg.src
+++ b/basic/source/app/ttmsg.src
@@ -27,18 +27,19 @@
#include "basic/ttmsg.hrc"
-// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten
+// Here are included the messages of the folder /basic/source/testtool
///////////////////////////////
-// Fehlermeldungen, die in das Resultfile gelangen.
+// Error messages which go to the result file.
// *********************
-// *** !!ACHTUNG!! ***
+// *** !!ATTENTION!! ***
// *********************
-// Die Nummern dürfen sich NIE! ändern,
-// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen
-// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden.
+// 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
{
Text[ en-US ] = "Name doesn't exist: #($Arg1)";
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index ba126bf793..f4e49aa72a 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,9 +53,7 @@
#include <comphelper/documentinfo.hxx>
#include <unotools/eventlisteneradapter.hxx>
-#ifndef INCLUDED_OSL_DOUBLECHECKEDLOCKING_H
#include <rtl/instance.hxx>
-#endif
#include <map>
@@ -313,7 +312,7 @@ namespace basic
BasicManager* pBasicManager = new BasicManager( new StarBASIC, &aAppBasicDir );
setApplicationBasicManager( pBasicManager );
- // Als Destination das erste Dir im Pfad:
+ // The first dir in the path as destination:
String aFileName( aAppBasic.getName() );
aAppBasic = INetURLObject( aAppBasicDir.GetToken(1) );
DBG_ASSERT( aAppBasic.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
@@ -660,3 +659,4 @@ namespace basic
} // namespace basic
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index b2e0f58c05..b054d00fc9 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,6 +51,7 @@
#include "sbintern.hxx"
#include <sb.hrc>
+#include <vector>
#define LIB_SEP 0x01
#define LIBINFO_SEP 0x02
@@ -73,6 +75,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;
@@ -84,7 +88,7 @@ typedef WeakImplHelper1< XStarBasicModuleInfo > ModuleInfoHelper;
typedef WeakImplHelper1< XStarBasicDialogInfo > DialogInfoHelper;
typedef WeakImplHelper1< XStarBasicLibraryInfo > LibraryInfoHelper;
typedef WeakImplHelper1< XStarBasicAccess > StarBasicAccessHelper;
-
+typedef vector< BasicError* > BasErrorLst;
#define CURR_VER 2
@@ -114,8 +118,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
@@ -387,18 +389,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()
{
@@ -407,20 +415,36 @@ 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()
{
@@ -443,6 +467,8 @@ BasicError::BasicError( const BasicError& rErr ) :
}
+//=====================================================================
+
class BasicLibInfo
{
private:
@@ -511,14 +537,111 @@ 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;
@@ -830,7 +953,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
@@ -974,7 +1097,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
USHORT nLibs;
*xManagerStream >> nLibs;
- // Plausi!
+ // Plausibility!
if( nLibs & 0xF000 )
{
DBG_ASSERT( !this, "BasicManager-Stream defect!" );
@@ -1011,7 +1134,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR
}
}
- 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() &&
@@ -1055,11 +1178,9 @@ 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 ) );
- // und es geht weiter...
+ // and it proceeds ...
}
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
String aLibs;
@@ -1103,8 +1224,6 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
AddLib( *xStorageRef, aLibName, 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 ) );
}
@@ -1121,13 +1240,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;
@@ -1139,6 +1251,25 @@ void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
_rpManager = NULL;
}
+
+bool BasicManager::HasExeCode( const String& sLib )
+{
+ StarBASIC* pLib = GetLib(sLib);
+ if ( pLib )
+ {
+ SbxArray* pMods = pLib->GetModules();
+ USHORT nMods = pMods ? pMods->Count() : 0;
+ for( USHORT i = 0; i < nMods; i++ )
+ {
+ SbModule* p = (SbModule*) pMods->Get( i );
+ if ( p )
+ if ( p->HasExeCode() )
+ return true;
+ }
+ }
+ return false;
+}
+
void BasicManager::Init()
{
DBG_CHKTHIS( BasicManager, 0 );
@@ -1154,7 +1285,7 @@ BasicLibInfo* BasicManager::CreateLibInfo()
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = new BasicLibInfo;
- pLibs->Insert( pInf, LIST_APPEND );
+ pLibs->Insert( pInf );
return pInf;
}
@@ -1301,13 +1432,6 @@ 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;
}
@@ -1359,7 +1483,6 @@ 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 );
// Set StorageName before load because it is compared with pCurStorage
@@ -1375,7 +1498,6 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, B
{
pLibInfo->GetLib()->SetModified( FALSE ); // Don't save in this case
pLibInfo->SetRelStorageName( String() );
-// pLibInfo->CalcRelStorageName( GetStorageName() );
pLibInfo->IsReference() = TRUE;
}
else
@@ -1449,7 +1571,6 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage )
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() ) );
}
@@ -1612,7 +1733,6 @@ BOOL BasicManager::LoadLib( USHORT nLib )
StarBASIC* pLib = GetLib( nLib );
if ( pLib )
{
- // pLib->SetParent( GetStdLib() );
GetStdLib()->Insert( pLib );
pLib->SetFlag( SBX_EXTSEARCH );
}
@@ -1620,8 +1740,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) ) );
}
@@ -1658,16 +1776,7 @@ StarBASIC* BasicManager::CreateLib
if( !xStorage->GetError() )
{
pLib = AddLib( *xStorage, rLibName, TRUE );
-
- //if( !pLibInfo )
- //pLibInfo = FindLibInfo( pLib );
- //pLibInfo->SetStorageName( LinkTargetURL );
- //pLibInfo->GetLib()->SetModified( FALSE ); // Dann nicht speichern
- //pLibInfo->SetRelStorageName( String() );
- //pLibInfo->IsReference() = TRUE;
}
- //else
- //Message?
DBG_ASSERT( pLib, "XML Import: Linked basic library could not be loaded");
}
@@ -1830,7 +1939,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 );
@@ -2488,3 +2597,4 @@ Reference< XStarBasicAccess > getStarBasicAccess( BasicManager* pMgr )
return xRet;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx
index f6402a8f45..30003917ea 100644
--- a/basic/source/classes/disas.cxx
+++ b/basic/source/classes/disas.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -619,10 +620,10 @@ static char* SbiDisas_TypeOp_pTypes[13] = {
#endif
void SbiDisas::TypeOp( String& rText )
{
- // AB 19.1.96: Typ kann Flag für BYVAL enthalten (StepARGTYP)
+ // From 1996-01-19: type can contain flag for BYVAL (StepARGTYP)
if( nOp1 & 0x8000 )
{
- nOp1 &= 0x7FFF; // Flag wegfiltern
+ nOp1 &= 0x7FFF; // filter away the flag
rText.AppendAscii( "BYVAL " );
}
if( nOp1 < 13 )
@@ -685,3 +686,4 @@ void SbiDisas::StrmOp( String& rText )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index f6858bad55..4650d39878 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-//#include <stl_queue.h>
#include <osl/mutex.hxx>
#include <comphelper/processfactory.hxx>
@@ -108,18 +108,18 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere
Reference< XComponentContext > xContext;
Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "DefaultContext" ) ) >>= xContext );
+ OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
if ( xContext.is() )
{
Reference< provider::XScriptProviderFactory > xFactory(
xContext->getValueByName(
- ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory" ) ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ),
UNO_QUERY );
OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
if ( xFactory.is() )
{
Any aCtx;
- aCtx <<= ::rtl::OUString::createFromAscii( "user" );
+ aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
}
}
@@ -445,8 +445,6 @@ static ::rtl::OUString aTitlePropName =
void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{
- static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
-
(void)pBasic;
(void)bWrite;
@@ -505,11 +503,14 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
bool bDecoration = true;
try
{
+ ::rtl::OUString aDecorationPropName(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName );
aDecorationAny >>= bDecoration;
if( !bDecoration )
{
xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) );
+
+ ::rtl::OUString aTitlePropName(RTL_CONSTASCII_USTRINGPARAM("Title"));
xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) );
}
}
@@ -569,23 +570,23 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
aArgs[ 2 ] = aDlgLibAny;
aArgs[ 3 ] <<= xScriptListener;
// Create a "living" Dialog
- Reference< XControl > xCntrl;
- try
- {
+ Reference< XControl > xCntrl;
+ try
+ {
Reference< XDialogProvider > xDlgProv( xMSF->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.DialogProvider" ) ), aArgs ), UNO_QUERY );
- xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
- // Add dialog model to dispose vector
- Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
- pINST->getComponentVector().push_back( xDlgComponent );
- // need ThisCompoent from calling script
- }
- // preserve existing bad behaviour, it's possible... but probably
- // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
- // create dialog fails. So, in this case let's not throw, just leave basic
- // detect the unset object.
- catch( uno::Exception& )
- {
- }
+ xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
+ // Add dialog model to dispose vector
+ Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
+ pINST->getComponentVector().push_back( xDlgComponent );
+ // need ThisCompoent from calling script
+ }
+ // preserve existing bad behaviour, it's possible... but probably
+ // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
+ // create dialog fails. So, in this case let's not throw, just leave basic
+ // detect the unset object.
+ catch( uno::Exception& )
+ {
+ }
// Return dialog
Any aRetVal;
@@ -597,3 +598,4 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
//===================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index c04cfef38b..285deaba69 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -407,8 +408,6 @@ void SbiImage::MakeStrings( short nSize )
bError = TRUE;
}
-// Hinzufuegen eines Strings an den StringPool. Der String-Puffer
-// waechst dynamisch in 1K-Schritten
// Add a string to StringPool. The String buffer is dynamically
// growing in 1K-Steps
void SbiImage::AddString( const String& r )
@@ -433,7 +432,7 @@ void SbiImage::AddString( const String& r )
memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) );
delete[] pStrings;
pStrings = p;
- nStringSize = sal::static_int_cast< UINT16 >(nNewLen);
+ nStringSize = sal::static_int_cast< UINT32 >(nNewLen);
}
else
bError = TRUE;
@@ -542,3 +541,5 @@ BOOL SbiImage::ExceedsLegacyLimits()
return TRUE;
return FALSE;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 91564e74ac..1094508a86 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -391,15 +392,7 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite
// Get class names of struct
String aServiceName( RTL_CONSTASCII_USTRINGPARAM("stardiv.uno.beans.PropertySet") );
-#if 0
- // Service suchen und instanzieren
- Reference< XMultiServiceFactory > xServiceManager = getProcessServiceFactory();
- Reference< XInterface > xInterface;
- if( xProv.is() )
- xInterface = xProv->newInstance();
-#else
Reference< XInterface > xInterface = (OWeakObject*) new SbPropertyValues();
-#endif
SbxVariableRef refVar = rPar.Get(0);
if( xInterface.is() )
@@ -428,3 +421,4 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite
refVar->PutObject( NULL );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 9a744001a9..7bab981f9c 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,9 +35,7 @@
#include <tools/rcid.h>
#include <tools/config.hxx>
#include <tools/stream.hxx>
-#ifndef __RSC //autogen
#include <tools/errinf.hxx>
-#endif
#include <basic/sbx.hxx>
#include <tools/list.hxx>
#include <tools/shl.hxx>
@@ -63,7 +62,9 @@
#include <com/sun/star/script/ModuleInfo.hpp>
using namespace ::com::sun::star::script;
-// #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
+#include <com/sun/star/script/ModuleType.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+using namespace ::com::sun::star::script;
SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
@@ -123,7 +124,7 @@ struct SFX_VB_ErrorItem
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 },
@@ -1351,7 +1352,7 @@ USHORT StarBASIC::StepPoint( USHORT l, USHORT c1, USHORT c2 )
return BreakHdl();
}
-USHORT __EXPORT StarBASIC::BreakHdl()
+USHORT StarBASIC::BreakHdl()
{
return (USHORT) ( aBreakHdl.IsSet()
? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE );
@@ -1384,14 +1385,14 @@ SbLanguageMode StarBASIC::GetLanguageMode()
return eLanguageMode;
}
-// AB: 29.3.96
-// Das Mapping zwischen alten und neuen Fehlercodes erfolgt, indem die Tabelle
-// SFX_VB_ErrorTab[] durchsucht wird. Dies ist zwar nicht besonders performant,
-// verbraucht aber viel weniger Speicher als entsprechende switch-Bloecke.
-// Die Umrechnung von Fehlercodes muss nicht schnell sein, daher auch keine
-// binaere Suche bei VB-Error -> SFX-Error.
+// From 1996-03-29:
+// The mapping between the old and the new error codes take place by searching
+// through the table SFX_VB_ErrorTab[]. This is indeed not with good performance,
+// but it consumes much less memory than corresponding switch blocs.
+// Because the conversion of error codes has not to be fast. there is no
+// binaere search by VB-Error -> SFX-Error.
-// Neue Fehler-Codes auf alte, Sbx-Kompatible zurueckmappen
+// Map back new error codes to old, Sbx-compatible
USHORT StarBASIC::GetVBErrorCode( SbError nError )
{
USHORT nRet = 0;
@@ -1417,7 +1418,7 @@ USHORT StarBASIC::GetVBErrorCode( SbError nError )
}
}
- // Suchschleife
+ // search loop
const SFX_VB_ErrorItem* pErrItem;
USHORT nIndex = 0;
do
@@ -1430,7 +1431,7 @@ USHORT StarBASIC::GetVBErrorCode( SbError nError )
}
nIndex++;
}
- while( pErrItem->nErrorVB != 0xFFFF ); // bis End-Marke
+ while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
return nRet;
}
@@ -1476,15 +1477,15 @@ SbError StarBASIC::GetSfxFromVBError( USHORT nError )
break;
}
else if( pErrItem->nErrorVB > nError )
- break; // kann nicht mehr gefunden werden
+ break; // couldn't found anymore
nIndex++;
}
- while( pErrItem->nErrorVB != 0xFFFF ); // bis End-Marke
+ while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
return nRet;
}
-// Error- / Break-Daten setzen
+// set Error- / Break-data
void StarBASIC::SetErrorData
( SbError nCode, USHORT nLine, USHORT nCol1, USHORT nCol2 )
{
@@ -1496,8 +1497,8 @@ void StarBASIC::SetErrorData
}
//----------------------------------------------------------------
-// Hilfsklasse zum Zugriff auf String SubResourcen einer Resource.
-// Quelle: sfx2\source\doc\docfile.cxx (TLX)
+// help class for access to string SubResource of a Resource.
+// Source: sfx2\source\doc\docfile.cxx (TLX)
struct BasicStringList_Impl : private Resource
{
ResId aResId;
@@ -1512,7 +1513,7 @@ struct BasicStringList_Impl : private Resource
};
//----------------------------------------------------------------
-// #60175 Flag, das bei Basic-Fehlern das Anziehen der SFX-Resourcen verhindert
+// Flag, that prevent the activation of the SFX-Resources at a Basic error
static BOOL bStaticSuppressSfxResource = FALSE;
void StarBASIC::StaticSuppressSfxResource( BOOL bSuppress )
@@ -1529,7 +1530,7 @@ BOOL runsInSetup( void )
void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
if( bStaticSuppressSfxResource )
{
@@ -1539,15 +1540,15 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
USHORT nOldID = GetVBErrorCode( nId );
- // Hilfsklasse instanzieren
+ // intantiate the help class
BasResId aId( RID_BASIC_START );
BasicStringList_Impl aMyStringList( aId, USHORT(nId & ERRCODE_RES_MASK) );
if( aMyStringList.IsErrorTextAvailable() )
{
- // Merge Message mit Zusatztext
+ // merge message with additional text
String aMsg1 = aMyStringList.GetString();
- // Argument-Platzhalter durch %s ersetzen
+ // replace argument placeholder with %s
String aSrgStr( RTL_CONSTASCII_USTRINGPARAM("$(ARG1)") );
USHORT nResult = aMsg1.Search( aSrgStr );
@@ -1573,9 +1574,9 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
BOOL StarBASIC::CError
( SbError code, const String& rMsg, USHORT l, USHORT c1, USHORT c2 )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
- // Compiler-Fehler waehrend der Laufzeit -> Programm anhalten
+ // compiler error during runtime -> stop programm
if( IsRunning() )
{
// #109018 Check if running Basic is affected
@@ -1586,13 +1587,13 @@ BOOL StarBASIC::CError
Stop();
}
- // Flag setzen, damit GlobalRunInit den Fehler mitbekommt
+ // set flag, so that GlobalRunInit notice the error
GetSbData()->bGlobalInitErr = TRUE;
- // Fehlertext basteln
+ // tinker the error message
MakeErrorText( code, rMsg );
- // Umsetzung des Codes fuer String-Transport in SFX-Error
+ // Implementation of the code for the string transport to SFX-Error
if( rMsg.Len() )
code = (ULONG)*new StringErrorInfo( code, String(rMsg) );
@@ -1603,7 +1604,7 @@ BOOL StarBASIC::CError
bRet = (BOOL) GetSbData()->aErrHdl.Call( this );
else
bRet = ErrorHdl();
- GetSbData()->bCompiler = FALSE; // nur TRUE fuer Error-Handler
+ GetSbData()->bCompiler = FALSE; // only true for error handler
return bRet;
}
@@ -1615,14 +1616,14 @@ BOOL StarBASIC::RTError
BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1, USHORT c2 )
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
SbError c = code;
if( (c & ERRCODE_CLASS_MASK) == ERRCODE_CLASS_COMPILER )
c = 0;
MakeErrorText( c, rMsg );
- // Umsetzung des Codes fuer String-Transport in SFX-Error
+ // Implementation of the code for the string transport to SFX-Error
if( rMsg.Len() )
{
// very confusing, even though MakeErrorText sets up the error text
@@ -1679,7 +1680,7 @@ SbError StarBASIC::GetErrBasic()
return 0;
}
-// #66536 Zusatz-Message fuer RTL-Funktion Error zugreifbar machen
+// make the additional message for the RTL function error accessible
String StarBASIC::GetErrorMsg()
{
if( pINST )
@@ -1696,7 +1697,7 @@ USHORT StarBASIC::GetErl()
return 0;
}
-BOOL __EXPORT StarBASIC::ErrorHdl()
+BOOL StarBASIC::ErrorHdl()
{
return (BOOL) ( aErrorHdl.IsSet()
? aErrorHdl.Call( this ) : FALSE );
@@ -1772,7 +1773,7 @@ BOOL StarBASIC::LoadData( SvStream& r, USHORT nVer )
return FALSE;
else if( pMod->ISA(SbJScriptModule) )
{
- // Ref zuweisen, damit pMod deleted wird
+ // assign Ref, so that pMod will be deleted
SbModuleRef xRef = pMod;
}
else
@@ -1781,15 +1782,15 @@ BOOL StarBASIC::LoadData( SvStream& r, USHORT nVer )
pModules->Put( pMod, i );
}
}
- // HACK fuer SFX-Mist!
+ // HACK for SFX-Bullshit!
SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("FALSE") ), SbxCLASS_PROPERTY );
if( p )
Remove( p );
p = Find( String( RTL_CONSTASCII_USTRINGPARAM("TRUE") ), SbxCLASS_PROPERTY );
if( p )
Remove( p );
- // Ende des Hacks!
- // Suche ueber StarBASIC ist immer global
+ // End of the hacks!
+ // Search via StarBASIC is at all times global
DBG_ASSERT( IsSet( SBX_GBLSEARCH ), "Basic ohne GBLSEARCH geladen" );
SetFlag( SBX_GBLSEARCH );
return TRUE;
@@ -2133,3 +2134,4 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
SetError( SbERR_BAD_ARGUMENT );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx
index da156b2afd..039bdddf5f 100644
--- a/basic/source/classes/sbintern.cxx
+++ b/basic/source/classes/sbintern.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,3 +81,4 @@ SbiGlobals::~SbiGlobals()
delete pTransliterationWrapper;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c8d641c598..08646f71a1 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,10 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-//#include <stl_queue.h>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
-#ifndef _TOOLERR_HXX //autogen
#include <tools/errcode.hxx>
#endif
#include <svl/hint.hxx>
@@ -113,7 +112,7 @@ TYPEINIT1(SbUnoSingleton,SbxObject)
typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper;
-// Flag, um immer ueber Invocation zu gehen
+// Flag to go via invocation
//#define INVOCATION_ONLY
@@ -159,14 +158,13 @@ SbxVariable* getDefaultProp( SbxVariable* pRef )
pDefaultProp = pUnoObj->GetDfltProperty();
}
}
- return pDefaultProp;
}
Reference< XComponentContext > getComponentContext_Impl( void )
{
static Reference< XComponentContext > xContext;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xContext.is() )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
@@ -182,12 +180,12 @@ Reference< XComponentContext > getComponentContext_Impl( void )
return xContext;
}
-// CoreReflection statisch speichern
+// save CoreReflection statically
Reference< XIdlReflection > getCoreReflection_Impl( void )
{
static Reference< XIdlReflection > xCoreReflection;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xCoreReflection.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
@@ -208,7 +206,7 @@ Reference< XIdlReflection > getCoreReflection_Impl( void )
return xCoreReflection;
}
-// CoreReflection statisch speichern
+// save CoreReflection statically
Reference< XHierarchicalNameAccess > getCoreReflection_HierarchicalNameAccess_Impl( void )
{
static Reference< XHierarchicalNameAccess > xCoreReflection_HierarchicalNameAccess;
@@ -230,7 +228,7 @@ Reference< XHierarchicalNameAccess > getTypeProvider_Impl( void )
{
static Reference< XHierarchicalNameAccess > xAccess;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xAccess.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
@@ -257,7 +255,7 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
{
static Reference< XTypeConverter > xTypeConverter;
- // Haben wir schon CoreReflection, sonst besorgen
+ // Do we have already CoreReflection; if not obtain it
if( !xTypeConverter.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
@@ -349,7 +347,7 @@ void implAppendExceptionMsg( ::rtl::OUStringBuffer& _inout_rBuffer, const Except
}
-// Fehlermeldungs-Message bei Exception zusammenbauen
+// construct an error message for the exception
::rtl::OUString implGetExceptionMsg( const Exception& e, const ::rtl::OUString& aExceptionType_ )
{
::rtl::OUStringBuffer aMessageBuf;
@@ -396,10 +394,10 @@ Any convertAny( const Any& rVal, const Type& aDestType )
TYPEINIT1(SbUnoAnyObject,SbxObject)
-// TODO: Spaeter auslagern
+// TODO: source out later
Reference<XIdlClass> TypeToIdlClass( const Type& rType )
{
- // void als Default-Klasse eintragen
+ // register void as default class
Reference<XIdlClass> xRetClass;
typelib_TypeDescription * pTD = 0;
rType.getDescription( &pTD );
@@ -463,6 +461,32 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
SbError nError( ERRCODE_BASIC_EXCEPTION );
::rtl::OUStringBuffer aMessageBuf;
+ // Add for VBA, to get the correct error code and message.
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ if ( aExamine >>= aBasicError )
+ {
+ if ( aBasicError.ErrorCode != 0 )
+ {
+ nError = StarBASIC::GetSfxFromVBError( (USHORT) aBasicError.ErrorCode );
+ if ( nError == 0 )
+ {
+ nError = (SbError) aBasicError.ErrorCode;
+ }
+ aMessageBuf.append( aBasicError.ErrorMessageArgument );
+ aExamine.clear();
+ }
+ }
+
+ IndexOutOfBoundsException aIdxOutBndsExp;
+ if ( aExamine >>= aIdxOutBndsExp )
+ {
+ nError = SbERR_OUT_OF_RANGE;
+ aExamine.clear();
+ }
+ }
+ // End add
+
// strip any other WrappedTargetException instances, but this time preserve the error messages.
WrappedTargetException aWrapped;
sal_Int32 nLevel = 0;
@@ -564,43 +588,43 @@ SbxDataType unoToSbxType( TypeClass eType )
case TypeClass_INTERFACE:
case TypeClass_TYPE:
case TypeClass_STRUCT:
- case TypeClass_EXCEPTION: eRetType = SbxOBJECT; 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_ARRAY: break;
+ 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_ENUM: eRetType = SbxLONG; break;
case TypeClass_SEQUENCE:
eRetType = (SbxDataType) ( SbxOBJECT | SbxARRAY );
break;
/*
- case TypeClass_VOID: break;
- case TypeClass_UNKNOWN: break;
+ case TypeClass_VOID: break;
+ case TypeClass_UNKNOWN: break;
*/
- case TypeClass_ANY: eRetType = SbxVARIANT; break;
- case TypeClass_BOOLEAN: eRetType = SbxBOOL; break;
- case TypeClass_CHAR: eRetType = SbxCHAR; break;
- 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_ANY: eRetType = SbxVARIANT; break;
+ case TypeClass_BOOLEAN: eRetType = SbxBOOL; break;
+ case TypeClass_CHAR: eRetType = SbxCHAR; break;
+ 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;
+ //case TypeClass_UNSIGNED_INT: eRetType = SbxUINT; break;
+ //case TypeClass_UNSIGNED_BYTE: eRetType = SbxUSHORT; break;
default: break;
}
return eRetType;
@@ -622,7 +646,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 )
@@ -647,7 +670,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;
}
}
@@ -695,7 +717,7 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
unoToSbxValue( (SbxVariable*)xVar, aValue );
sal_Int32* pIndices = indices.getArray();
- pArray->Put32( (SbxVariable*)xVar, pIndices );
+ pArray->Put32( (SbxVariable*)xVar, pIndices );
}
}
@@ -716,12 +738,12 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
Any aClassAny;
aClassAny <<= xClass;
- // SbUnoObject instanzieren
+ // instantiate SbUnoObject
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aClassAny );
SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject;
- // #51475 Wenn das Objekt ungueltig ist null liefern
+ // If the object is invalid deliver zero
if( pSbUnoObject->getUnoAny().getValueType().getTypeClass() == TypeClass_VOID )
{
pVar->PutObject( NULL );
@@ -732,7 +754,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
}
break;
- // Interfaces und Structs muessen in ein SbUnoObject gewrappt werden
+ // Interfaces and Structs must be wrapped in a SbUnoObject
case TypeClass_INTERFACE:
case TypeClass_STRUCT:
case TypeClass_EXCEPTION:
@@ -796,13 +818,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;
}
}
@@ -810,7 +826,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
}
}
- // SbUnoObject instanzieren
+ // instantiate a SbUnoObject
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
//If this is called externally e.g. from the scripting
@@ -826,7 +842,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject;
- // #51475 Wenn das Objekt ungueltig ist null liefern
+ // If the object is invalid deliver zero
if( pSbUnoObject->getUnoAny().getValueType().getTypeClass() == TypeClass_VOID )
{
pVar->PutObject( NULL );
@@ -839,12 +855,12 @@ 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_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:
@@ -867,7 +883,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
Type aElementType( ((typelib_IndirectTypeDescription *)pTD)->pType );
::typelib_typedescription_release( pTD );
- // In Basic Array anlegen
+ // build an Array in Basic
SbxDimArrayRef xArray;
SbxDataType eSbxElementType = unoToSbxType( aElementType.getTypeClass() );
xArray = new SbxDimArray( eSbxElementType );
@@ -875,15 +891,15 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
{
xArray->unoAddDim32( 0, nLen - 1 );
- // Elemente als Variablen eintragen
+ // register the elements as variables
for( i = 0 ; i < nLen ; i++ )
{
- // Elemente wandeln
+ // convert elements
Any aElementAny = xIdlArray->get( aValue, (UINT32)i );
SbxVariableRef xVar = new SbxVariable( eSbxElementType );
unoToSbxValue( (SbxVariable*)xVar, aElementAny );
- // Ins Array braten
+ // put into the Array
xArray->Put32( (SbxVariable*)xVar, &i );
}
}
@@ -892,24 +908,24 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
xArray->unoAddDim( 0, -1 );
}
- // Array zurueckliefern
+ // return the Array
USHORT nFlags = pVar->GetFlags();
pVar->ResetFlag( SBX_FIXED );
pVar->PutObject( (SbxDimArray*)xArray );
pVar->SetFlags( nFlags );
- // #54548, Die Parameter duerfen hier nicht weggehauen werden
+ // The parameter mustn't deleted here
//pVar->SetParameters( NULL );
}
break;
/*
- case TypeClass_VOID: break;
- case TypeClass_UNKNOWN: break;
+ case TypeClass_VOID: break;
+ case TypeClass_UNKNOWN: break;
case TypeClass_ANY:
{
- // Any rausholen und konvertieren
+ // get Any and convert it
//Any* pAny = (Any*)aValue.get();
//if( pAny )
//unoToSbxValue( pVar, *pAny );
@@ -917,46 +933,46 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
break;
*/
- case TypeClass_BOOLEAN: pVar->PutBool( *(sal_Bool*)aValue.getValue() ); break;
+ case TypeClass_BOOLEAN: pVar->PutBool( *(sal_Bool*)aValue.getValue() ); break;
case TypeClass_CHAR:
{
pVar->PutChar( *(sal_Unicode*)aValue.getValue() );
break;
}
- 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_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;
+ 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;
}
}
-// Reflection fuer Sbx-Typen liefern
+// Deliver the reflection for Sbx types
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;
- case SbxSINGLE: aRetType = ::getCppuType( (float*)0 ); break;
- case SbxDOUBLE: aRetType = ::getCppuType( (double*)0 ); break;
- case SbxCURRENCY: aRetType = ::getCppuType( (oleautomation::Currency*)0 ); break;
- case SbxDECIMAL: aRetType = ::getCppuType( (oleautomation::Decimal*)0 ); break;
- case SbxDATE: {
+ //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;
+ case SbxSINGLE: aRetType = ::getCppuType( (float*)0 ); break;
+ case SbxDOUBLE: aRetType = ::getCppuType( (double*)0 ); break;
+ case SbxCURRENCY: aRetType = ::getCppuType( (oleautomation::Currency*)0 ); break;
+ case SbxDECIMAL: aRetType = ::getCppuType( (oleautomation::Decimal*)0 ); break;
+ case SbxDATE: {
SbiInstance* pInst = pINST;
if( pInst && pInst->IsCompatibility() )
aRetType = ::getCppuType( (double*)0 );
@@ -964,12 +980,12 @@ 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 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;
@@ -994,14 +1010,14 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
return aRetType;
}
-// Konvertierung von Sbx nach Uno ohne bekannte Zielklasse fuer TypeClass_ANY
+// Converting of Sbx to Uno without a know target class for TypeClass_ANY
Type getUnoTypeForSbxValue( SbxValue* pVal )
{
Type aRetType = getCppuVoidType();
if( !pVal )
return aRetType;
- // SbxType nach Uno wandeln
+ // convert SbxType to Uno
SbxDataType eBaseType = pVal->SbxValue::GetType();
if( eBaseType == SbxOBJECT )
{
@@ -1029,8 +1045,8 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
{
if( eElementTypeClass == TypeClass_VOID || eElementTypeClass == TypeClass_ANY )
{
- // Wenn alle Elemente des Arrays vom gleichen Typ sind, wird
- // der genommen, sonst wird das ganze als Any-Sequence betrachtet
+ // If all elements of the arrays are from the same type, take
+ // this one - otherwise the whole will be considered as Any-Sequence
sal_Bool bNeedsInit = sal_True;
INT32 nSize = nUpper - nLower + 1;
@@ -1054,7 +1070,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
else if( aElementType != aType )
{
- // Verschiedene Typen -> AnySequence
+ // different types -> AnySequence
aElementType = getCppuType( (Any*)0 );
break;
}
@@ -1092,7 +1108,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
}
else if( aElementType != aType )
{
- // Verschiedene Typen -> AnySequence
+ // different types -> AnySequence
aElementType = getCppuType( (Any*)0 );
break;
}
@@ -1106,7 +1122,7 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
aRetType = Type( TypeClass_SEQUENCE, aSeqTypeName );
}
}
- // Kein Array, sondern...
+ // No array, but ...
else if( xObj->ISA(SbUnoObject) )
{
aRetType = ((SbUnoObject*)(SbxBase*)xObj)->getUnoAny().getValueType();
@@ -1116,9 +1132,9 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
{
aRetType = ((SbUnoAnyObject*)(SbxBase*)xObj)->getValue().getValueType();
}
- // Sonst ist es ein Nicht-Uno-Basic-Objekt -> default==void liefern
+ // Otherwise it is a No-Uno-Basic-Object -> default==deliver void
}
- // Kein Objekt, Basistyp konvertieren
+ // No object, convert basic type
else
{
aRetType = getUnoTypeForSbxBaseType( eBaseType );
@@ -1126,10 +1142,10 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
return aRetType;
}
-// Deklaration Konvertierung von Sbx nach Uno mit bekannter Zielklasse
+// Declaration converting of Sbx to Uno with known target class
Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL );
-// Konvertierung von Sbx nach Uno ohne bekannte Zielklasse fuer TypeClass_ANY
+// converting of Sbx to Uno without known target class for TypeClass_ANY
Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType = false )
{
SbxDataType eBaseType = pVar->SbxValue::GetType();
@@ -1221,6 +1237,7 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
aType = ::getCppuType( (sal_uInt16*)0 );
break;
}
+ // TODO: need to add hyper types ?
default: break;
}
}
@@ -1275,7 +1292,7 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
try
{
- // In die Sequence uebernehmen
+ // transfer to the sequence
xArray->set( aRetVal, i, aElementVal );
}
catch( const IllegalArgumentException& )
@@ -1352,7 +1369,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
{
Reference< XIdlClass > xIdlTargetClass = TypeToIdlClass( rType );
- // Null-Referenz?
+ // zero referenz?
if( pVar->IsNull() && eType == TypeClass_INTERFACE )
{
Reference< XInterface > xRef;
@@ -1377,13 +1394,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 ) )
@@ -1403,7 +1415,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
else
{
- // #109936 NULL object -> NULL XInterface
+ // zero object -> zero XInterface
Reference<XInterface> xInt;
aRetVal <<= xInt;
}
@@ -1453,7 +1465,6 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
case TypeClass_ARRAY: break;
*/
- // Array -> Sequence
case TypeClass_ENUM:
{
aRetVal = int2enum( pVar->GetLong(), rType );
@@ -1476,7 +1487,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
{
sal_Int32 nSeqSize = nUpper - nLower + 1;
- // Instanz der geforderten Sequence erzeugen
+ // create the instanz of the required sequence
Reference< XIdlClass > xIdlTargetClass = TypeToIdlClass( rType );
xIdlTargetClass->createObject( aRetVal );
Reference< XIdlArray > xArray = xIdlTargetClass->getArray();
@@ -1490,18 +1501,18 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
Type aElemType( ((typelib_IndirectTypeDescription *)pSeqTD)->pType );
// Reference< XIdlClass > xElementClass = TypeToIdlClass( aElemType );
- // Alle Array-Member umwandeln und eintragen
+ // convert all array member and register them
sal_Int32 nIdx = nLower;
for( sal_Int32 i = 0 ; i < nSeqSize ; i++,nIdx++ )
{
SbxVariableRef xVar = pArray->Get32( &nIdx );
- // Wert von Sbx nach Uno wandeln
+ // Convert the value of Sbx to Uno
Any aAnyValue = sbxToUnoValue( (SbxVariable*)xVar, aElemType );
try
{
- // In die Sequence uebernehmen
+ // take over to the sequence
xArray->set( aRetVal, i, aAnyValue );
}
catch( const IllegalArgumentException& )
@@ -1569,11 +1580,11 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
break;
/*
- case TypeClass_VOID: break;
- case TypeClass_UNKNOWN: break;
+ case TypeClass_VOID: break;
+ case TypeClass_UNKNOWN: break;
*/
- // Bei Any die Klassen-unabhaengige Konvertierungs-Routine nutzen
+ // Use for Any the class indipendent converting routine
case TypeClass_ANY:
{
aRetVal = sbxToUnoValueImpl( pVar );
@@ -1618,23 +1629,118 @@ 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_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_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;
+ //case TypeClass_UNSIGNED_INT: break;
+ //case TypeClass_UNSIGNED_BYTE: break;
default: break;
}
return aRetVal;
}
-// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
+{
+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
+ if( bOLEAutomation )
+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
+
+ args.realloc( nParamCount );
+ Any* pAnyArgs = args.getArray();
+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
+ UINT32 i = 0;
+ if( pArgNamesArray )
+ {
+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
+ ::rtl::OUString* pNames = rNameSeq.getArray();
+ Any aValAny;
+ for( i = 0 ; i < nParamCount ; i++ )
+ {
+ USHORT iSbx = (USHORT)(i+1);
+
+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
+ bBlockConversionToSmallestType );
+
+ ::rtl::OUString aParamName = pNames[iSbx];
+ if( aParamName.getLength() )
+ {
+ oleautomation::NamedArgument aNamedArgument;
+ aNamedArgument.Name = aParamName;
+ aNamedArgument.Value = aValAny;
+ pAnyArgs[i] <<= aNamedArgument;
+ }
+ else
+ {
+ pAnyArgs[i] = aValAny;
+ }
+ }
+ }
+ else
+ {
+ for( i = 0 ; i < nParamCount ; i++ )
+ {
+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
+ bBlockConversionToSmallestType );
+ }
+ }
+
+}
+enum INVOKETYPE
+{
+ GetProp = 0,
+ SetProp,
+ Func
+};
+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
+{
+ Sequence< INT16 > OutParamIndex;
+ Sequence< Any > OutParam;
+
+ Any aRetAny;
+ switch( invokeType )
+ {
+ case Func:
+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
+ break;
+ case GetProp:
+ {
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY );
+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
+ break;
+ }
+ case SetProp:
+ {
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
+ break;
+ }
+ default:
+ break; // should introduce an error here
+
+ }
+ const INT16* pIndices = OutParamIndex.getConstArray();
+ UINT32 nLen = OutParamIndex.getLength();
+ if( nLen )
+ {
+ const Any* pNewValues = OutParam.getConstArray();
+ for( UINT32 j = 0 ; j < nLen ; j++ )
+ {
+ INT16 iTarget = pIndices[ j ];
+ if( iTarget >= (INT16)nParamCount )
+ break;
+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(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 )
{
Type aIfaceType = ::getCppuType( (const Reference< XInterface > *)0 );
@@ -1647,17 +1753,17 @@ String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference<
::rtl::OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
- // Pruefen, ob das Interface wirklich unterstuetzt wird
+ // checking if the interface is realy supported
if( !x->queryInterface( aClassType ).hasValue() )
{
aRetStr.AppendAscii( " (ERROR: Not really supported!)\n" );
}
- // Gibt es Super-Interfaces
+ // Are there super interfaces?
else
{
aRetStr.AppendAscii( "\n" );
- // Super-Interfaces holen
+ // get the super interfaces
Sequence< Reference< XIdlClass > > aSuperClassSeq = xClass->getSuperclasses();
const Reference< XIdlClass >* pClasses = aSuperClassSeq.getConstArray();
UINT32 nSuperIfaceCount = aSuperClassSeq.getLength();
@@ -1790,12 +1896,12 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
return result;
}
-// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
+// Debugging help method to readout the imlemented interfaces of an object
String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
{
Any aToInspectObj = pUnoObj->getUnoAny();
- // #54898: Nur TypeClass Interface zulasssen
+ // allow only TypeClass interface
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
String aRet;
if( eType != TypeClass_INTERFACE )
@@ -1805,10 +1911,10 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
}
else
{
- // Interface aus dem Any besorgen
+ // get the interface from the Any
const Reference< XInterface > x = *(Reference< XInterface >*)aToInspectObj.getValue();
- // XIdlClassProvider-Interface ansprechen
+ // address the XIdlClassProvider-Interface
Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY );
Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
@@ -1818,7 +1924,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
aRet.AppendAscii( "\n" );
if( xTypeProvider.is() )
{
- // Interfaces der Implementation holen
+ // get the interfaces of the implementation
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
const Type* pTypeArray = aTypeSeq.getConstArray();
UINT32 nIfaceCount = aTypeSeq.getLength();
@@ -1854,45 +1960,43 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
-// Dbg-Hilfsmethode SbxDataType -> String
+// Debugging help method SbxDataType -> String
String Dbg_SbxDataType2String( SbxDataType eType )
{
String aRet( RTL_CONSTASCII_USTRINGPARAM("Unknown Sbx-Type!") );
switch( +eType )
{
- case SbxEMPTY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxEMPTY") ); break;
- case SbxNULL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxNULL") ); break;
- case SbxINTEGER: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINTEGER") ); break;
- case SbxLONG: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLONG") ); break;
- case SbxSINGLE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxSINGLE") ); break;
- case SbxDOUBLE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDOUBLE") ); break;
- case SbxCURRENCY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCURRENCY") ); break;
- case SbxDECIMAL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDECIMAL") ); break;
- case SbxDATE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDATE") ); break;
- case SbxSTRING: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxSTRING") ); break;
- case SbxOBJECT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxOBJECT") ); break;
- case SbxERROR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxERROR") ); break;
- case SbxBOOL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxBOOL") ); break;
- case SbxVARIANT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxVARIANT") ); break;
+ case SbxEMPTY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxEMPTY") ); break;
+ case SbxNULL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxNULL") ); break;
+ case SbxINTEGER: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINTEGER") ); break;
+ case SbxLONG: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLONG") ); break;
+ case SbxSINGLE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxSINGLE") ); break;
+ case SbxDOUBLE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDOUBLE") ); break;
+ case SbxCURRENCY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCURRENCY") ); break;
+ case SbxDECIMAL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDECIMAL") ); break;
+ case SbxDATE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDATE") ); break;
+ case SbxSTRING: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxSTRING") ); break;
+ case SbxOBJECT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxOBJECT") ); break;
+ case SbxERROR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxERROR") ); break;
+ case SbxBOOL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxBOOL") ); break;
+ case SbxVARIANT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxVARIANT") ); break;
case SbxDATAOBJECT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDATAOBJECT") ); break;
- case SbxCHAR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCHAR") ); break;
- 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;
- case SbxUINT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUINT") ); break;
- case SbxVOID: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxVOID") ); break;
- case SbxHRESULT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxHRESULT") ); break;
- case SbxPOINTER: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxPOINTER") ); break;
- case SbxDIMARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDIMARRAY") ); break;
- case SbxCARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCARRAY") ); break;
- case SbxUSERDEF: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUSERDEF") ); break;
- case SbxLPSTR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLPSTR") ); break;
- case SbxLPWSTR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLPWSTR") ); break;
+ case SbxCHAR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCHAR") ); break;
+ 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 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;
+ case SbxUINT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUINT") ); break;
+ case SbxVOID: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxVOID") ); break;
+ case SbxHRESULT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxHRESULT") ); break;
+ case SbxPOINTER: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxPOINTER") ); break;
+ case SbxDIMARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDIMARRAY") ); break;
+ case SbxCARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCARRAY") ); break;
+ case SbxUSERDEF: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUSERDEF") ); break;
+ case SbxLPSTR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLPSTR") ); break;
+ case SbxLPWSTR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLPWSTR") ); break;
case SbxCoreSTRING: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCoreSTRING" ) ); break;
case SbxOBJECT | SbxARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxARRAY") ); break;
default: break;
@@ -1900,14 +2004,14 @@ String Dbg_SbxDataType2String( SbxDataType eType )
return aRet;
}
-// Dbg-Hilfsmethode zum Anzeigen der Properties eines SbUnoObjects
+// Debugging help method to display the properties of a SbUnoObjects
String Impl_DumpProperties( SbUnoObject* pUnoObj )
{
String aRet( RTL_CONSTASCII_USTRINGPARAM("Properties of object ") );
String aObjName = getDbgObjectName( pUnoObj );
aRet += aObjName;
- // Uno-Infos auswerten, um Arrays zu erkennen
+ // analyse the Uno-Infos to recognise the arrays
Reference< XIntrospectionAccess > xAccess = pUnoObj->getIntrospectionAccess();
if( !xAccess.is() )
{
@@ -1937,8 +2041,8 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
if( (i % nPropsPerLine) == 0 )
aPropStr.AppendAscii( "\n" );
- // Typ und Namen ausgeben
- // Ist es in Uno eine Sequence?
+ // output the type and name
+ // Is it in Uno a sequence?
SbxDataType eType = pVar->GetFullType();
BOOL bMaybeVoid = FALSE;
@@ -1946,8 +2050,8 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
{
const Property& rProp = pUnoProps[ i ];
- // #63133: Bei MAYBEVOID Typ aus Uno neu konvertieren,
- // damit nicht immer nur SbxEMPTY ausgegben wird.
+ // By MAYBEVOID convert the type out of Uno newly,
+ // so that not only SbxEMPTY were outputed.
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
{
eType = unoToSbxType( rProp.Type.getTypeClass() );
@@ -1977,14 +2081,14 @@ String Impl_DumpProperties( SbUnoObject* pUnoObj )
return aRet;
}
-// Dbg-Hilfsmethode zum Anzeigen der Methoden eines SbUnoObjects
+// Debugging help method to display the methods of an SbUnoObjects
String Impl_DumpMethods( SbUnoObject* pUnoObj )
{
String aRet( RTL_CONSTASCII_USTRINGPARAM("Methods of object ") );
String aObjName = getDbgObjectName( pUnoObj );
aRet += aObjName;
- // XIntrospectionAccess, um die Typen der Parameter auch ausgeben zu koennen
+ // XIntrospectionAccess, so that the types of the parameter could be outputed
Reference< XIntrospectionAccess > xAccess = pUnoObj->getIntrospectionAccess();
if( !xAccess.is() )
{
@@ -2018,10 +2122,10 @@ String Impl_DumpMethods( SbUnoObject* pUnoObj )
if( (i % nPropsPerLine) == 0 )
aPropStr.AppendAscii( "\n" );
- // Methode ansprechen
+ // address the method
const Reference< XIdlMethod >& rxMethod = pUnoMethods[i];
- // Ist es in Uno eine Sequence?
+ // Is it in Uno a sequence?
SbxDataType eType = pVar->GetFullType();
if( eType == SbxOBJECT )
{
@@ -2029,13 +2133,13 @@ String Impl_DumpMethods( SbUnoObject* pUnoObj )
if( xClass.is() && xClass->getTypeClass() == TypeClass_SEQUENCE )
eType = (SbxDataType) ( SbxOBJECT | SbxARRAY );
}
- // Name und Typ ausgeben
+ // output the name and the type
aPropStr += Dbg_SbxDataType2String( eType );
aPropStr.AppendAscii( " " );
aPropStr += pVar->GetName();
aPropStr.AppendAscii( " ( " );
- // get-Methode darf keinen Parameter haben
+ // the get-method mustn't have a parameter
Sequence< Reference< XIdlClass > > aParamsSeq = rxMethod->getParameterTypes();
UINT32 nParamCount = aParamsSeq.getLength();
const Reference< XIdlClass >* pParams = aParamsSeq.getConstArray();
@@ -2092,24 +2196,24 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
INT32 nId = pProp->nId;
if( nId < 0 )
{
- // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen
- if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES"
+ // Id == -1: Display implemented interfaces according the ClassProvider
+ if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES"
{
String aRetStr = Impl_GetSupportedInterfaces( this );
pVar->PutString( aRetStr );
}
- // Id == -2: Properties ausgeben
- else if( nId == -2 ) // Property ID_DBG_PROPERTIES
+ // Id == -2: output properties
+ else if( nId == -2 ) // Property ID_DBG_PROPERTIES
{
- // Jetzt muessen alle Properties angelegt werden
+ // by now all properties must be established
implCreateAll();
String aRetStr = Impl_DumpProperties( this );
pVar->PutString( aRetStr );
}
- // Id == -3: Methoden ausgeben
- else if( nId == -3 ) // Property ID_DBG_METHODS
+ // Id == -3: output the methods
+ else if( nId == -3 ) // Property ID_DBG_METHODS
{
- // Jetzt muessen alle Properties angelegt werden
+ // y now all properties must be established
implCreateAll();
String aRetStr = Impl_DumpMethods( this );
pVar->PutString( aRetStr );
@@ -2121,14 +2225,14 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
try
{
- // Wert holen
+ // get the value
Reference< XPropertySet > xPropSet( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY );
Any aRetAny = xPropSet->getPropertyValue( pProp->GetName() );
- // Die Nutzung von getPropertyValue (statt ueber den Index zu gehen) ist
- // nicht optimal, aber die Umstellung auf XInvocation steht ja ohnehin an
- // Ansonsten kann auch FastPropertySet genutzt werden
+ // The use of getPropertyValue (instead of using the index) is
+ // suboptimal, but the refactoring to XInvocation is already pending
+ // Otherwise it is posible to use FastPropertySet
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
}
catch( const Exception& )
@@ -2140,11 +2244,24 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
try
{
- // Wert holen
- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
-
- // Wert von Uno nach Sbx uebernehmen
+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
+ Any aRetAny;
+ if ( bCanBeConsideredAMethod && nParamCount )
+ {
+ // Automation properties have methods, so.. we need to invoke this through
+ // XInvocation
+ Sequence<Any> args;
+ processAutomationParams( pParams, args, true, nParamCount );
+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
+ }
+ else
+ aRetAny = mxInvocation->getValue( pProp->GetName() );
+ // take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
+ if( pParams && bCanBeConsideredAMethod )
+ pVar->SetParameters( NULL );
+
}
catch( const Exception& )
{
@@ -2162,16 +2279,16 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
return;
}
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
Any aAnyValue = sbxToUnoValue( pVar, pProp->aUnoProp.Type, &pProp->aUnoProp );
try
{
- // Wert setzen
+ // set the value
Reference< XPropertySet > xPropSet( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY );
xPropSet->setPropertyValue( pProp->GetName(), aAnyValue );
- // Die Nutzung von getPropertyValue (statt ueber den Index zu gehen) ist
- // nicht optimal, aber die Umstellung auf XInvocation steht ja ohnehin an
- // Ansonsten kann auch FastPropertySet genutzt werden
+ // The use of getPropertyValue (instead of using the index) is
+ // suboptimal, but the refactoring to XInvocation is already pending
+ // Otherwise it is posible to use FastPropertySet
}
catch( const Exception& )
{
@@ -2180,11 +2297,11 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
else if( bInvocation && mxInvocation.is() )
{
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
Any aAnyValue = sbxToUnoValueImpl( pVar );
try
{
- // Wert setzen
+ // set the value
mxInvocation->setValue( pProp->GetName(), aAnyValue );
}
catch( const Exception& )
@@ -2199,7 +2316,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
bool bInvocation = pMeth->isInvocationBased();
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
- // Anzahl Parameter -1 wegen Param0 == this
+ // number of Parameter -1 because of Param0 == this
UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
Sequence<Any> args;
BOOL bOutParams = FALSE;
@@ -2207,13 +2324,13 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( !bInvocation && mxUnoAccess.is() )
{
- // Infos holen
+ // get info
const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos();
const ParamInfo* pParamInfos = rInfoSeq.getConstArray();
UINT32 nUnoParamCount = rInfoSeq.getLength();
UINT32 nAllocParamCount = nParamCount;
- // Ueberschuessige Parameter ignorieren, Alternative: Error schmeissen
+ // ignore surplus parameter; alternative: throw an error
if( nParamCount > nUnoParamCount )
{
nParamCount = nUnoParamCount;
@@ -2253,10 +2370,10 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
com::sun::star::uno::Type aType( rxClass->getTypeClass(), rxClass->getName() );
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
+ // ATTENTION: Don't forget for Sbx-Parameter the offset!
pAnyArgs[i] = sbxToUnoValue( pParams->Get( (USHORT)(i+1) ), aType );
- // Wenn es nicht schon feststeht pruefen, ob Out-Parameter vorliegen
+ // If it is not certain check whether the out-parameter are available.
if( !bOutParams )
{
ParamMode aParamMode = rInfo.aMode;
@@ -2269,55 +2386,10 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
else if( bInvocation && pParams && mxInvocation.is() )
{
bool bOLEAutomation = true;
- // TODO: bOLEAutomation = xOLEAutomation.is()
-
- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
- if( bOLEAutomation )
- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-
- args.realloc( nParamCount );
- Any* pAnyArgs = args.getArray();
- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
- if( pArgNamesArray )
- {
- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
- ::rtl::OUString* pNames = rNameSeq.getArray();
-
- Any aValAny;
- for( i = 0 ; i < nParamCount ; i++ )
- {
- USHORT iSbx = (USHORT)(i+1);
-
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
- bBlockConversionToSmallestType );
-
- ::rtl::OUString aParamName = pNames[iSbx];
- if( aParamName.getLength() )
- {
- oleautomation::NamedArgument aNamedArgument;
- aNamedArgument.Name = aParamName;
- aNamedArgument.Value = aValAny;
- pAnyArgs[i] <<= aNamedArgument;
- }
- else
- {
- pAnyArgs[i] = aValAny;
- }
- }
- }
- else
- {
- for( i = 0 ; i < nParamCount ; i++ )
- {
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
- bBlockConversionToSmallestType );
- }
- }
+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
}
- // Methode callen
+ // call the method
GetSbData()->bBlockCompilerError = TRUE; // #106433 Block compiler errors for API calls
try
{
@@ -2325,15 +2397,15 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
Any aRetAny = pMeth->m_xUnoMethod->invoke( getUnoAny(), args );
- // Wert von Uno nach Sbx uebernehmen
+ // take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
- // Muessen wir Out-Parameter zurueckkopieren?
+ // Did we to copy back the Out-Parameter?
if( bOutParams )
{
const Any* pAnyArgs = args.getConstArray();
- // Infos holen
+ // get info
const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos();
const ParamInfo* pParamInfos = rInfoSeq.getConstArray();
@@ -2381,8 +2453,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
unoToSbxValue( pVar, aRetAny );
}
- // #55460, Parameter hier weghauen, da das in unoToSbxValue()
- // bei Arrays wegen #54548 nicht mehr gemacht wird
+ // remove parameter here, because this was not done anymore in unoToSbxValue()
+ // for arrays
if( pParams )
pVar->SetParameters( NULL );
}
@@ -2400,7 +2472,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
#ifdef INVOCATION_ONLY
-// Aus USR
+// From USR
Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
#endif
@@ -2411,16 +2483,16 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
{
static Reference< XIntrospection > xIntrospection;
- // Default-Properties von Sbx wieder rauspruegeln
+ // beat out again the default properties of Sbx
Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE );
Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Parent") ), SbxCLASS_DONTCARE );
- // Typ des Objekts pruefen
+ // check the type of the ojekts
TypeClass eType = aUnoObj_.getValueType().getTypeClass();
Reference< XInterface > x;
if( eType == TypeClass_INTERFACE )
{
- // Interface aus dem Any besorgen
+ // get the interface from the Any
x = *(Reference< XInterface >*)aUnoObj_.getValue();
if( !x.is() )
return;
@@ -2428,10 +2500,10 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
Reference< XTypeProvider > xTypeProvider;
#ifdef INVOCATION_ONLY
- // Invocation besorgen
+ // get the invocation
mxInvocation = createDynamicInvocationFor( aUnoObj_ );
#else
- // Hat das Object selbst eine Invocation?
+ // Did the object have an invocation itself?
mxInvocation = Reference< XInvocation >( x, UNO_QUERY );
xTypeProvider = Reference< XTypeProvider >( x, UNO_QUERY );
@@ -2444,10 +2516,10 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
// the invocation service!!!
// mxMaterialHolder = Reference< XMaterialHolder >::query( mxInvocation );
- // ExactName holen
+ // get the ExactName
mxExactNameInvocation = Reference< XExactName >::query( mxInvocation );
- // Rest bezieht sich nur auf Introspection
+ // The remainder refers only to the introspection
if( !xTypeProvider.is() )
{
bNeedIntrospection = FALSE;
@@ -2464,18 +2536,18 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
maTmpUnoObj = aUnoObj_;
- //*** Namen bestimmen ***
+ //*** Define the name ***
BOOL bFatalError = TRUE;
- // Ist es ein Interface oder eine struct?
+ // Is it an interface or a struct?
BOOL bSetClassName = FALSE;
String aClassName_;
if( eType == TypeClass_STRUCT || eType == TypeClass_EXCEPTION )
{
- // Struct ist Ok
+ // Struct is Ok
bFatalError = FALSE;
- // #67173 Echten Klassen-Namen eintragen
+ // insert the real name of the class
if( aName_.Len() == 0 )
{
aClassName_ = String( aUnoObj_.getValueType().getTypeName() );
@@ -2484,14 +2556,14 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
}
else if( eType == TypeClass_INTERFACE )
{
- // #70197 Interface geht immer durch Typ im Any
+ // Interface works always through the type in the Any
bFatalError = FALSE;
- // Nach XIdlClassProvider-Interface fragen
+ // Ask for the XIdlClassProvider-Interface
Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY );
if( xClassProvider.is() )
{
- // #67173 Echten Klassen-Namen eintragen
+ // Insert the real name of the class
if( aName_.Len() == 0 )
{
Sequence< Reference< XIdlClass > > szClasses = xClassProvider->getIdlClasses();
@@ -2511,14 +2583,14 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
if( bSetClassName )
SetClassName( aClassName_ );
- // Weder Interface noch Struct -> FatalError
+ // Neither interface nor Struct -> FatalError
if( bFatalError )
{
StarBASIC::FatalError( ERRCODE_BASIC_EXCEPTION );
return;
}
- // #67781 Introspection erst on demand durchfuehren
+ // pass the introspection primal on demand
}
SbUnoObject::~SbUnoObject()
@@ -2526,7 +2598,7 @@ SbUnoObject::~SbUnoObject()
}
-// #76470 Introspection on Demand durchfuehren
+// pass the introspection on Demand
void SbUnoObject::doIntrospection( void )
{
static Reference< XIntrospection > xIntrospection;
@@ -2537,11 +2609,11 @@ void SbUnoObject::doIntrospection( void )
if( !xIntrospection.is() )
{
- // Introspection-Service holen
+ // get the introspection service
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 );
@@ -2553,7 +2625,7 @@ void SbUnoObject::doIntrospection( void )
return;
}
- // Introspection durchfuehren
+ // pass the introspection
try
{
mxUnoAccess = xIntrospection->inspect( maTmpUnoObj );
@@ -2565,21 +2637,21 @@ void SbUnoObject::doIntrospection( void )
if( !mxUnoAccess.is() )
{
- // #51475 Ungueltiges Objekt kennzeichnen (kein mxMaterialHolder)
+ // #51475 mark an invalid objekt kennzeichnen (no mxMaterialHolder)
return;
}
- // MaterialHolder vom Access holen
+ // get MaterialHolder from access
mxMaterialHolder = Reference< XMaterialHolder >::query( mxUnoAccess );
- // ExactName vom Access holen
+ // get ExactName from access
mxExactName = Reference< XExactName >::query( mxUnoAccess );
}
-// #67781 Start einer Liste aller SbUnoMethod-Instanzen
+// Start of a list of all SbUnoMethod-Instances
static SbUnoMethod* pFirst = NULL;
void clearUnoMethodsForBasic( StarBASIC* pBasic )
@@ -2649,7 +2721,7 @@ SbUnoMethod::SbUnoMethod
m_xUnoMethod = xUnoMethod_;
pParamInfoSeq = NULL;
- // #67781 Methode in Liste eintragen
+ // enregister the method in a list
pNext = pFirst;
pPrev = NULL;
pFirst = this;
@@ -2720,7 +2792,7 @@ SbUnoProperty::SbUnoProperty
, nId( nId_ )
, mbInvocation( bInvocation )
{
- // #54548, bei bedarf Dummy-Array einsetzen, damit SbiRuntime::CheckArray() geht
+ // as needed establish an dummy array so that SbiRuntime::CheckArray() works
static SbxArrayRef xDummyArray = new SbxArray( SbxVARIANT );
if( eSbxType & SbxARRAY )
PutObject( xDummyArray );
@@ -2740,8 +2812,8 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
if( bNeedIntrospection )
doIntrospection();
- // Neu 4.3.1999: Properties on Demand anlegen, daher jetzt perIntrospectionAccess
- // suchen, ob doch eine Property oder Methode des geforderten Namens existiert
+ // New 1999-03-04: Create properties on demand. Therefore search now perIntrospectionAccess,
+ // if a property or a method of the required name exist
if( !pRes )
{
::rtl::OUString aUName( rName );
@@ -2758,14 +2830,14 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
const Property& rProp = mxUnoAccess->
getProperty( aUName, PropertyConcept::ALL - PropertyConcept::DANGEROUS );
- // #58455 Wenn die Property void sein kann, muss als Typ Variant gesetzt werden
+ // If the property could be void the type had to be set to Variant
SbxDataType eSbxType;
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
eSbxType = SbxVARIANT;
else
eSbxType = unoToSbxType( rProp.Type.getTypeClass() );
- // Property anlegen und reinbraten
+ // create the property and superimpose it
SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, 0, false );
QuickInsert( (SbxVariable*)xVarRef );
pRes = xVarRef;
@@ -2773,18 +2845,18 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
else if( mxUnoAccess->hasMethod( aUName,
MethodConcept::ALL - MethodConcept::DANGEROUS ) )
{
- // Methode ansprechen
+ // address the method
const Reference< XIdlMethod >& rxMethod = mxUnoAccess->
getMethod( aUName, MethodConcept::ALL - MethodConcept::DANGEROUS );
- // SbUnoMethode anlegen und reinbraten
+ // create SbUnoMethod and superimpose it
SbxVariableRef xMethRef = new SbUnoMethod( rxMethod->getName(),
unoToSbxType( rxMethod->getReturnType() ), rxMethod, false );
QuickInsert( (SbxVariable*)xMethRef );
pRes = xMethRef;
}
- // Wenn immer noch nichts gefunden wurde, muss geprueft werden, ob NameAccess vorliegt
+ // Elsewise nothing would be found it had to be checked, if NameAccess is existent
if( !pRes )
{
try
@@ -2796,13 +2868,13 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
{
Any aAny = xNameAccess->getByName( aUName2 );
- // ACHTUNG: Die hier erzeugte Variable darf wegen bei XNameAccess
+ // ATTENTION: Die hier erzeugte Variable darf wegen bei XNameAccess
// nicht als feste Property in das Object aufgenommen werden und
// wird daher nirgendwo gehalten.
- // Wenn das Probleme gibt, muss das kuenstlich gemacht werden oder
- // es muss eine Klasse SbUnoNameAccessProperty geschaffen werden,
- // bei der die Existenz staendig neu ueberprueft und die ggf. weg-
- // geworfen wird, wenn der Name nicht mehr gefunden wird.
+ // If this leads to problems, it has to be created synthetically or
+ // a class SbUnoNameAccessProperty, whose existence had to be checked
+ // constantly and which were if necessary thrown away
+ // if the name was not found anymore.
pRes = new SbxVariable( SbxVARIANT );
unoToSbxValue( pRes, aAny );
}
@@ -2813,7 +2885,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
catch( const Exception& )
{
- // Anlegen, damit der Exception-Fehler nicht ueberschrieben wird
+ // Establish so that the exeption error will not be overwriten
if( !pRes )
pRes = new SbxVariable( SbxVARIANT );
@@ -2834,14 +2906,14 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
{
if( mxInvocation->hasProperty( aUName ) )
{
- // Property anlegen und reinbraten
+ // create a property and superimpose it
SbxVariableRef xVarRef = new SbUnoProperty( aUName, SbxVARIANT, aDummyProp, 0, true );
QuickInsert( (SbxVariable*)xVarRef );
pRes = xVarRef;
}
else if( mxInvocation->hasMethod( aUName ) )
{
- // SbUnoMethode anlegen und reinbraten
+ // create SbUnoMethode and superimpose it
SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod, true );
QuickInsert( (SbxVariable*)xMethRef );
pRes = xMethRef;
@@ -2860,7 +2932,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
catch( RuntimeException& e )
{
- // Anlegen, damit der Exception-Fehler nicht ueberschrieben wird
+ // Establish so that the exeption error will not be overwriten
if( !pRes )
pRes = new SbxVariable( SbxVARIANT );
@@ -2869,7 +2941,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
}
- // Ganz am Schluss noch pruefen, ob die Dbg_-Properties gemeint sind
+ // At the very end checking if the Dbg_-Properties are meant
if( !pRes )
{
@@ -2877,10 +2949,10 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
rName.EqualsIgnoreCaseAscii( ID_DBG_PROPERTIES ) ||
rName.EqualsIgnoreCaseAscii( ID_DBG_METHODS ) )
{
- // Anlegen
+ // Create
implCreateDbgProperties();
- // Jetzt muessen sie regulaer gefunden werden
+ // Now they have to be found regular
pRes = SbxObject::Find( rName, SbxCLASS_DONTCARE );
}
}
@@ -2888,7 +2960,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
}
-// Hilfs-Methode zum Anlegen der dbg_-Properties
+// help method to create the dbg_-Properties
void SbUnoObject::implCreateDbgProperties( void )
{
Property aProp;
@@ -2908,13 +2980,13 @@ void SbUnoObject::implCreateDbgProperties( void )
void SbUnoObject::implCreateAll( void )
{
- // Bestehende Methoden und Properties alle wieder wegwerfen
+ // throw away all existing methods and properties
pMethods = new SbxArray;
pProps = new SbxArray;
if( bNeedIntrospection ) doIntrospection();
- // Instrospection besorgen
+ // get instrospection
Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
if( !xAccess.is() || bNativeCOMObject )
{
@@ -2926,7 +2998,7 @@ void SbUnoObject::implCreateAll( void )
if( !xAccess.is() )
return;
- // Properties anlegen
+ // Establish properties
Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS );
UINT32 nPropCount = props.getLength();
const Property* pProps_ = props.getConstArray();
@@ -2936,32 +3008,32 @@ void SbUnoObject::implCreateAll( void )
{
const Property& rProp = pProps_[ i ];
- // #58455 Wenn die Property void sein kann, muss als Typ Variant gesetzt werden
+ // If the property could be void the type had to be set to Variant
SbxDataType eSbxType;
if( rProp.Attributes & PropertyAttribute::MAYBEVOID )
eSbxType = SbxVARIANT;
else
eSbxType = unoToSbxType( rProp.Type.getTypeClass() );
- // Property anlegen und reinbraten
+ // Create property and superimpose it
SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, i, false );
QuickInsert( (SbxVariable*)xVarRef );
}
- // Dbg_-Properties anlegen
+ // Create Dbg_-Properties
implCreateDbgProperties();
- // Methoden anlegen
+ // Create methods
Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods
( MethodConcept::ALL - MethodConcept::DANGEROUS );
UINT32 nMethCount = aMethodSeq.getLength();
const Reference< XIdlMethod >* pMethods_ = aMethodSeq.getConstArray();
for( i = 0 ; i < nMethCount ; i++ )
{
- // Methode ansprechen
+ // address method
const Reference< XIdlMethod >& rxMethod = pMethods_[i];
- // SbUnoMethode anlegen und reinbraten
+ // Create SbUnoMethod and superimpose it
SbxVariableRef xMethRef = new SbUnoMethod
( rxMethod->getName(), unoToSbxType( rxMethod->getReturnType() ), rxMethod, false );
QuickInsert( (SbxVariable*)xMethRef );
@@ -2969,7 +3041,7 @@ void SbUnoObject::implCreateAll( void )
}
-// Wert rausgeben
+// output the value
Any SbUnoObject::getUnoAny( void )
{
Any aRetAny;
@@ -2981,15 +3053,15 @@ Any SbUnoObject::getUnoAny( void )
return aRetAny;
}
-// Hilfsmethode zum Anlegen einer Uno-Struct per CoreReflection
+// help method to create an Uno-Struct per CoreReflection
SbUnoObject* Impl_CreateUnoStruct( const String& aClassName )
{
- // CoreReflection holen
+ // get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
return NULL;
- // Klasse suchen
+ // search for the class
Reference< XIdlClass > xClass;
Reference< XHierarchicalNameAccess > xHarryName =
getCoreReflection_HierarchicalNameAccess_Impl();
@@ -2998,25 +3070,25 @@ SbUnoObject* Impl_CreateUnoStruct( const String& aClassName )
if( !xClass.is() )
return NULL;
- // Ist es ueberhaupt ein struct?
+ // Is it realy a struct?
TypeClass eType = xClass->getTypeClass();
if ( ( eType != TypeClass_STRUCT ) && ( eType != TypeClass_EXCEPTION ) )
return NULL;
- // Instanz erzeugen
+ // create an instance
Any aNewAny;
xClass->createObject( aNewAny );
- // SbUnoObject daraus basteln
+ // make a SbUnoObject out of it
SbUnoObject* pUnoObj = new SbUnoObject( aClassName, aNewAny );
return pUnoObj;
}
-// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW
+// Factory-Class to create Uno-Structs per DIM AS NEW
SbxBase* SbUnoFactory::Create( UINT16, UINT32 )
{
- // Ueber SbxId laeuft in Uno nix
+ // Via SbxId nothing works in Uno
return NULL;
}
@@ -3026,8 +3098,8 @@ SbxObject* SbUnoFactory::CreateObject( const String& rClassName )
}
-// Provisorische Schnittstelle fuer UNO-Anbindung
-// Liefert ein SbxObject, das ein Uno-Interface wrappt
+// Provisional interface for the UNO-Connection
+// Deliver a SbxObject, that wrap an Uno-Interface
SbxObjectRef GetSbUnoObject( const String& aName, const Any& aUnoObj_ )
{
return new SbUnoObject( aName, aUnoObj_ );
@@ -3052,22 +3124,22 @@ void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 1 Parameter
+ // We need 1 parameter minimum
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aClassName = rPar.Get(1)->GetString();
- // Versuchen, gleichnamige Struct zu erzeugen
+ // try to create Struct with the same name
SbUnoObjectRef xUnoObj = Impl_CreateUnoStruct( aClassName );
if( !xUnoObj )
return;
- // Objekt zurueckliefern
+ // return the objekt
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
@@ -3077,17 +3149,17 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 1 Parameter
+ // We need 1 Parameter minimum
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aServiceName = rPar.Get(1)->GetString();
- // Service suchen und instanzieren
+ // search for the service and instatiate it
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
Reference< XInterface > xInterface;
if ( xFactory.is() )
@@ -3108,11 +3180,11 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
Any aAny;
aAny <<= xInterface;
- // SbUnoObject daraus basteln und zurueckliefern
+ // Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny );
if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID )
{
- // Objekt zurueckliefern
+ // return the object
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
else
@@ -3130,22 +3202,22 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
{
(void)pBasic;
(void)bWrite;
-
- // Wir brauchen mindestens 2 Parameter
+
+ // We need 2 parameter minimum
if ( rPar.Count() < 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aServiceName = rPar.Get(1)->GetString();
Any aArgAsAny = sbxToUnoValue( rPar.Get(2),
getCppuType( (Sequence<Any>*)0 ) );
Sequence< Any > aArgs;
aArgAsAny >>= aArgs;
- // Service suchen und instanzieren
+ // search for the service and instatiate it
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
Reference< XInterface > xInterface;
if ( xFactory.is() )
@@ -3166,11 +3238,11 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
Any aAny;
aAny <<= xInterface;
- // SbUnoObject daraus basteln und zurueckliefern
+ // Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny );
if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID )
{
- // Objekt zurueckliefern
+ // return the object
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
else
@@ -3191,14 +3263,14 @@ void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL
SbxVariableRef refVar = rPar.Get(0);
- // Globalen Service-Manager holen
+ // get the global service manager
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
if( xFactory.is() )
{
Any aAny;
aAny <<= xFactory;
- // SbUnoObject daraus basteln und zurueckliefern
+ // Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( String( RTL_CONSTASCII_USTRINGPARAM("ProcessServiceManager") ), aAny );
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
@@ -3213,7 +3285,7 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 2 Parameter
+ // We need 2 parameter minimum
USHORT nParCount = rPar.Count();
if( nParCount < 3 )
{
@@ -3221,11 +3293,11 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
return;
}
- // Variable fuer Rueckgabewert
+ // variable for the return value
SbxVariableRef refVar = rPar.Get(0);
refVar->PutBool( FALSE );
- // Uno-Objekt holen
+ // get the Uno-Object
SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject();
if( !(pObj && pObj->ISA(SbUnoObject)) )
return;
@@ -3234,32 +3306,32 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
if( eType != TypeClass_INTERFACE )
return;
- // Interface aus dem Any besorgen
+ // get the interface out of the Any
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
- // CoreReflection holen
+ // get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
return;
for( USHORT i = 2 ; i < nParCount ; i++ )
{
- // Interface-Name der struct holen
+ // get the name of the interface of the struct
String aIfaceName = rPar.Get( i )->GetString();
- // Klasse suchen
+ // search for the class
Reference< XIdlClass > xClass = xCoreReflection->forName( aIfaceName );
if( !xClass.is() )
return;
- // Pruefen, ob das Interface unterstuetzt wird
+ // check if the interface will be supported
::rtl::OUString aClassName = xClass->getName();
Type aClassType( xClass->getTypeClass(), aClassName.getStr() );
if( !x->queryInterface( aClassType ).hasValue() )
return;
}
- // Alles hat geklappt, dann TRUE liefern
+ // Every thing works; then return TRUE
refVar->PutBool( TRUE );
}
@@ -3268,18 +3340,18 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
(void)pBasic;
(void)bWrite;
- // Wir brauchen mindestens 1 Parameter
+ // We need 1 parameter minimum
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Variable fuer Rueckgabewert
+ // variable for the return value
SbxVariableRef refVar = rPar.Get(0);
refVar->PutBool( FALSE );
- // Uno-Objekt holen
+ // get the Uno-Object
SbxVariableRef xParam = rPar.Get( 1 );
if( !xParam->IsObject() )
return;
@@ -3304,11 +3376,11 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
return;
}
- // Variable fuer Rueckgabewert
+ // variable for the return value
SbxVariableRef refVar = rPar.Get(0);
refVar->PutBool( FALSE );
- // Uno-Objekte holen
+ // get the Uno-Objects
SbxVariableRef xParam1 = rPar.Get( 1 );
if( !xParam1->IsObject() )
return;
@@ -3370,11 +3442,16 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-SbxVariable* getVBAConstant( const String& rName )
+VBAConstantHelper&
+VBAConstantHelper::instance()
+{
+ static VBAConstantHelper aHelper;
+ return aHelper;
+}
+
+void
+VBAConstantHelper::init()
{
- SbxVariable* pConst = NULL;
- static VBAConstantsHash aConstCache;
- static bool isInited = false;
if ( !isInited )
{
Sequence< TypeClass > types(1);
@@ -3382,44 +3459,82 @@ SbxVariable* getVBAConstant( const String& rName )
Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE );
if ( !xEnum.is() )
- return NULL;
+ return; //NULL;
while ( xEnum->hasMoreElements() )
{
Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
if ( xConstants.is() )
{
+ // store constant group name
+ ::rtl::OUString sFullName = xConstants->getName();
+ sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
+ ::rtl::OUString sLeafName( sFullName );
+ if ( indexLastDot > -1 )
+ sLeafName = sFullName.copy( indexLastDot + 1);
+ aConstCache.push_back( sLeafName ); // assume constant group names are unique
Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
sal_Int32 nLen = aConsts.getLength();
for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
{
+ // store constant member name
Reference< XConstantTypeDescription >& rXConst =
*pSrc;
- ::rtl::OUString sFullName = rXConst->getName();
- sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
- ::rtl::OUString sLeafName;
+ sFullName = rXConst->getName();
+ indexLastDot = sFullName.lastIndexOf('.');
+ sLeafName = sFullName;
if ( indexLastDot > -1 )
sLeafName = sFullName.copy( indexLastDot + 1);
- aConstCache[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
+ aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
}
}
}
isInited = true;
}
+}
+
+bool
+VBAConstantHelper::isVBAConstantType( const String& rName )
+{
+ init();
+ bool bConstant = false;
+ ::rtl::OUString sKey( rName );
+ VBAConstantsVector::const_iterator it = aConstCache.begin();
+
+ for( ; it != aConstCache.end(); ++it )
+ {
+ if( sKey.equalsIgnoreAsciiCase( *it ) )
+ {
+ bConstant = true;
+ break;
+ }
+ }
+ return bConstant;
+}
+
+SbxVariable*
+VBAConstantHelper::getVBAConstant( const String& rName )
+{
+ SbxVariable* pConst = NULL;
+ init();
+
::rtl::OUString sKey( rName );
- VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() );
- if ( it != aConstCache.end() )
+
+ VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
+
+ if ( it != aConstHash.end() )
{
pConst = new SbxVariable( SbxVARIANT );
pConst->SetName( rName );
unoToSbxValue( pConst, it->second );
}
+
return pConst;
}
-// Funktion, um einen globalen Bezeichner im
-// UnoScope zu suchen und fuer Sbx zu wrappen
+// Function to search for a global identifier in the
+// UnoScope and to wrap it for Sbx
SbUnoClass* findUnoClass( const String& rName )
{
// #105550 Check if module exists
@@ -3448,13 +3563,13 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
SbxVariable* pRes = SbxObject::Find( rName, SbxCLASS_VARIABLE );
- // Wenn nichts gefunden wird, ist das Sub-Modul noch nicht bekannt
+ // If nothing were located the submodule isn't known yet
if( !pRes )
{
- // Wenn es schon eine Klasse ist, nach einen Feld fragen
+ // If it is already a class, ask for the field
if( m_xClass.is() )
{
- // Ist es ein Field
+ // Is it a field(?)
::rtl::OUString aUStr( rName );
Reference< XIdlField > xField = m_xClass->getField( aUStr );
Reference< XIdlClass > xClass;
@@ -3465,7 +3580,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
Any aAny;
aAny = xField->get( aAny );
- // Nach Sbx wandeln
+ // Convert to Sbx
pRes = new SbxVariable( SbxVARIANT );
pRes->SetName( rName );
unoToSbxValue( pRes, aAny );
@@ -3478,16 +3593,16 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
}
else
{
- // Vollqualifizierten Namen erweitern
+ // expand fully qualified name
String aNewName = GetName();
aNewName.AppendAscii( "." );
aNewName += rName;
- // CoreReflection holen
+ // get CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( xCoreReflection.is() )
{
- // Ist es eine Konstante?
+ // Is it a constant?
Reference< XHierarchicalNameAccess > xHarryName( xCoreReflection, UNO_QUERY );
if( xHarryName.is() )
{
@@ -3496,7 +3611,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
Any aValue = xHarryName->getByHierarchicalName( aNewName );
TypeClass eType = aValue.getValueType().getTypeClass();
- // Interface gefunden? Dann ist es eine Klasse
+ // Interface located? Then it is a class
if( eType == TypeClass_INTERFACE )
{
Reference< XInterface > xIface = *(Reference< XInterface >*)aValue.getValue();
@@ -3520,7 +3635,7 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
}
}
- // Sonst wieder als Klasse annehmen
+ // Otherwise take it again as class
if( !pRes )
{
SbUnoClass* pNewClass = findUnoClass( aNewName );
@@ -3562,11 +3677,11 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
{
pRes->SetName( rName );
- // Variable einfuegen, damit sie spaeter im Find gefunden wird
+ // Insert variable, so that it could be found later
QuickInsert( pRes );
- // Uns selbst gleich wieder als Listener rausnehmen,
- // die Werte sind alle konstant
+ // Take us out as listener at once,
+ // the values are all constant
if( pRes->IsBroadcaster() )
EndListening( pRes->GetBroadcaster(), TRUE );
}
@@ -3606,7 +3721,7 @@ SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
if( !pRes )
{
- // Wenn es schon eine Klasse ist, nach einen Feld fragen
+ // If it is already a class ask for a field
if( m_bNeedsInit && m_xServiceTypeDesc.is() )
{
m_bNeedsInit = false;
@@ -3617,7 +3732,7 @@ SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
for( int i = 0 ; i < nCtorCount ; ++i )
{
Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i];
-
+
String aName( xCtor->getName() );
if( !aName.Len() )
{
@@ -3762,7 +3877,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
xContext.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
}
- Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Any aRetAny;
if( xServiceMgr.is() )
@@ -3924,27 +4039,27 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
//========================================================================
//========================================================================
-// Implementation eines EventAttacher-bezogenen AllListeners, der
-// nur einzelne Events an einen allgemeinen AllListener weiterleitet
+// Implementation of an EventAttacher-drawn AllListener, which
+// solely transmits several events to an general AllListener
class BasicAllListener_Impl : public BasicAllListenerHelper
{
virtual void firing_impl(const AllEventObject& Event, Any* pRet);
public:
- SbxObjectRef xSbxObj;
- ::rtl::OUString aPrefixName;
+ SbxObjectRef xSbxObj;
+ ::rtl::OUString aPrefixName;
BasicAllListener_Impl( const ::rtl::OUString& aPrefixName );
~BasicAllListener_Impl();
- // Methoden von XInterface
+ // Methods of XInterface
//virtual BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut );
- // Methoden von XAllListener
+ // Methods of XAllListener
virtual void SAL_CALL firing(const AllEventObject& Event) throw ( RuntimeException );
virtual Any SAL_CALL approveFiring(const AllEventObject& Event) throw ( RuntimeException );
- // Methoden von XEventListener
+ // Methods of XEventListener
virtual void SAL_CALL disposing(const EventObject& Source) throw ( RuntimeException );
};
@@ -3952,7 +4067,7 @@ public:
//========================================================================
BasicAllListener_Impl::BasicAllListener_Impl
(
- const ::rtl::OUString & aPrefixName_
+ const ::rtl::OUString & aPrefixName_
)
: aPrefixName( aPrefixName_ )
{
@@ -3981,13 +4096,13 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
StarBASIC * pLib = PTR_CAST(StarBASIC,pP);
if( pLib )
{
- // In Basic Array anlegen
+ // 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++ )
{
- // Elemente wandeln
+ // Convert elements
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
unoToSbxValue( (SbxVariable*)xVar, pArgs[i] );
xSbxArray->Put( xVar, sal::static_int_cast< USHORT >(i+1) );
@@ -3995,7 +4110,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
pLib->Call( aMethodName, xSbxArray );
- // Return-Wert aus dem Param-Array holen, wenn verlangt
+ // get the return value from the Param-Array, if requestet
if( pRet )
{
SbxVariable* pVar = xSbxArray->Get( 0 );
@@ -4015,7 +4130,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
}
-// Methoden von XAllListener
+// Methods of Listener
void BasicAllListener_Impl::firing( const AllEventObject& Event ) throw ( RuntimeException )
{
firing_impl( Event, NULL );
@@ -4029,7 +4144,7 @@ Any BasicAllListener_Impl::approveFiring( const AllEventObject& Event ) throw (
}
//========================================================================
-// Methoden von XEventListener
+// Methods of XEventListener
void BasicAllListener_Impl ::disposing(const EventObject& ) throw ( RuntimeException )
{
vos::OGuard guard( Application::GetSolarMutex() );
@@ -4061,9 +4176,9 @@ public:
private:
Reference< XIdlReflection > m_xCoreReflection;
- Reference< XAllListener > m_xAllListener;
- Reference< XIdlClass > m_xListenerType;
- Any m_Helper;
+ Reference< XAllListener > m_xAllListener;
+ Reference< XIdlClass > m_xListenerType;
+ Any m_Helper;
};
@@ -4079,7 +4194,7 @@ Reference< XInterface > createAllListenerAdapter
Reference< XInterface > xAdapter;
if( xInvocationAdapterFactory.is() && xListenerType.is() && xListener.is() )
{
- Reference< XInvocation > xInvocationToAllListenerMapper =
+ Reference< XInvocation > xInvocationToAllListenerMapper =
(XInvocation*)new InvocationToAllListenerMapper( xListenerType, xListener, Helper );
Type aListenerType( xListenerType->getTypeClass(), xListenerType->getName() );
xAdapter = xInvocationAdapterFactory->createAdapter( xInvocationToAllListenerMapper, aListenerType );
@@ -4195,42 +4310,42 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const ::rtl::OUStri
//========================================================================
// Uno-Service erzeugen
-// 1. Parameter == Prefix-Name der Makros
-// 2. Parameter == voll qualifizierter Name des Listeners
+// 1. Parameter == Prefix-Name of the macro
+// 2. Parameter == fully qualified name of the listener
void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
//RTLFUNC(CreateUnoListener)
{
(void)bWrite;
- // Wir brauchen 2 Parameter
+ // We need 2 parameters
if ( rPar.Count() != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aPrefixName = rPar.Get(1)->GetString();
String aListenerClassName = rPar.Get(2)->GetString();
- // CoreReflection holen
+ // get the CoreReflection
Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
if( !xCoreReflection.is() )
return;
- // AllListenerAdapterService holen
+ // get the AllListenerAdapterService
Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
if( !xFactory.is() )
return;
- // Klasse suchen
+ // search the class
Reference< XIdlClass > xClass = xCoreReflection->forName( aListenerClassName );
if( !xClass.is() )
return;
- // AB, 30.11.1999 InvocationAdapterFactory holen
+ // 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 );
@@ -4253,7 +4368,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
SbxArrayRef xBasicUnoListeners = pBasic->getUnoListeners();
xBasicUnoListeners->Insert( pUnoObj, xBasicUnoListeners->Count() );
- // Objekt zurueckliefern
+ // return the object
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( p->xSbxObj );
}
@@ -4303,7 +4418,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
return;
}
- // Klassen-Name der struct holen
+ // get the name of the class of the struct
String aTypeName = rPar.Get(1)->GetString();
SbxVariable* pVal = rPar.Get(2);
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 6f800054b8..1848ffe619 100755
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <list>
-#include <vos/macros.hxx>
#include <vcl/svapp.hxx>
#include <tools/stream.hxx>
#include <svl/brdcst.hxx>
@@ -47,8 +47,6 @@
#include "sbunoobj.hxx"
#include "sbtrace.hxx"
-
-//#include <basic/hilight.hxx>
#include <svtools/syntaxhighlight.hxx>
#include <basic/basrdll.hxx>
@@ -518,8 +516,8 @@ bool VBAUnlockControllers( StarBASIC* pBasic )
/////////////////////////////////////////////////////////////////////////////
-// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
-// Elemente von anderen Modulen aus gefunden werden koennen.
+// 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 )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
@@ -568,7 +566,7 @@ const SbxObject* SbModule::FindType( String aTypeName ) const
}
-// Aus dem Codegenerator: Loeschen des Images und Invalidieren der Entries
+// From the code generator: deletion of images and the oposite of validation for entries
void SbModule::StartDefinitions()
{
@@ -576,8 +574,8 @@ void SbModule::StartDefinitions()
if( pClassData )
pClassData->clear();
- // Methoden und Properties bleiben erhalten, sind jedoch ungueltig
- // schliesslich sind ja u.U. die Infos belegt
+ // methods and properties persist, but they are invalid;
+ // at least are the information under certain conditions clogged
USHORT i;
for( i = 0; i < pMethods->Count(); i++ )
{
@@ -595,7 +593,7 @@ void SbModule::StartDefinitions()
}
}
-// Methode anfordern/anlegen
+// request/create method
SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
{
@@ -611,8 +609,8 @@ SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
pMethods->Put( pMeth, pMethods->Count() );
StartListening( pMeth->GetBroadcaster(), TRUE );
}
- // Per Default ist die Methode GUELTIG, da sie auch vom Compiler
- // (Codegenerator) erzeugt werden kann
+ // The method is per default valid, because it could be
+ // created from the compiler (code generator) as well.
pMeth->bInvalid = FALSE;
pMeth->ResetFlag( SBX_FIXED );
pMeth->SetFlag( SBX_WRITE );
@@ -623,7 +621,7 @@ SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t )
return pMeth;
}
-// Property anfordern/anlegen
+// request/create property
SbProperty* SbModule::GetProperty( const String& rName, SbxDataType t )
{
@@ -685,7 +683,7 @@ SbIfaceMapperMethod::~SbIfaceMapperMethod()
TYPEINIT1(SbIfaceMapperMethod,SbMethod)
-// Aus dem Codegenerator: Ungueltige Eintraege entfernen
+// From the code generator: remove invalid entries
void SbModule::EndDefinitions( BOOL bNewState )
{
@@ -766,12 +764,12 @@ const String& SbModule::GetSource() const
return aRetStr;
}
-// Parent und BASIC sind eins!
+// Parent and BASIC are one!
void SbModule::SetParent( SbxObject* p )
{
// #118083: Assertion is not valid any more
- // DBG_ASSERT( !p || p->IsA( TYPE(StarBASIC) ), "SbModules nur in BASIC eintragen" );
+ // DBG_ASSERT( !p || p->IsA( TYPE(StarBASIC) ), "Register SbModules only in BASIC" );
pParent = p;
}
@@ -784,6 +782,82 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxVariable* pVar = pHint->GetVar();
SbProperty* pProp = PTR_CAST(SbProperty,pVar);
SbMethod* pMeth = PTR_CAST(SbMethod,pVar);
+ SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
+ if( pProcProperty )
+ {
+
+ if( pHint->GetId() == SBX_HINT_DATAWANTED )
+ {
+ String aProcName;
+ aProcName.AppendAscii( "Property Get " );
+ aProcName += pProcProperty->GetName();
+
+ SbxVariable* pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ if( pMethVar )
+ {
+ SbxValues aVals;
+ aVals.eType = SbxVARIANT;
+
+ SbxArray* pArg = pVar->GetParameters();
+ USHORT 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 )
+ {
+ SbxVariable* pPar = pArg->Get( i );
+ xMethParameters->Put( pPar, i );
+ }
+
+ pMethVar->SetParameters( xMethParameters );
+ pMethVar->Get( aVals );
+ pMethVar->SetParameters( NULL );
+ }
+ else
+ {
+ pMethVar->Get( aVals );
+ }
+
+ pVar->Put( aVals );
+ }
+ }
+ else if( pHint->GetId() == SBX_HINT_DATACHANGED )
+ {
+ SbxVariable* pMethVar = NULL;
+
+ bool bSet = pProcProperty->isSet();
+ if( bSet )
+ {
+ pProcProperty->setSet( false );
+
+ String aProcName;
+ aProcName.AppendAscii( "Property Set " );
+ aProcName += pProcProperty->GetName();
+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ }
+ if( !pMethVar ) // Let
+ {
+ String aProcName;
+ aProcName.AppendAscii( "Property Let " );
+ aProcName += pProcProperty->GetName();
+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ }
+
+ if( pMethVar )
+ {
+ // Setup parameters
+ SbxArrayRef xArray = new SbxArray;
+ xArray->Put( pMethVar, 0 ); // Method as parameter 0
+ xArray->Put( pVar, 1 );
+ pMethVar->SetParameters( xArray );
+
+ SbxValues aVals;
+ pMethVar->Get( aVals );
+ pMethVar->SetParameters( NULL );
+ }
+ }
+ }
if( pProp )
{
if( pProp->GetModule() != this )
@@ -794,11 +868,11 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
if( pMeth->bInvalid && !Compile() )
- // Auto-Compile hat nicht geklappt!
+ // auto compile has not worked!
StarBASIC::Error( SbERR_BAD_PROP_VALUE );
else
{
- // Aufruf eines Unterprogramms
+ // Call of a subprogram
SbModule* pOld = pMOD;
pMOD = this;
Run( (SbMethod*) pVar );
@@ -823,8 +897,8 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
-// Das Setzen der Source macht das Image ungueltig
-// und scant die Methoden-Definitionen neu ein
+// The setting of the source makes the image invalid
+// and scans the method definitions newly in
void SbModule::SetSource( const String& r )
{
@@ -838,15 +912,16 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
+ aTok.SetCompatible( IsVBACompat() );
while( !aTok.IsEof() )
{
SbiToken eEndTok = NIL;
- // Suchen nach SUB oder FUNCTION
+ // Searching for SUB or FUNCTION
SbiToken eLastTok = NIL;
while( !aTok.IsEof() )
{
- // #32385: Nicht bei declare
+ // #32385: not by declare
SbiToken eCurTok = aTok.Next();
if( eLastTok != DECLARE )
{
@@ -877,7 +952,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
}
eLastTok = eCurTok;
}
- // Definition der Methode
+ // Definition of the method
SbMethod* pMeth = NULL;
if( eEndTok != NIL )
{
@@ -890,13 +965,13 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
t = SbxVOID;
pMeth = GetMethod( aName_, t );
pMeth->nLine1 = pMeth->nLine2 = nLine1;
- // Die Methode ist erst mal GUELTIG
+ // The method is for a start VALID
pMeth->bInvalid = FALSE;
}
else
eEndTok = NIL;
}
- // Skip bis END SUB/END FUNCTION
+ // Skip up to END SUB/END FUNCTION
if( eEndTok != NIL )
{
while( !aTok.IsEof() )
@@ -934,14 +1009,14 @@ SbMethod* SbModule::GetFunctionForLine( USHORT nLine )
return NULL;
}
-// Ausstrahlen eines Hints an alle Basics
+// Broadcast of a hint to all Basics
static void _SendHint( SbxObject* pObj, ULONG nId, SbMethod* p )
{
- // Selbst ein BASIC?
+ // Self a BASIC?
if( pObj->IsA( TYPE(StarBASIC) ) && pObj->IsBroadcaster() )
pObj->GetBroadcaster().Broadcast( SbxHint( nId, p ) );
- // Dann die Unterobjekte fragen
+ // Then ask for the subobjects
SbxArray* pObjs = pObj->GetObjects();
for( USHORT i = 0; i < pObjs->Count(); i++ )
{
@@ -958,35 +1033,35 @@ static void SendHint( SbxObject* pObj, ULONG nId, SbMethod* p )
_SendHint( pObj, nId, p );
}
-// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
-// beim Programm-Ende freigeben, damit nichts gehalten wird.
+// #57841 Clear Uno-Objects, which were helt in RTL functions,
+// at the end of the program, so that nothing were helt.
void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
{
- // return-Wert von CreateUnoService loeschen
+ // delete the return value of CreateUnoService
static String aName( RTL_CONSTASCII_USTRINGPARAM("CreateUnoService") );
SbxVariable* pVar = pBasic->GetRtl()->Find( aName, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // return-Wert von CreateUnoDialog loeschen
+ // delete the return value of CreateUnoDialog
static String aName2( RTL_CONSTASCII_USTRINGPARAM("CreateUnoDialog") );
pVar = pBasic->GetRtl()->Find( aName2, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // return-Wert von CDec loeschen
+ // delete the return value of CDec
static String aName3( RTL_CONSTASCII_USTRINGPARAM("CDec") );
pVar = pBasic->GetRtl()->Find( aName3, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // return-Wert von CreateObject loeschen
+ // delete return value of CreateObject
static String aName4( RTL_CONSTASCII_USTRINGPARAM("CreateObject") );
pVar = pBasic->GetRtl()->Find( aName4, SbxCLASS_METHOD );
if( pVar )
pVar->SbxValue::Clear();
- // Ueber alle Sub-Basics gehen
+ // Go over all Sub-Basics
SbxArray* pObjs = pBasic->GetObjects();
USHORT nCount = pObjs->Count();
for( USHORT i = 0 ; i < nCount ; i++ )
@@ -1000,13 +1075,13 @@ void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
{
- // #67781 Rueckgabewerte der Uno-Methoden loeschen
+ // #67781 Delete return values of the Uno-methods
clearUnoMethods();
clearUnoServiceCtors();
ClearUnoObjectsInRTL_Impl_Rek( pBasic );
- // Oberstes Basic suchen
+ // Search for the topmost Basic
SbxObject* p = pBasic;
while( p->GetParent() )
p = p->GetParent();
@@ -1025,12 +1100,14 @@ void SbModule::SetVBACompat( BOOL bCompat )
// Ausfuehren eines BASIC-Unterprogramms
USHORT 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 String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
USHORT nRes = 0;
BOOL bDelInst = BOOL( pINST == NULL );
+ bool bQuit = false;
StarBASICRef xBasic;
if( bDelInst )
{
@@ -1042,30 +1119,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
pINST = new SbiInstance( (StarBASIC*) GetParent() );
- // Launcher problem
- // i80726 The Find below will genarate an error in Testtool so we reset it unless there was one before already
- BOOL bWasError = SbxBase::GetError() != 0;
- SbxVariable* pMSOMacroRuntimeLibVar = Find( aMSOMacroRuntimeLibName, SbxCLASS_OBJECT );
- if ( !bWasError && (SbxBase::GetError() == SbxERR_PROC_UNDEFINED) )
- SbxBase::ResetError();
- if( pMSOMacroRuntimeLibVar )
- {
- StarBASIC* pMSOMacroRuntimeLib = PTR_CAST(StarBASIC,pMSOMacroRuntimeLibVar);
- if( pMSOMacroRuntimeLib )
- {
- USHORT nGblFlag = pMSOMacroRuntimeLib->GetFlags() & SBX_GBLSEARCH;
- pMSOMacroRuntimeLib->ResetFlag( SBX_GBLSEARCH );
- SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( aMSOMacroRuntimeAppSymbol, SbxCLASS_METHOD );
- pMSOMacroRuntimeLib->SetFlag( nGblFlag );
- if( pAppSymbol )
- {
- pMSOMacroRuntimeLib->SetFlag( SBX_EXTSEARCH ); // Could have been disabled before
- GetSbData()->pMSOMacroRuntimLib = pMSOMacroRuntimeLib;
- }
- }
- }
-
- // Error-Stack loeschen
+ // Delete the Error-Stack
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
delete rErrStack;
rErrStack = NULL;
@@ -1093,22 +1147,22 @@ USHORT SbModule::Run( SbMethod* pMeth )
}
}
- // Rekursion zu tief?
+ // Recursion to deep?
if( ++pINST->nCallLvl <= nMaxCallLevel )
{
- // Globale Variable in allen Mods definieren
+ // Define a globale variable in all Mods
GlobalRunInit( /* bBasicStart = */ bDelInst );
- // Trat ein Compiler-Fehler auf? Dann starten wir nicht
+ // Appeared a compiler error? Then we don't launch
if( GetSbData()->bGlobalInitErr == FALSE )
{
if( bDelInst )
{
SendHint( GetParent(), SBX_HINT_BASICSTART, pMeth );
- // 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
- // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel()
- // BreakCallLevel ermitteln
+ // 1996-10-16: #31460 New concept for StepInto/Over/Out
+ // For an explanation see runtime.cxx at SbiInstance::CalcBreakCallLevel()
+ // Identify the BreakCallLevel
pINST->CalcBreakCallLevel( pMeth->GetDebugFlags() );
}
@@ -1146,27 +1200,36 @@ USHORT SbModule::Run( SbMethod* pMeth )
// Daher muss hier gewartet werden, bis andere Call zurueckkehrt.
if( bDelInst )
{
- // Hier mit 1 statt 0 vergleichen, da vor nCallLvl--
+ // Compare here with 1 instead of 0, because before nCallLvl--
while( pINST->nCallLvl != 1 )
GetpApp()->Yield();
}
nRes = TRUE;
pINST->pRun = pRt->pNext;
- pINST->nCallLvl--; // Call-Level wieder runter
+ pINST->nCallLvl--; // Call-Level down again
- // Gibt es eine uebergeordnete Runtime-Instanz?
- // Dann SbDEBUG_BREAK uebernehmen, wenn gesetzt
+ // Exist an higher-ranking runtime instance?
+ // Then take over SbDEBUG_BREAK, if set
SbiRuntime* pRtNext = pRt->pNext;
if( pRtNext && (pRt->GetDebugFlags() & SbDEBUG_BREAK) )
pRtNext->SetDebugFlags( SbDEBUG_BREAK );
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 Uno-Objekte, die in RTL-Funktionen gehalten werden,
- // beim Programm-Ende freigeben, damit nichts gehalten wird.
+ // #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();
@@ -1175,7 +1238,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
delete pINST, pINST = NULL, bDelInst = FALSE;
// #i30690
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth );
GlobalRunDeInit();
@@ -1190,19 +1253,19 @@ USHORT SbModule::Run( SbMethod* pMeth )
}
}
else
- pINST->nCallLvl--; // Call-Level wieder runter
+ pINST->nCallLvl--; // Call-Level down again
}
else
{
- pINST->nCallLvl--; // Call-Level wieder runter
+ pINST->nCallLvl--; // Call-Level down again
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
}
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
if( bDelInst )
{
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
- // beim Programm-Ende freigeben, damit nichts gehalten wird.
+ // #57841 Clear Uno-Objects, which were helt in RTL functions,
+ // the end of the program, so that nothing were helt.
ClearUnoObjectsInRTL_Impl( xBasic );
delete pINST;
@@ -1216,8 +1279,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
return nRes;
}
-// Ausfuehren der Init-Methode eines Moduls nach dem Laden
-// oder der Compilation
+// Execute of the init method of a module after the loading
+// or the compilation
void SbModule::RunInit()
{
@@ -1225,7 +1288,7 @@ void SbModule::RunInit()
&& !pImage->bInit
&& pImage->GetFlag( SBIMG_INITCODE ) )
{
- // Flag setzen, dass RunInit aktiv ist (Testtool)
+ // Set flag, so that RunInit get activ (Testtool)
GetSbData()->bRunInit = TRUE;
// BOOL bDelInst = BOOL( pINST == NULL );
@@ -1233,7 +1296,7 @@ void SbModule::RunInit()
// pINST = new SbiInstance( (StarBASIC*) GetParent() );
SbModule* pOldMod = pMOD;
pMOD = this;
- // Der Init-Code beginnt immer hier
+ // The init code starts always here
SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 );
#ifdef DBG_TRACE_BASIC
@@ -1257,7 +1320,7 @@ void SbModule::RunInit()
pImage->bInit = TRUE;
pImage->bFirstInit = FALSE;
- // RunInit ist nicht mehr aktiv
+ // RunInit is not activ anymore
GetSbData()->bRunInit = FALSE;
}
}
@@ -1297,7 +1360,7 @@ void SbModule::ClearPrivateVars()
SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) );
if( p )
{
- // Arrays nicht loeschen, sondern nur deren Inhalt
+ // Delete not the arrays, only their content
if( p->GetType() & SbxARRAY )
{
SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject());
@@ -1389,7 +1452,7 @@ void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
// (Branch in sb.cxx vermeiden)
void StarBASIC::ClearAllModuleVars( void )
{
- // Eigene Module initialisieren
+ // Initialise the own module
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
@@ -1398,34 +1461,23 @@ void StarBASIC::ClearAllModuleVars( void )
pModule->ClearPrivateVars();
}
- /* #88042 This code can delete already used public vars during runtime!
- // Alle Objekte ueberpruefen, ob es sich um ein Basic handelt
- // Wenn ja, auch dort initialisieren
- for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ )
- {
- SbxVariable* pVar = pObjs->Get( nObj );
- StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
- if( pBasic )
- pBasic->ClearAllModuleVars();
- }
- */
}
-// Ausfuehren des Init-Codes aller Module
+// Execution of the init-code of all module
void SbModule::GlobalRunInit( BOOL bBasicStart )
{
- // Wenn kein Basic-Start, nur initialisieren, wenn Modul uninitialisiert
+ // If no Basic-Start, only initialise, if the module is not initialised
if( !bBasicStart )
if( !(pImage && !pImage->bInit) )
return;
- // GlobalInitErr-Flag fuer Compiler-Error initialisieren
- // Anhand dieses Flags kann in SbModule::Run() nach dem Aufruf
- // von GlobalRunInit festgestellt werden, ob beim initialisieren
- // der Module ein Fehler auftrat. Dann wird nicht gestartet.
+ // 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 occurred. Then it will not be launched.
GetSbData()->bGlobalInitErr = FALSE;
- // Parent vom Modul ist ein Basic
+ // Parent of the module is a Basic
StarBASIC *pBasic = PTR_CAST(StarBASIC,GetParent());
if( pBasic )
{
@@ -1467,8 +1519,8 @@ void SbModule::GlobalRunDeInit( void )
}
}
-// Suche nach dem naechsten STMNT-Befehl im Code. Wird vom STMNT-
-// Opcode verwendet, um die Endspalte zu setzen.
+// 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
{
@@ -1513,7 +1565,7 @@ const BYTE* SbModule::FindNextStmnt( const BYTE* p, USHORT& nLine, USHORT& nCol,
return NULL;
}
-// Testen, ob eine Zeile STMNT-Opcodes enthaelt
+// Test, if a line contains STMNT-Opcodes
BOOL SbModule::IsBreakable( USHORT nLine ) const
{
@@ -1573,7 +1625,7 @@ BOOL SbModule::SetBP( USHORT nLine )
}
pBreaks->insert( pBreaks->begin() + i, nLine );
- // #38568: Zur Laufzeit auch hier SbDEBUG_BREAK setzen
+ // #38568: Set during runtime as well here SbDEBUG_BREAK
if( pINST && pINST->pRun )
pINST->pRun->SetDebugFlags( SbDEBUG_BREAK );
@@ -1659,7 +1711,7 @@ BOOL SbModule::LoadData( SvStream& rStrm, USHORT nVer )
if( p->GetCodeSize() )
{
aOUSource = p->aOUSource;
- // Alte Version: Image weg
+ // Old version: image away
if( nVer == 1 )
{
SetSource32( p->aOUSource );
@@ -1722,6 +1774,52 @@ BOOL SbModule::ExceedsLegacyModuleSize()
return false;
}
+class ErrorHdlResetter
+{
+ Link mErrHandler;
+ bool mbError;
+ public:
+ ErrorHdlResetter() : mbError( false )
+ {
+ // save error handler
+ mErrHandler = StarBASIC::GetGlobalErrorHdl();
+ // set new error handler
+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
+ }
+ ~ErrorHdlResetter()
+ {
+ // restore error handler
+ StarBASIC::SetGlobalErrorHdl(mErrHandler);
+ }
+ DECL_LINK( BasicErrorHdl, StarBASIC * );
+ bool HasError() { return mbError; }
+};
+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
+{
+ mbError = true;
+ return 0;
+}
+
+bool SbModule::HasExeCode()
+{
+ // And empty Image always has the Global Chain set up
+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
+ // lets be stricter for the moment than VBA
+
+ if (!IsCompiled())
+ {
+ ErrorHdlResetter aGblErrHdl;
+ Compile();
+ if (aGblErrHdl.HasError()) //assume unsafe on compile error
+ return true;
+ }
+
+ bool bRes = false;
+ if (pImage && !(pImage->GetCodeSize() == 5 && (memcmp(pImage->GetCode(), pEmptyImage, pImage->GetCodeSize()) == 0 )))
+ bRes = true;
+
+ return bRes;
+}
// Store only image, no source
BOOL SbModule::StoreBinaryData( SvStream& rStrm )
@@ -1771,7 +1869,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm )
return bRet;
}
-
BOOL SbModule::LoadCompleted()
{
SbxArray* p = GetMethods();
@@ -1899,7 +1996,7 @@ BOOL SbJScriptModule::LoadData( SvStream& rStrm, USHORT nVer )
if( !SbxObject::LoadData( rStrm, 1 ) )
return FALSE;
- // Source-String holen
+ // Get the source string
String aTmp;
rStrm.ReadByteString( aTmp, gsl_getSystemTextEncoding() );
aOUSource = aTmp;
@@ -1912,7 +2009,7 @@ BOOL SbJScriptModule::StoreData( SvStream& rStrm ) const
if( !SbxObject::StoreData( rStrm ) )
return FALSE;
- // Source-String schreiben
+ // Write the source string
String aTmp = aOUSource;
rStrm.WriteByteString( aTmp, gsl_getSystemTextEncoding() );
//rStrm << aSource;
@@ -1931,7 +2028,8 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
nLine1 =
nLine2 = 0;
refStatics = new SbxArray;
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ mCaller = 0;
+ // From: 1996-07.02: HACK due to 'Referenz could not be saved'
SetFlag( SBX_NO_MODIFY );
}
@@ -1944,7 +2042,8 @@ SbMethod::SbMethod( const SbMethod& r )
nDebugFlags = r.nDebugFlags;
nLine1 = r.nLine1;
nLine2 = r.nLine2;
- refStatics = r.refStatics;
+ refStatics = r.refStatics;
+ mCaller = r.mCaller;
SetFlag( SBX_NO_MODIFY );
}
@@ -1963,7 +2062,7 @@ SbxArray* SbMethod::GetLocals()
void SbMethod::ClearStatics()
{
refStatics = new SbxArray;
-
+
}
SbxArray* SbMethod::GetStatics()
{
@@ -1977,10 +2076,10 @@ BOOL SbMethod::LoadData( SvStream& rStrm, USHORT nVer )
INT16 n;
rStrm >> n;
INT16 nTempStart = (INT16)nStart;
- // nDebugFlags = n; // AB 16.1.96: Nicht mehr uebernehmen
+ // nDebugFlags = n; // From 1996-01-16: no longer take over
if( nVer == 2 )
rStrm >> nLine1 >> nLine2 >> nTempStart >> bInvalid;
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ // From: 1996-07-02: HACK ue to 'Referenz could not be saved'
SetFlag( SBX_NO_MODIFY );
nStart = nTempStart;
return TRUE;
@@ -2003,27 +2102,32 @@ void SbMethod::GetLineRange( USHORT& l1, USHORT& l2 )
l1 = nLine1; l2 = nLine2;
}
-// Kann spaeter mal weg
+// Could later be deleted
SbxInfo* SbMethod::GetInfo()
{
return pInfo;
}
-// Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
-// #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
-// abgeschossen werden kann. Rueckgabewert wird als String geliefert.
-ErrCode SbMethod::Call( SbxValue* pRet )
+// Interface to execute a method of the applications
+// #34191# With special RefCounting, damit 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 )
{
+ if ( pCaller )
+ {
+ OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
+ mCaller = pCaller;
+ }
// RefCount vom Modul hochzaehlen
SbModule* pMod_ = (SbModule*)GetParent();
pMod_->AddRef();
- // RefCount vom Basic hochzaehlen
+ // Increment the RefCount of the Basic
StarBASIC* pBasic = (StarBASIC*)pMod_->GetParent();
pBasic->AddRef();
- // Values anlegen, um Return-Wert zu erhalten
+ // Establish the values to get the return value
SbxValues aVals;
aVals.eType = SbxVARIANT;
@@ -2035,14 +2139,14 @@ ErrCode SbMethod::Call( SbxValue* pRet )
if ( pRet )
pRet->Put( aVals );
- // Gab es einen Error
+ // Was there an error
ErrCode nErr = SbxBase::GetError();
SbxBase::ResetError();
- // Objekte freigeben
+ // Release objects
pMod_->ReleaseRef();
pBasic->ReleaseRef();
-
+ mCaller = 0;
return nErr;
}
@@ -2052,8 +2156,8 @@ void SbMethod::Broadcast( ULONG nHintId )
{
if( pCst && !IsSet( SBX_NO_BROADCAST ) && StaticIsEnabledBroadcasting() )
{
- // Da die Methode von aussen aufrufbar ist, hier noch einmal
- // die Berechtigung testen
+ // Because the method could be called from outside, test here once again
+ // the authorisation
if( nHintId & SBX_HINT_DATAWANTED )
if( !CanRead() )
return;
@@ -2071,7 +2175,7 @@ void SbMethod::Broadcast( ULONG nHintId )
SbMethodRef xHolder = pThisCopy;
if( mpPar.Is() )
{
- // this, als Element 0 eintragen, aber den Parent nicht umsetzen!
+ // Enrigister this as element 0, but don't reset the parent!
if( GetType() != SbxVOID )
mpPar->PutDirect( pThisCopy, 0 );
SetParameters( NULL );
@@ -2091,7 +2195,7 @@ void SbMethod::Broadcast( ULONG nHintId )
/////////////////////////////////////////////////////////////////////////
-// Implementation SbJScriptMethod (Method-Klasse als Wrapper fuer JavaScript-Funktionen)
+// Implementation of SbJScriptMethod (method class as a wrapper for JavaScript-functions)
SbJScriptMethod::SbJScriptMethod( const String& r, SbxDataType t, SbModule* p )
: SbMethod( r, t, p )
@@ -2624,3 +2728,4 @@ SbProperty::~SbProperty()
SbProcedureProperty::~SbProcedureProperty()
{}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx
index 322d57a32c..cd3d4e277d 100644
--- a/basic/source/comp/buffer.cxx
+++ b/basic/source/comp/buffer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,9 +35,9 @@
const static 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 )
{
@@ -55,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()
{
@@ -66,8 +67,8 @@ 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 )
{
@@ -100,7 +101,7 @@ BOOL SbiBuffer::Check( USHORT n )
return TRUE;
}
-// Angleich des Puffers auf die uebergebene Byte-Grenze
+// Conditioning of the buffer onto the passed Byte limit
void SbiBuffer::Align( INT32 n )
{
@@ -119,7 +120,7 @@ void SbiBuffer::Align( INT32 n )
}
}
-// Patch einer Location
+// Patch of a Location
void SbiBuffer::Patch( UINT32 off, UINT32 val )
{
@@ -135,9 +136,9 @@ 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 )
{
@@ -248,3 +249,4 @@ BOOL SbiBuffer::Add( const void* p, USHORT len )
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 256dcf92e0..c8e961af1e 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,7 +35,7 @@
#include <limits>
#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 )
@@ -51,7 +52,7 @@ UINT32 SbiCodeGen::GetPC()
return aCode.GetSize();
}
-// Statement merken
+// memorize the statement
void SbiCodeGen::Statement()
{
@@ -60,12 +61,12 @@ void SbiCodeGen::Statement()
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()
{
@@ -76,8 +77,8 @@ void SbiCodeGen::GenStmnt()
}
}
-// 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 )
{
@@ -117,15 +118,15 @@ UINT32 SbiCodeGen::Gen( SbiOpcode eOpcode, UINT32 nOpnd1, UINT32 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 );
@@ -244,6 +245,8 @@ void SbiCodeGen::Save()
if( nPass == 1 )
aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
SbProcedureProperty* pProcedureProperty = NULL;
+ OSL_TRACE("*** getProcedureProperty for thing %s",
+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
}
if( nPass == 1 )
@@ -266,22 +269,22 @@ 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;
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!
+ // The first element is always the value of the function!
for( USHORT i = 1; i < pPool->GetSize(); i++ )
{
SbiSymDef* pPar = pPool->Get( i );
@@ -290,7 +293,7 @@ void SbiCodeGen::Save()
t = (SbxDataType) ( t | SbxBYREF );
if( pPar->GetDims() )
t = (SbxDataType) ( t | SbxARRAY );
- // #33677 Optional-Info durchreichen
+ // #33677 hand-over an Optional-Info
USHORT nFlags = SBX_READ;
if( pPar->IsOptional() )
nFlags |= SBX_OPTIONAL;
@@ -315,10 +318,10 @@ 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();
p->MakeStrings( nSize );
@@ -326,7 +329,7 @@ void SbiCodeGen::Save()
for( i = 1; i <= nSize; i++ )
p->AddString( pPool->Find( i ) );
- // Typen einfuegen
+ // Insert types
USHORT nCount = pParser->rTypeArray->Count();
for (i = 0; i < nCount; i++)
p->AddType((SbxObject *)pParser->rTypeArray->Get(i));
@@ -537,3 +540,5 @@ PCodeBuffConvertor<T,S>::convert()
template class PCodeBuffConvertor< UINT16, UINT32 >;
template class PCodeBuffConvertor< UINT32, UINT16 >;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 61cf215949..e591fece78 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -29,6 +29,8 @@
#include "precompiled_basic.hxx"
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
+#include "sbunoobj.hxx"
+
SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
@@ -49,7 +51,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 );
@@ -69,15 +71,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 )
{
SbxDataType eType = rDef.GetType();
- short nSize = 0;
if( bAsNewAlreadyParsed || Peek() == AS )
{
+ short nSize = 0;
if( !bAsNewAlreadyParsed )
Next();
rDef.SetDefinedAs();
@@ -124,14 +126,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( '.' );
@@ -153,13 +155,13 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
}
}
}
- else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
+ else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && VBAConstantHelper::instance().isVBAConstantType( aCompleteName ) ) )
{
eType = SbxLONG;
break;
}
- // In den String-Pool uebernehmen
+ // Take over in the String pool
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
if( rDef.IsNew() && pProc == NULL )
@@ -175,7 +177,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 )
@@ -188,7 +190,7 @@ 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()
@@ -206,15 +208,15 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
Error( SbERR_NOT_IN_SUBR, eCurTok );
if( eCurTok == PUBLIC || eCurTok == GLOBAL )
{
- bSwitchPool = TRUE; // im richtigen Moment auf globalen Pool schalten
+ bSwitchPool = TRUE; // at the right moment switch to the global pool
if( eCurTok == GLOBAL )
bPersistantGlobal = TRUE;
}
- // behavior in VBA is that a module scope variable's lifetime is
+ // 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 )
+ if( GetBasic()->IsDocBasic() && bVBASupportOn && !pProc )
bPersistantGlobal = TRUE;
- // PRIVATE ist Synonym fuer DIM
+ // PRIVATE is a synonymous for DIM
// _CONST_?
BOOL bConst = FALSE;
if( eCurTok == _CONST_ )
@@ -236,7 +238,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
}
else if( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY )
{
- // End global chain if necessary (not done in
+ // End global chain if necessary (not done in
// SbiParser::Parse() under these conditions
if( bNewGblDefs && nGblChain == 0 )
{
@@ -272,13 +274,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();
@@ -290,23 +292,23 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
SbiSymDef* pDef;
SbiDimList* pDim;
- // AB 9.7.97, #40689, Statics -> Modul-Initialisierung, in Sub ueberspringen
+ // From 1997-07-09, #40689, Statics -> Modul-Initialising, skip in Sub
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;
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
+ // From 1996-03-31, #25651#, search also in the Runtime-Library
BOOL bRtlSym = FALSE;
if( !pOld )
{
@@ -322,10 +324,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
if( pOld )
{
bDefined = TRUE;
- // Bei RTL-Symbol immer Fehler
+ // 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() )
@@ -347,19 +349,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;
+ 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
+ // From 1997-07-09, #40689, no own Opcode anymore
if( bVBASupportOn && bStatic )
{
eOp2 = _STATIC;
@@ -385,8 +387,8 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
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() )
{
@@ -429,14 +431,17 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
aExpr.Gen();
SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
- aGen.Gen( _SET );
+ if ( bVBASupportOn )
+ aGen.Gen( _VBASET );
+ else
+ aGen.Gen( _SET );
}
}
else
{
if( bConst )
{
- // Konstanten-Definition
+ // Definition of the constants
if( pDim )
{
Error( SbERR_SYNTAX );
@@ -444,13 +449,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; // From 1996-06-24 (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 );
@@ -464,8 +469,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 );
@@ -495,14 +500,14 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
}
}
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; // From 1996-06-24 (see below)
+
+ // #27963# From 1996-06-24
+ // 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
MyBreak:
@@ -510,21 +515,21 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
break;
}
- // AB 9.7.97, #40689, Sprung ueber Statics-Deklaration abschliessen
+ // From 1997-07-09, #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;
- // 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()
{
@@ -544,7 +549,7 @@ void SbiParser::Erase()
}
}
-// Deklaration eines Datentyps
+// Declaration of a data type
void SbiParser::Type()
{
@@ -556,7 +561,7 @@ void SbiParser::DefType( 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;
@@ -592,7 +597,7 @@ void SbiParser::DefType( BOOL bPrivate )
pDim = NULL;
pElem = VarDecl(&pDim,FALSE,FALSE);
if( !pElem )
- bDone = TRUE; // Error occured
+ bDone = TRUE; // Error occurred
}
if( pElem )
{
@@ -678,7 +683,7 @@ void SbiParser::Enum()
void SbiParser::DefEnum( BOOL bPrivate )
{
- // Neues Token lesen, es muss ein Symbol sein
+ // Read a the new Token. It had to be a symbol
if (!TestSymbol())
return;
@@ -724,14 +729,14 @@ void SbiParser::DefEnum( BOOL bPrivate )
pElem = VarDecl( &pDim, FALSE, TRUE );
if( !pElem )
{
- bDone = TRUE; // Error occured
+ bDone = TRUE; // Error occurred
break;
}
else if( pDim )
{
delete pDim;
Error( SbERR_SYNTAX );
- bDone = TRUE; // Error occured
+ bDone = TRUE; // Error occurred
break;
}
@@ -761,7 +766,7 @@ void SbiParser::DefEnum( BOOL bPrivate )
if( pOld )
{
Error( SbERR_VAR_DEFINED, pElem->GetName() );
- bDone = TRUE; // Error occured
+ bDone = TRUE; // Error occurred
break;
}
@@ -769,7 +774,7 @@ void SbiParser::DefEnum( BOOL bPrivate )
if( !bPrivate )
{
- SbiOpcode eOp = _GLOBAL;
+ SbiOpcode eOp = _GLOBAL;
aGen.BackChain( nGblChain );
nGblChain = 0;
bGblDefs = bNewGblDefs = TRUE;
@@ -805,8 +810,8 @@ 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 )
@@ -840,7 +845,7 @@ 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() )
@@ -853,7 +858,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
}
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() )
@@ -861,7 +866,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
pDef->SetCdecl( FALSE );
pDef->GetAlias().Erase();
}
- // Klammern?
+ // Brackets?
if( Peek() == LPAREN )
{
Next();
@@ -959,14 +964,14 @@ void SbiParser::DefDeclare( BOOL bPrivate )
{
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;
@@ -1046,11 +1051,27 @@ void SbiParser::DefDeclare( BOOL bPrivate )
}
}
-// Aufruf einer SUB oder FUNCTION
+void SbiParser::Attribute()
+{
+ // TODO: Need to implement the method as an attributed object.
+ while( Next() != EQ )
+ {
+ if( Next() != DOT)
+ break;
+ }
+
+ if( eCurTok != EQ )
+ Error( SbERR_SYNTAX );
+ else
+ SbiExpression aValue( this );
+
+ // Don't generate any code - just discard it.
+}
+
+// Call of a SUB or a FUNCTION
void SbiParser::Call()
{
- String aName( aSym );
SbiExpression aVar( this, SbSYMBOL );
aVar.Gen( FORCE_CALL );
aGen.Gen( _GET );
@@ -1063,7 +1084,7 @@ void SbiParser::SubFunc()
DefProc( FALSE, FALSE );
}
-// Einlesen einer Prozedur
+// Read in of a procedure
BOOL runsInSetup( void );
@@ -1092,7 +1113,7 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate )
return;
pDef->setPropertyMode( ePropertyMode );
- // Ist die Proc bereits deklariert?
+ // Is the Proc already declared?
SbiSymDef* pOld = aPublics.Find( pDef->GetName() );
if( pOld )
{
@@ -1101,7 +1122,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;
@@ -1134,8 +1155,8 @@ 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 )
@@ -1149,7 +1170,7 @@ void SbiParser::DefProc( BOOL bStatic, BOOL bPrivate )
{
pProc->SetStatic( FALSE );
}
- // Normalfall: Lokale Variable->Parameter->Globale Variable
+ // Normal case: Local variable->parameter->global variable
pProc->GetLocals().SetParent( &pProc->GetParams() );
pPool = &pProc->GetLocals();
@@ -1161,7 +1182,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 );
@@ -1182,7 +1203,7 @@ void SbiParser::DefStatic( BOOL bPrivate )
case SUB:
case FUNCTION:
case PROPERTY:
- // End global chain if necessary (not done in
+ // End global chain if necessary (not done in
// SbiParser::Parse() under these conditions
if( bNewGblDefs && nGblChain == 0 )
{
@@ -1195,8 +1216,8 @@ void SbiParser::DefStatic( BOOL bPrivate )
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 );
pPool = p;
@@ -1204,3 +1225,4 @@ void SbiParser::DefStatic( BOOL bPrivate )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index ea2dd286da..e38a072808 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,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
@@ -64,7 +65,7 @@ static OpTable aOpTable [] = {
{ IS, _IS },
{ NIL, _NOP }};
-// Ausgabe eines Elements
+// Output of an element
void SbiExprNode::Gen( RecursiveMode eRecMode )
{
if( IsConstant() )
@@ -108,10 +109,10 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
eOp = aVar.pDef->IsGlobal() ? _FIND_G : _FIND;
}
}
- // AB: 17.12.1995, Spezialbehandlung fuer WITH
+ // From 1995-12-17, special treatment for WITH
else if( (pWithParent_ = GetWithParent()) != NULL )
{
- eOp = _ELEM; // .-Ausdruck in WITH
+ eOp = _ELEM; // .-Term in in WITH
}
else
{
@@ -162,7 +163,7 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
}
}
-// Ausgabe eines Operanden-Elements
+// Output of an operand element
void SbiExprNode::GenElement( SbiOpcode eOp )
{
@@ -171,11 +172,11 @@ 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.
+ // The ID is either the position or the String-ID
+ // If the bit Bit 0x8000 is set, the variable have
+ // a parameter list.
USHORT nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId();
- // Parameterliste aufbauen
+ // Build a parameter list
if( aVar.pPar && aVar.pPar->GetSize() )
{
nId |= 0x8000;
@@ -197,9 +198,9 @@ 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()
{
@@ -222,7 +223,7 @@ void SbiExprList::Gen()
// AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
if( pProc )
{
- // Vorerst: Error ausloesen
+ // For the present: trigger an error
pParser->Error( SbERR_NO_NAMED_ARGS );
// Spaeter, wenn Named Args bei DECLARE moeglich
@@ -253,8 +254,8 @@ 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
+ // From 1995-12-17, special treatment for WITH
+ // If pExpr == .-term in With, approximately Gen for Basis-Object
pExpr->Gen( eRecMode );
if( bByVal )
pParser->aGen.Gen( _BYVAL );
@@ -268,3 +269,4 @@ void SbiExpression::Gen( RecursiveMode eRecMode )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index bf891bc5a2..01e7b74eb7 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,7 +52,7 @@ 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;
}
@@ -85,7 +86,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiEx
aVar.pvMorePar = NULL;
aVar.pNext= NULL;
- // Funktionsergebnisse sind nie starr
+ // Results of functions are at no time fixed
bComposite= BOOL( aVar.pDef->GetProcDef() != NULL );
}
@@ -110,7 +111,12 @@ SbiExprNode::SbiExprNode( SbiParser* p, USHORT nId )
nTypeStrId = nId;
}
-// AB: 17.12.95, Hilfsfunktion fuer Ctor fuer einheitliche Initialisierung
+ eType = SbxOBJECT;
+ eNodeType = SbxNEW;
+ nTypeStrId = nId;
+}
+
+// From 1995-12-17, auxiliary function for Ctor for the uniform initialisation
void SbiExprNode::BaseInit( SbiParser* p )
{
pGen = &p->aGen;
@@ -158,7 +164,7 @@ SbiSymDef* SbiExprNode::GetRealVar()
return NULL;
}
-// AB: 18.12.95
+// From 1995-12-18
SbiExprNode* SbiExprNode::GetRealNode()
{
if( eNodeType == SbxVARVAL )
@@ -172,7 +178,7 @@ 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()
{
@@ -212,7 +218,7 @@ BOOL SbiExprNode::IsLvalue()
return IsVariable();
}
-// Ermitteln der Tiefe eines Baumes
+// Identify of the depth of a tree
short SbiExprNode::GetDepth()
{
@@ -226,11 +232,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()
{
@@ -238,7 +244,7 @@ void SbiExprNode::Optimize()
CollectBits();
}
-// Hochziehen der Composite- und Fehlerbits
+// Lifting of the composite- and error-bits
void SbiExprNode::CollectBits()
{
@@ -256,8 +262,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()
{
@@ -272,10 +278,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 )
{
@@ -287,7 +293,7 @@ void SbiExprNode::FoldConstants()
if( eTok == PLUS || eTok == CAT )
{
eTok = CAT;
- // Verkettung:
+ // Linking:
aStrVal = rl;
aStrVal += rr;
eType = SbxSTRING;
@@ -333,7 +339,7 @@ void SbiExprNode::FoldConstants()
if( ( eTok >= AND && eTok <= IMP )
|| eTok == IDIV || eTok == MOD )
{
- // Integer-Operationen
+ // Integer operations
BOOL err = FALSE;
if( nl > SbxMAXLNG ) err = TRUE, nl = SbxMAXLNG;
else
@@ -427,12 +433,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 )
@@ -454,7 +459,7 @@ void SbiExprNode::FoldConstants()
case NEG:
nVal = -nVal; break;
case NOT: {
- // Integer-Operation!
+ // Integer operation!
BOOL err = FALSE;
if( nVal > SbxMAXLNG ) err = TRUE, nVal = SbxMAXLNG;
else
@@ -472,7 +477,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;
@@ -486,3 +491,4 @@ void SbiExprNode::FoldConstants()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index ec86ae075f..9b45590a60 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -127,7 +128,7 @@ static BOOL DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTo
if ( tokens.Peek() == ASSIGN )
return TRUE;
}
- return FALSE;
+ return FALSE;
}
// Definition eines neuen Symbols
@@ -373,8 +374,12 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// Typ SbxOBJECT sein
if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
{
- pParser->Error( SbERR_BAD_DECLARATION, aSym );
- bError = TRUE;
+ // defer error until runtime if in vba mode
+ if ( !pParser->IsVBASupportOn() )
+ {
+ pParser->Error( SbERR_BAD_DECLARATION, aSym );
+ bError = TRUE;
+ }
}
if( !bError )
pNd->aVar.pNext = ObjTerm( *pDef );
@@ -763,7 +768,7 @@ SbiExprNode* SbiExpression::Like()
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
// Mehrere Operatoren hintereinander gehen nicht
- if( nCount > 1 )
+ if( nCount > 1 && !pParser->IsVBASupportOn() )
{
pParser->Error( SbERR_SYNTAX );
bError = TRUE;
@@ -1161,3 +1166,4 @@ SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
else pParser->Next();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx
index c7ed83c677..3c750dac00 100644
--- a/basic/source/comp/io.cxx
+++ b/basic/source/comp/io.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -356,3 +357,4 @@ void SbiParser::Close()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index 20480ec45c..10284fb580 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -556,3 +557,4 @@ void SbiParser::Resume()
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 83e7bbd604..1e8e7b2cee 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,6 +50,7 @@ struct SbiStatement {
#define N FALSE
static SbiStatement StmntTable [] = {
+{ ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE
{ CALL, &SbiParser::Call, N, Y, }, // CALL
{ CLOSE, &SbiParser::Close, N, Y, }, // CLOSE
{ _CONST_, &SbiParser::Dim, Y, Y, }, // CONST
@@ -387,6 +389,18 @@ BOOL SbiParser::Parse()
Next(); return TRUE;
}
+ // In vba it's possible to do Error.foobar ( even if it results in
+ // a runtime error
+ if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
+ {
+ SbiTokenizer tokens( *(SbiTokenizer*)this );
+ tokens.Next();
+ if ( tokens.Peek() == DOT )
+ {
+ eCurTok = SYMBOL;
+ ePush = eCurTok;
+ }
+ }
// Kommt ein Symbol, ist es entweder eine Variable( LET )
// oder eine SUB-Prozedur( CALL ohne Klammern )
// DOT fuer Zuweisungen im WITH-Block: .A=5
@@ -795,7 +809,7 @@ void SbiParser::Option()
bClassModule = TRUE;
aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS );
break;
- case VBASUPPORT:
+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
if( Next() == NUMBER )
{
if ( nVal == 1 || nVal == 0 )
@@ -861,3 +875,4 @@ void SbiParser::ErrorStmnt()
aGen.Gen( _ERROR );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index 512fc6f694..5f8d90e920 100755
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -582,7 +583,7 @@ void dbg_SaveDisassembly( SbModule* pModule )
if( xSMgr.is() )
{
Reference< XSimpleFileAccess3 > xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
if( xSFI.is() )
{
String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/zBasic.Asm/Asm_") );
@@ -599,7 +600,7 @@ void dbg_SaveDisassembly( SbModule* pModule )
if( xSFI->exists( aFile ) )
xSFI->kill( aFile );
xOut = xSFI->openFileWrite( aFile );
- Reference< XInterface > x = xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.io.TextOutputStream" ) );
+ Reference< XInterface > x = xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TextOutputStream" )) );
Reference< XActiveDataSource > xADS( x, UNO_QUERY );
xADS->setOutputStream( xOut );
xTextOut = Reference< XTextOutputStream >( x, UNO_QUERY );
@@ -694,3 +695,4 @@ void StarBASIC::Highlight( const String& rSrc, SbTextPortions& rList )
aTok.Hilite( rList );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index a6a389026c..bebdf82d61 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -604,3 +605,5 @@ bool LetterTable::isLetterUnicode( sal_Unicode c )
bool bRet = pCharClass->isLetter( aStr, 0 );
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 7f6db9cd38..62e70d6f5a 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -535,3 +536,4 @@ SbiConstDef* SbiConstDef::GetConstDef()
return this;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 00690796a7..b0bb367210 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,6 +59,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ ANY, "Any" },
{ APPEND, "Append" },
{ AS, "As" },
+ { ATTRIBUTE,"Attribute" },
{ BASE, "Base" },
{ BINARY, "Binary" },
{ TBOOLEAN, "Boolean" },
@@ -712,3 +714,4 @@ void SbiTokenizer::Hilite( SbTextPortions& rList )
bUsedForHilite = FALSE;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx
index 8ec5cdf85f..e66fa80f21 100644
--- a/basic/source/inc/buffer.hxx
+++ b/basic/source/inc/buffer.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index c9dd546d43..3b1dd88eb7 100644
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -90,3 +91,5 @@ public:
#define PARAM_INFO_PARAMARRAY 0x0010000
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx
index 5ea7348fbf..b7904df3bf 100644
--- a/basic/source/inc/collelem.hxx
+++ b/basic/source/inc/collelem.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,3 +46,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx
index e3abac76a6..f7e463bdd2 100644
--- a/basic/source/inc/disas.hxx
+++ b/basic/source/inc/disas.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -70,3 +71,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index 7d22f4d64c..e779a3200f 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include "namecont.hxx"
-#ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCESUPPLIER_HPP_
#include <com/sun/star/resource/XStringResourceSupplier.hpp>
-#endif
#include "com/sun/star/resource/XStringResourcePersistence.hpp"
#include <cppuhelper/implbase1.hxx>
@@ -96,7 +95,9 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException);
-
+ // XLibraryQueryExecutable
+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
+ throw (::com::sun::star::uno::RuntimeException);
// Service
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
static ::rtl::OUString getImplementationName_static();
@@ -173,3 +174,4 @@ protected:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index 2de0f121b4..ee886e8df0 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -265,3 +266,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx
index 7fab709849..7bfb1f0dd9 100644
--- a/basic/source/inc/filefmt.hxx
+++ b/basic/source/inc/filefmt.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -176,3 +177,5 @@ ULONG SbOpenRecord( SvStream&, UINT16 nSignature, UINT16 nElem );
void SbCloseRecord( SvStream&, ULONG );
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 35715b4d38..fcd1f58b57 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _SBIMAGE_HXX
#include "sbintern.hxx"
-#ifndef _RTL_USTRING_HXX
#include <rtl/ustring.hxx>
-#endif
#include <filefmt.hxx>
// Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet
@@ -108,3 +107,5 @@ public:
#define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx
index 50f7b01dcf..025ef857b4 100644
--- a/basic/source/inc/iosys.hxx
+++ b/basic/source/inc/iosys.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _SBIOSYS_HXX
#include <tools/stream.hxx>
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
class SvStream;
@@ -111,3 +110,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 72cdcee2da..b9c54465ec 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -133,45 +134,45 @@ public:
{ mpxEventSource = pxEventSource; }
// Methods XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements( )
+ virtual sal_Bool SAL_CALL hasElements( )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::lang::WrappedTargetException,
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
};
@@ -256,21 +257,21 @@ protected:
void implStoreLibrary( SfxLibrary* pLib,
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const ::rtl::OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
- void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
+ void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
// New variant for library export
- void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
+ void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const ::rtl::OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI );
sal_Bool implLoadLibraryIndexFile( SfxLibrary* pLib,
- ::xmlscript::LibDescriptor& rLib,
+ ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& aIndexFileName );
@@ -279,7 +280,7 @@ protected:
// Methods to distinguish between deffirent library types
virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ) = 0;
virtual SfxLibrary* SAL_CALL implCreateLibraryLink
- ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
+ ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) = 0;
virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0;
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
@@ -300,24 +301,24 @@ protected:
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0;
// Password encryption
- virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
// New variant for library export
- virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const ::rtl::OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
- sal_Bool bVerifyPasswordOnly=false )
- throw(::com::sun::star::lang::WrappedTargetException,
+ sal_Bool bVerifyPasswordOnly=false )
+ throw(::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
virtual void onNewRootStorage() = 0;
- // #56666, Creates another library container
+ // #56666, Creates another library container
// instance of the same derived class
virtual SfxLibraryContainer* createInstanceImpl( void ) = 0;
@@ -337,8 +338,8 @@ protected:
// Handle maLibInfoFileURL and maStorageURL correctly
void checkStorageURL
(
- const ::rtl::OUString& aSourceURL,
- ::rtl::OUString& aLibInfoFileURL,
+ const ::rtl::OUString& aSourceURL,
+ ::rtl::OUString& aLibInfoFileURL,
::rtl::OUString& aStorageURL,
::rtl::OUString& aUnexpandedStorageURL
);
@@ -368,11 +369,11 @@ private:
public:
SfxLibraryContainer( void );
~SfxLibraryContainer();
-
+
// Interface to set the BasicManager (Hack for password implementation)
void setBasicManager( BasicManager* pBasMgr )
- {
+ {
mpBasMgr = pBasMgr;
}
@@ -384,17 +385,17 @@ public:
// Methods XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements()
+ virtual sal_Bool SAL_CALL hasElements()
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Members XStorageBasedLibraryContainer
@@ -420,84 +421,84 @@ public:
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
- virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName )
- throw (::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::container::ElementExistException,
+ virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainer (base of XLibraryContainer2)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL
- createLibrary( const ::rtl::OUString& Name )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL
+ createLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL createLibraryLink
- ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
+ ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& aArguments )
- throw (::com::sun::star::uno::Exception,
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainerPassword
- virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
- const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
+ const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainerExport
- virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw (::com::sun::star::uno::Exception,
- ::com::sun::star::container::NoSuchElementException,
+ virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XServiceInfo
@@ -623,51 +624,51 @@ public:
virtual void SAL_CALL release() throw() { OComponentHelper::release(); }
// Methods XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements( )
+ virtual sal_Bool SAL_CALL hasElements( )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::lang::WrappedTargetException,
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
throw( ::com::sun::star::uno::RuntimeException );
- ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( )
+ ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( )
throw( ::com::sun::star::uno::RuntimeException );
// Methods XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
public:
@@ -732,7 +733,7 @@ protected:
implGetNextBundledScriptPackage( bool& rbPureDialogLib );
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
-
+
IteratorState m_eState;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
@@ -764,3 +765,4 @@ protected:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx
index 3de6ff8ee8..bd659bbafe 100644
--- a/basic/source/inc/object.hxx
+++ b/basic/source/inc/object.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _SAMPLE_OBJECT_HXX
#include <basic/sbxfac.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
#include <basic/sbxobj.hxx>
// 1) Properties:
@@ -98,3 +97,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx
index 9eb1a27c8f..0481051df8 100644
--- a/basic/source/inc/opcodes.hxx
+++ b/basic/source/inc/opcodes.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -170,3 +171,5 @@ enum SbiOpcode {
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index d83bc3c68c..0fcd794dae 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -107,6 +108,7 @@ public:
void BadSyntax(); // Falsches SbiToken
void NoIf(); // ELSE/ELSE IF ohne IF
void Assign(); // LET
+ void Attribute(); // Attribute
void Call(); // CALL
void Close(); // CLOSE
void Declare(); // DECLARE
@@ -151,3 +153,5 @@ public:
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 4fc67883aa..938796ba39 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,19 +31,10 @@
#include <svl/svarray.hxx>
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
#include <com/sun/star/beans/XPropertyAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
#include <com/sun/star/beans/XPropertyContainer.hpp>
-#endif
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -201,3 +193,4 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 3bab07fe03..b6b92017f8 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
#ifndef _SBRUNTIME_HXX
#define _SBRUNTIME_HXX
-#ifndef _SBX_HXX
#include <basic/sbx.hxx>
-#endif
#include "sb.hxx"
@@ -59,11 +58,6 @@ using namespace com::sun::star::container;
// #define _OLD_FILE_IMPL
-//#include <sal/types.h>
-//#include <rtl/byteseq.hxx>
-//#include <rtl/ustring>
-
-
namespace basicEncoder
{
@@ -203,7 +197,6 @@ class SbiInstance
BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
ComponentVector_t ComponentVector;
-
public:
SbiRuntime* pRun; // Call-Stack
SbiInstance* pNext; // Instanzen-Chain
@@ -294,7 +287,9 @@ class SbiRuntime
SbxArrayRef refExprStk; // expression stack
SbxArrayRef refCaseStk; // CASE expression stack
SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
+ SbxVariableRef refRedim; // Array saved to use for REDIM
SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
+ SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
SbiArgvStack* pArgvStk; // ARGV-Stack
SbiGosubStack* pGosubStk; // GOSUB stack
SbiForStack* pForStk; // FOR/NEXT-Stack
@@ -464,6 +459,7 @@ public:
SbMethod* GetCaller();
SbxArray* GetLocals();
SbxArray* GetParams();
+ SbxVariable* GetExternalCaller(){ return mpExtCaller; }
SbxBase* FindElementExtern( const String& rName );
static bool isVBAEnabled();
@@ -530,3 +526,4 @@ bool IsBaseIndexOne();
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx
index 7adbfeafcf..f1cb29a4bc 100644
--- a/basic/source/inc/sbcomp.hxx
+++ b/basic/source/inc/sbcomp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,3 +37,5 @@
#include "codegen.hxx" // Code-Generator
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 00621e2c21..6c00a999c1 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -148,3 +149,4 @@ SbiGlobals* GetSbData();
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx
index b5abb18e8b..fe85699998 100644
--- a/basic/source/inc/sbjsmeth.hxx
+++ b/basic/source/inc/sbjsmeth.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,3 +52,5 @@ SV_DECL_IMPL_REF(SbJScriptMethod)
#endif
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
index b809803888..b7a754b314 100644
--- a/basic/source/inc/sbjsmod.hxx
+++ b/basic/source/inc/sbjsmod.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -48,3 +49,4 @@ public:
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 11d3299cb8..5b25c4787a 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,7 @@
#include <basic/sbxmeth.hxx>
#include <basic/sbxprop.hxx>
#include <basic/sbxfac.hxx>
-#ifndef __SBX_SBX_HXX //autogen
#include <basic/sbx.hxx>
-#endif
#include <com/sun/star/beans/XMaterialHolder.hpp>
#include <com/sun/star/beans/XExactName.hpp>
#include <com/sun/star/beans/XIntrospectionAccess.hpp>
@@ -43,6 +42,7 @@
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
#include <rtl/ustring.hxx>
+#include <hash_map>
class SbUnoObject: public SbxObject
{
@@ -272,7 +272,7 @@ public:
};
-// #112509 Special SbxArray to transport named parameters for calls
+// #112509 Special SbxArray to transport named parameters for calls
// to OLEAutomation objects through the UNO OLE automation bridge
class AutomationNamedArgsSbxArray : public SbxArray
@@ -333,6 +333,27 @@ public:
virtual void Clear();
};
+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+
+typedef std::vector< rtl::OUString > VBAConstantsVector;
+
+class VBAConstantHelper
+{
+private:
+
+ VBAConstantsVector aConstCache;
+ VBAConstantsHash aConstHash;
+ bool isInited;
+ VBAConstantHelper():isInited( false ) {}
+ VBAConstantHelper(const VBAConstantHelper&);
+ void init();
+public:
+ static VBAConstantHelper& instance();
+ SbxVariable* getVBAConstant( const String& rName );
+ bool isVBAConstantType( const String& rName );
+};
+
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index 099f9836fb..aa9aa82086 100644
--- a/basic/source/inc/scanner.hxx
+++ b/basic/source/inc/scanner.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _SCANNER_HXX
#include <tools/string.hxx>
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
// Der Scanner ist stand-alone, d.h. er kann von ueberallher verwendet
// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne
@@ -144,3 +143,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 789f9da7b4..42a13d4f3b 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -123,7 +124,9 @@ public:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
-
+ // XLibraryQueryExecutable
+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
+ throw (::com::sun::star::uno::RuntimeException);
// Methods XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( )
throw (::com::sun::star::uno::RuntimeException);
@@ -198,3 +201,4 @@ protected:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx
index 020b47e8f5..3dd28c4e35 100644
--- a/basic/source/inc/stdobj.hxx
+++ b/basic/source/inc/stdobj.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,3 +50,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index fd0906e022..a36fcfafb5 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -248,3 +249,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index 7c3ff75332..333a20e10e 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _TOKEN_HXX
#include "scanner.hxx"
-#ifndef _SBDEF_HXX
#include <basic/sbdef.hxx>
-#endif
#if defined( SHARED )
#define SbiTokenSHAREDTMPUNDEF
@@ -72,7 +71,7 @@ enum SbiToken {
IF, _IN_, INPUT,
LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET,
NAME, NEW, NEXT,
- ON, OPEN, OPTION, IMPLEMENTS,
+ ON, OPEN, OPTION, ATTRIBUTE, IMPLEMENTS,
PRINT, PRIVATE, PROPERTY, PUBLIC,
REDIM, REM, RESUME, RETURN, RSET,
SELECT, SET, SHARED, STATIC, STEP, STOP, SUB,
@@ -181,3 +180,5 @@ public:
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index 329a8df3e5..affad8d499 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -102,3 +103,4 @@ void BasicDLL::BasicBreak()
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index e36fd66cb5..38f7fbee5c 100644
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <tools/errcode.hxx>
#include <svl/svdde.hxx>
#include "ddectrl.hxx"
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
#define DDE_FREECHANNEL ((DdeConnection*)0xffffffff)
@@ -190,3 +189,4 @@ SbError SbiDdeControl::Poke( INT16 nChannel, const String& rItem, const String&
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx
index 66f73d4330..e8dd108854 100644
--- a/basic/source/runtime/ddectrl.hxx
+++ b/basic/source/runtime/ddectrl.hxx
@@ -1,3 +1,4 @@
+/* -*- 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,9 +30,7 @@
#define _DDECTRL_HXX
#include <tools/link.hxx>
-#ifndef _SBERRORS_HXX
#include <basic/sberrors.hxx>
-#endif
#include <tools/string.hxx>
class DdeConnection;
@@ -62,3 +61,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx
new file mode 100644
index 0000000000..db32b646b6
--- /dev/null
+++ b/basic/source/runtime/dllmgr-none.cxx
@@ -0,0 +1,64 @@
+/* -*- 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"
+
+#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 "tools/svwin.h"
+
+#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..aa3ce5ea3e
--- /dev/null
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -0,0 +1,772 @@
+/* -*- 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"
+
+#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 "tools/svwin.h"
+
+#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 (USHORT 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< INT32 > low(dims);
+ for (int i = 0; i < dims; ++i) {
+ 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());
+ *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 (USHORT 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< INT32 > low(dims);
+ std::vector< INT32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< 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 (USHORT 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< INT32 > low(dims);
+ std::vector< INT32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< 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-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
new file mode 100644
index 0000000000..09aee07fc9
--- /dev/null
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -0,0 +1,722 @@
+/* -*- 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"
+
+#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 "tools/svwin.h"
+
+#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.
+*/
+
+extern "C" {
+
+int __stdcall DllMgr_call32(FARPROC, void const * stack, std::size_t size);
+double __stdcall DllMgr_callFp(FARPROC, void const * stack, std::size_t size);
+
+}
+
+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 (USHORT 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< INT32 > low(dims);
+ for (int i = 0; i < dims; ++i) {
+ 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());
+ *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 (USHORT 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< INT32 > low(dims);
+ std::vector< INT32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< 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 ? 4 : 2, offset);
+ break;
+ case SbxLONG:
+ add(blob, variable->GetLong(), 4, offset);
+ break;
+ case SbxSINGLE:
+ add(blob, variable->GetSingle(), 4, offset);
+ break;
+ case SbxDOUBLE:
+ add(blob, variable->GetDouble(), outer ? 4 : 8, offset);
+ break;
+ case SbxSTRING:
+ {
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(blob, p, 4, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ align(blob, outer ? 4 : 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 ? 4 : 1, offset);
+ break;
+ case SbxBYTE:
+ add(blob, variable->GetByte(), outer ? 4 : 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(), 4, 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, 4, 0);
+ add(blob, address(*blob2), 4, 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, 4, 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, 4, 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 (USHORT 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< INT32 > low(dims);
+ std::vector< INT32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< 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)
+{
+ 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 (USHORT 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, 4, 0, 0);
+ }
+ switch (result.GetType()) {
+ case SbxEMPTY:
+ DllMgr_call32(proc.proc, address(stack), stack.size());
+ break;
+ case SbxINTEGER:
+ result.PutInteger(
+ static_cast< sal_Int16 >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxLONG:
+ result.PutLong(
+ static_cast< sal_Int32 >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxSINGLE:
+ result.PutSingle(
+ static_cast< float >(
+ DllMgr_callFp(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxDOUBLE:
+ result.PutDouble(
+ DllMgr_callFp(proc.proc, address(stack), stack.size()));
+ break;
+ case SbxSTRING:
+ {
+ char const * s1 = reinterpret_cast< char const * >(
+ DllMgr_call32(proc.proc, address(stack), stack.size()));
+ 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
+ DllMgr_call32(proc.proc, address(stack), stack.size());
+ break;
+ case SbxBOOL:
+ result.PutBool(
+ static_cast< sal_Bool >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxBYTE:
+ result.PutByte(
+ static_cast< sal_uInt8 >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ for (USHORT 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.hxx b/basic/source/runtime/dllmgr.hxx
index fdff8c2849..1507ffe7f9 100644
--- a/basic/source/runtime/dllmgr.hxx
+++ b/basic/source/runtime/dllmgr.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,3 +59,5 @@ private:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 7afad32a3e..389e5835d1 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
-#ifndef _SV_BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
#include <vcl/fixed.hxx>
#include <vcl/edit.hxx>
#include <vcl/dialog.hxx>
@@ -195,3 +194,4 @@ RTLFUNC(InputBox)
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index c656767d03..59c078710e 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,15 +30,13 @@
#include "precompiled_basic.hxx"
#include <vcl/dialog.hxx>
#include <vcl/edit.hxx>
-#ifndef _SV_BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <osl/security.h>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include "runtime.hxx"
@@ -68,7 +67,6 @@
#include <com/sun/star/bridge/XBridgeFactory.hpp>
using namespace comphelper;
-using namespace osl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
@@ -252,7 +250,7 @@ BOOL needSecurityRestrictions( void )
if( !xSMgr.is() )
return 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;
@@ -323,10 +321,10 @@ BOOL hasUno( void )
}
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;
@@ -345,7 +343,7 @@ BOOL hasUno( void )
class OslStream : public SvStream
{
- File maFile;
+ osl::File maFile;
short mnStrmMode;
public:
@@ -366,25 +364,25 @@ 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;
}
- FileBase::RC nRet = maFile.open( nFlags );
- if( nRet == FileBase::E_NOENT && nFlags != OpenFlag_Read )
+ osl::FileBase::RC nRet = maFile.open( nFlags );
+ if( nRet == osl::FileBase::E_NOENT && nFlags != osl_File_OpenFlag_Read )
{
- nFlags |= OpenFlag_Create;
+ nFlags |= osl_File_OpenFlag_Create;
nRet = maFile.open( nFlags );
}
- if( nRet != FileBase::E_None )
+ if( nRet != osl::FileBase::E_None )
{
SetError( ERRCODE_IO_GENERAL );
}
@@ -399,32 +397,25 @@ OslStream::~OslStream()
ULONG OslStream::GetData( void* pData, ULONG nSize )
{
sal_uInt64 nBytesRead = nSize;
- FileBase::RC nRet = FileBase::E_None;
- nRet = maFile.read( pData, nBytesRead, nBytesRead );
+ maFile.read( pData, nBytesRead, nBytesRead );
return (ULONG)nBytesRead;
}
ULONG OslStream::PutData( const void* pData, ULONG nSize )
{
sal_uInt64 nBytesWritten;
- FileBase::RC nRet = FileBase::E_None;
- nRet = maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
+ maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
return (ULONG)nBytesWritten;
}
ULONG OslStream::SeekPos( ULONG nPos )
{
- 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 );
+ maFile.setPos( Pos_Absolut, (sal_uInt64)nPos );
+ sal_uInt64 nRealPos(0);
+ maFile.getPos( nRealPos );
return sal::static_int_cast<ULONG>(nRealPos);
}
@@ -434,8 +425,7 @@ void OslStream::FlushData()
void OslStream::SetSize( ULONG nSize )
{
- FileBase::RC nRet = FileBase::E_None;
- nRet = maFile.setSize( (sal_uInt64)nSize );
+ maFile.setSize( (sal_uInt64)nSize );
}
#endif
@@ -662,7 +652,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
@@ -1037,7 +1027,7 @@ void SbiIoSystem::WriteCon( const ByteString& rText )
aOut.Erase( 0, 1 );
String aStr( s, gsl_getSystemTextEncoding() );
{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aSolarGuard;
if( !MessBox( GetpApp()->GetDefDialogParent(),
WinBits( WB_OK_CANCEL | WB_DEF_OK ),
String(), aStr ).Execute() )
@@ -1046,3 +1036,4 @@ void SbiIoSystem::WriteCon( const ByteString& rText )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 49f0fceded..8ecf22555e 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,7 @@
#include <tools/date.hxx>
#include <basic/sbxvar.hxx>
-#ifndef _VOS_PROCESS_HXX
-#include <vos/process.hxx>
-#endif
+#include <osl/process.h>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/sound.hxx>
@@ -48,6 +47,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <tools/wldcrd.hxx>
#include <i18npool/lang.h>
+#include <rtl/string.hxx>
#include "runtime.hxx"
#include "sbunoobj.hxx"
@@ -55,9 +55,7 @@
#include <tools/prewin.h>
#include "winbase.h"
#include <tools/postwin.h>
-#ifndef _FSYS_HXX //autogen
#include <tools/fsys.hxx>
-#endif
#else
#include <osl/file.hxx>
#endif
@@ -75,13 +73,16 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-
+#include <com/sun/star/script/XErrorQuery.hpp>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
using namespace comphelper;
using namespace osl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
+using namespace com::sun::star::script;
#endif /* _USE_UNO */
@@ -701,6 +702,36 @@ RTLFUNC(MkDir) // JSM
{
try
{
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ // If aPath is the folder name, not a path, then create the folder under current directory.
+ INetURLObject aTryPathURL( aPath );
+ ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
+ if ( !sPathURL.getLength() )
+ {
+ File::getFileURLFromSystemPath( aPath, sPathURL );
+ }
+ INetURLObject aPathURL( sPathURL );
+ if ( !aPathURL.GetPath().getLength() )
+ {
+ ::rtl::OUString sCurDirURL;
+ SbxArrayRef pPar = new SbxArray;
+ SbxVariableRef pVar = new SbxVariable();
+ pPar->Put( pVar, 0 );
+ SbRtl_CurDir( pBasic, *pPar, FALSE );
+ String aCurPath = pPar->Get(0)->GetString();
+
+ File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
+ INetURLObject aDirURL( sCurDirURL );
+ aDirURL.Append( aPath );
+ ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
+ if ( aTmpPath.getLength() > 0 )
+ {
+ aPath = aTmpPath;
+ }
+ }
+ }
+
xSFI->createFolder( getFullPath( aPath ) );
}
catch( Exception & )
@@ -905,9 +936,9 @@ RTLFUNC(FileLen)
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 );
+ aItem.getFileStatus( aFileStatus );
nLen = (INT32)aFileStatus.getFileSize();
#endif
}
@@ -935,6 +966,26 @@ RTLFUNC(Hex)
}
}
+RTLFUNC(FuncCaller)
+{
+ (void)pBasic;
+ (void)bWrite;
+ if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
+ {
+ if ( pINST->pRun->GetExternalCaller() )
+ *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
+ else
+ {
+ SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
+ *rPar.Get(0) = *pVar;
+ }
+ }
+ else
+ {
+ StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
+ }
+
+}
// InStr( [start],string,string,[compare] )
RTLFUNC(InStr)
@@ -1339,13 +1390,13 @@ RTLFUNC(Oct)
}
}
-// Replace(expression, find, replace[, start[, count[, compare]]])
+// Replace(expression, find, replace[, start[, count[, compare]]])
RTLFUNC(Replace)
{
(void)pBasic;
(void)bWrite;
-
+
ULONG nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 6 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1375,7 +1426,7 @@ RTLFUNC(Replace)
if( lCount < -1 || lCount > 0xffff )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- lCount = -1;
+ lCount = -1;
}
}
@@ -1807,7 +1858,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
else if ( nYear < 100 )
nYear += 1900;
Date aCurDate( nDay, nMonth, nYear );
- if ((nYear < 100 || nYear > 9999) )
+ if ((nYear < 100 || nYear > 9999) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return FALSE;
@@ -1815,7 +1866,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
if ( !SbiRuntime::isVBAEnabled() )
{
if ( (nMonth < 1 || nMonth > 12 )||
- (nDay < 1 || nDay > 31 ) )
+ (nDay < 1 || nDay > 31 ) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return FALSE;
@@ -1825,7 +1876,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
{
// grab the year & month
aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear );
-
+
// adjust year based on month value
// e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year )
// 2000, 13, xx = 2001, 1, xx ( or January of the following year )
@@ -1846,7 +1897,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
aCurDate += nDay - 1;
else
aCurDate.SetDay( nDay );
- }
+ }
long nDiffDays = GetDayDiff( aCurDate );
rdRet = (double)nDiffDays;
@@ -1974,16 +2025,16 @@ RTLFUNC(DateValue)
String aStr( rPar.Get(1)->GetString() );
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
// by using SbiInstance::GetNumberFormatter.
- // It seems that both locale number formatter and English number formatter
+ // It seems that both locale number formatter and English number formatter
// are supported in Visual Basic.
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
if( !bSuccess && ( eLangType != LANGUAGE_ENGLISH_US ) )
{
// Create a new SvNumberFormatter by using LANGUAGE_ENGLISH to get the date value;
- 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, LANGUAGE_ENGLISH_US );
bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, fResult );
@@ -2406,7 +2457,18 @@ RTLFUNC(IsEmpty)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ {
+ SbxVariable* pVar = NULL;
+ if( SbiRuntime::isVBAEnabled() )
+ pVar = getDefaultProp( rPar.Get(1) );
+ if ( pVar )
+ {
+ pVar->Broadcast( SBX_HINT_DATAWANTED );
+ rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
+ }
+ else
+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ }
}
RTLFUNC(IsError)
@@ -2417,7 +2479,22 @@ RTLFUNC(IsError)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ {
+ SbxVariable* pVar =rPar.Get( 1 );
+ SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
+ if ( !pObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ Reference< XErrorQuery > xError;
+ if ( pObj )
+ xError.set( pObj->getUnoAny(), UNO_QUERY );
+ if ( xError.is() )
+ rPar.Get( 0 )->PutBool( xError->hasError() );
+ else
+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ }
}
RTLFUNC(IsNull)
@@ -2712,11 +2789,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++;
}
@@ -2874,11 +2951,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++;
}
@@ -2957,8 +3034,8 @@ RTLFUNC(GetAttr)
return;
}
- #endif
-
+ #endif
+
// <-- UCB
if( hasUno() )
{
@@ -2997,9 +3074,9 @@ RTLFUNC(GetAttr)
// --> 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;
@@ -3057,9 +3134,9 @@ RTLFUNC(FileDateTime)
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 );
@@ -3474,25 +3551,22 @@ RTLFUNC(Shell)
std::list<String>::const_iterator iter = aTokenList.begin();
const String& rStr = *iter;
::rtl::OUString aOUStrProg( rStr.GetBuffer(), rStr.Len() );
- String aOUStrProgUNC = getFullPathUNC( aOUStrProg );
+ ::rtl::OUString aOUStrProgUNC = getFullPathUNC( aOUStrProg );
- iter++;
+ ++iter;
USHORT nParamCount = sal::static_int_cast< USHORT >(
aTokenList.size() - 1 );
- ::rtl::OUString* pArgumentList = NULL;
- //const char** pParamList = NULL;
+ rtl_uString** pParamList = NULL;
if( nParamCount )
{
- pArgumentList = new ::rtl::OUString[ nParamCount ];
- //pParamList = new const char*[ nParamCount ];
- USHORT iList = 0;
- while( iter != aTokenList.end() )
+ pParamList = new rtl_uString*[nParamCount];
+ for(int iList = 0; iter != aTokenList.end(); ++iList, ++iter)
{
const String& rParamStr = (*iter);
- pArgumentList[iList++] = ::rtl::OUString( rParamStr.GetBuffer(), rParamStr.Len() );
- //pParamList[iList++] = (*iter).GetStr();
- iter++;
+ const ::rtl::OUString aTempStr( rParamStr.GetBuffer(), rParamStr.Len());
+ pParamList[iList] = NULL;
+ rtl_uString_assign(&(pParamList[iList]), aTempStr.pData);
}
}
@@ -3504,7 +3578,10 @@ RTLFUNC(Shell)
{
bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
}
- else
+
+ long nResult = 0;
+ // We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
+ if ( bSucc && SbiRuntime::isVBAEnabled())
{
vos::OArgumentList aArgList( pArgumentList, nParamCount );
bSucc = pApp->execute( eOptions, aArgList ) == vos::OProcess::E_None;
@@ -3523,7 +3600,7 @@ RTLFUNC(Shell)
if( !bSucc )
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
else
- rPar.Get(0)->PutLong( 0 );
+ rPar.Get(0)->PutLong( nResult );
}
}
@@ -3594,6 +3671,65 @@ String getBasicTypeName( SbxDataType eType )
return aRetStr;
}
+String getObjectTypeName( SbxVariable* pVar )
+{
+ rtl::OUString sRet( RTL_CONSTASCII_USTRINGPARAM("Object") );
+ if ( pVar )
+ {
+ SbxBase* pObj = pVar->GetObject();
+ if( !pObj )
+ sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
+ else
+ {
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
+ if ( !pUnoObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ if ( pUnoObj )
+ {
+ Any aObj = pUnoObj->getUnoAny();
+ // For upstreaming unless we start to build oovbaapi by default
+ // we need to get detect the vba-ness of the object in some
+ // other way
+ // note: Automation objects do not support XServiceInfo
+ Reference< XServiceInfo > xServInfo( aObj, UNO_QUERY );
+ if ( xServInfo.is() )
+ {
+ // is this a VBA object ?
+ Reference< ooo::vba::XHelperInterface > xVBA( aObj, UNO_QUERY );
+ Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
+ if ( sServices.getLength() )
+ sRet = sServices[ 0 ];
+ }
+ else
+ {
+ Reference< com::sun::star::bridge::oleautomation::XAutomationObject > xAutoMation( aObj, UNO_QUERY );
+ if ( xAutoMation.is() )
+ {
+ Reference< XInvocation > xInv( aObj, UNO_QUERY );
+ if ( xInv.is() )
+ {
+ try
+ {
+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sRet;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+ }
+ sal_Int32 nDot = sRet.lastIndexOf( '.' );
+ if ( nDot != -1 && nDot < sRet.getLength() )
+ sRet = sRet.copy( nDot + 1 );
+ }
+ }
+ }
+ return sRet;
+}
+
RTLFUNC(TypeName)
{
(void)pBasic;
@@ -3605,7 +3741,12 @@ RTLFUNC(TypeName)
{
SbxDataType eType = rPar.Get(1)->GetType();
BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 );
- String aRetStr = getBasicTypeName( eType );
+
+ String aRetStr;
+ if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
+ aRetStr = getObjectTypeName( rPar.Get(1) );
+ else
+ aRetStr = getBasicTypeName( eType );
if( bIsArray )
aRetStr.AppendAscii( "()" );
rPar.Get(0)->PutString( aRetStr );
@@ -3947,28 +4088,28 @@ RTLFUNC(StrConv)
{
(void)pBasic;
(void)bWrite;
-
+
ULONG nArgCount = rPar.Count()-1;
if( nArgCount < 2 || nArgCount > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return;
+ return;
}
- String aOldStr = rPar.Get(1)->GetString();
+ String aOldStr = rPar.Get(1)->GetString();
INT32 nConversion = rPar.Get(2)->GetLong();
-
+
USHORT nLanguage = LANGUAGE_SYSTEM;
if( nArgCount == 3 )
{
- // LCID not supported now
+ // LCID not supported now
//nLanguage = rPar.Get(3)->GetInteger();
}
USHORT nOldLen = aOldStr.Len();
if( nOldLen == 0 )
{
- // null string,return
+ // null string,return
rPar.Get(0)->PutString(aOldStr);
return;
}
@@ -3983,7 +4124,7 @@ RTLFUNC(StrConv)
nType |= ::com::sun::star::i18n::TransliterationModules_LOWERCASE_UPPERCASE;
else if ( (nConversion & 0x02) == 2 ) // vbLowerCase
nType |= ::com::sun::star::i18n::TransliterationModules_UPPERCASE_LOWERCASE;
-
+
if ( (nConversion & 0x04) == 4 ) // vbWide
nType |= ::com::sun::star::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
else if ( (nConversion & 0x08) == 8 ) // vbNarrow
@@ -4014,12 +4155,12 @@ RTLFUNC(StrConv)
{
pChar[i] = static_cast< sal_Char >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff );
if( i%2 )
- pSrc++;
+ pSrc++;
}
pChar[nSize] = '\0';
- ::rtl::OString aOStr(pChar);
-
- // there is no concept about default codepage in unix. so it is incorrectly in unix
+ ::rtl::OString aOStr(pChar);
+
+ // there is no concept about default codepage in unix. so it is incorrectly in unix
::rtl::OUString aOUStr = ::rtl::OStringToOUString(aOStr, osl_getThreadTextEncoding());
aNewStr = String(aOUStr);
rPar.Get(0)->PutString( aNewStr );
@@ -4028,7 +4169,7 @@ RTLFUNC(StrConv)
else if ( (nConversion & 0x80) == 128 ) // vbFromUnicode
{
::rtl::OUString aOUStr(aNewStr);
- // there is no concept about default codepage in unix. so it is incorrectly in unix
+ // 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() );
@@ -4039,11 +4180,11 @@ RTLFUNC(StrConv)
if( bIncIndex )
pArray->AddDim( 1, nArraySize );
else
- pArray->AddDim( 0, nArraySize-1 );
+ pArray->AddDim( 0, nArraySize-1 );
}
else
{
- pArray->unoAddDim( 0, -1 );
+ pArray->unoAddDim( 0, -1 );
}
for( USHORT i=0; i< nArraySize; i++)
@@ -4055,7 +4196,7 @@ RTLFUNC(StrConv)
short index = i;
if( bIncIndex )
++index;
- pArray->Put( pNew, &index );
+ pArray->Put( pNew, &index );
}
SbxVariableRef refVar = rPar.Get(0);
@@ -4064,7 +4205,7 @@ RTLFUNC(StrConv)
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
refVar->SetParameters( NULL );
- return;
+ return;
}
rPar.Get(0)->PutString(aNewStr);
@@ -4463,7 +4604,7 @@ RTLFUNC(Partition)
{
(void)pBasic;
(void)bWrite;
-
+
if ( rPar.Count() != 5 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4474,7 +4615,7 @@ RTLFUNC(Partition)
INT32 nStart = rPar.Get(2)->GetLong();
INT32 nStop = rPar.Get(3)->GetLong();
INT32 nInterval = rPar.Get(4)->GetLong();
-
+
if( nStart < 0 || nStop <= nStart || nInterval < 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4484,7 +4625,7 @@ RTLFUNC(Partition)
// the Partition function inserts leading spaces before lowervalue and uppervalue
// so that they both have the same number of characters as the string
// representation of the value (Stop + 1). This ensures that if you use the output
- // of the Partition function with several values of Number, the resulting text
+ // of the Partition function with several values of Number, the resulting text
// will be handled properly during any subsequent sort operation.
// calculate the maximun number of characters before lowervalue and uppervalue
@@ -4496,7 +4637,7 @@ RTLFUNC(Partition)
::rtl::OUStringBuffer aRetStr( nLen * 2 + 1);
::rtl::OUString aLowerValue;
- ::rtl::OUString aUpperValue;
+ ::rtl::OUString aUpperValue;
if( nNumber < nStart )
{
aUpperValue = aBeforeStart;
@@ -4514,7 +4655,7 @@ RTLFUNC(Partition)
nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart;
nUpperValue = nLowerValue + nInterval - 1;
}
-
+
aLowerValue = ::rtl::OUString::valueOf( nLowerValue );
aUpperValue = ::rtl::OUString::valueOf( nUpperValue );
}
@@ -4538,3 +4679,5 @@ RTLFUNC(Partition)
aRetStr.append( aUpperValue );
rPar.Get(0)->PutString( String(aRetStr.makeStringAndClear()) );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 49e3c15f03..645f615ef7 100755
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,7 +35,6 @@
#include <vcl/wrkwin.hxx>
#include <vcl/timer.hxx>
#include <basic/sbxvar.hxx>
-#ifndef _SBX_HXX
#include <basic/sbx.hxx>
#endif
#include <svl/zforlist.hxx>
@@ -70,11 +70,15 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/i18n/XCalendar.hpp>
+#include <com/sun/star/sheet/XFunctionAccess.hpp>
using namespace comphelper;
+using namespace com::sun::star::sheet;
using namespace com::sun::star::uno;
using namespace com::sun::star::i18n;
+void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
+Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
static Reference< XCalendar > getLocaleCalendar( void )
{
@@ -85,7 +89,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 );
}
}
@@ -267,12 +271,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);
@@ -284,7 +288,7 @@ RTLFUNC(CCur) // JSM
rPar.Get(0)->PutCurrency( nCur );
}
-RTLFUNC(CDec) // JSM
+RTLFUNC(CDec)
{
(void)pBasic;
(void)bWrite;
@@ -786,8 +790,8 @@ RTLFUNC(Array)
}
// Parameter ins Array uebernehmen
- // ATTENTION: Using type USHORT for loop variable is
- // mandatory to workaround a problem with the
+ // ATTENTION: Using type USHORT for loop variable is
+ // mandatory to workaround a problem with the
// Solaris Intel compiler optimizer! See i104354
for( USHORT i = 0 ; i < nArraySize ; i++ )
{
@@ -993,13 +997,16 @@ BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
case SbxLONG:
case SbxULONG:
- case SbxLONG64:
- case SbxULONG64:
if( bIsVariant )
*pStrm << (USHORT)SbxLONG; // VarType Id
*pStrm << rVar.GetLong();
break;
-
+ case SbxSALINT64:
+ case SbxSALUINT64:
+ if( bIsVariant )
+ *pStrm << (USHORT)SbxSALINT64; // VarType Id
+ *pStrm << (sal_uInt64)rVar.GetInt64();
+ break;
case SbxSINGLE:
if( bIsVariant )
*pStrm << (USHORT)eType; // VarType Id
@@ -1095,15 +1102,20 @@ BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxLONG:
case SbxULONG:
- case SbxLONG64:
- case SbxULONG64:
{
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;
@@ -1441,8 +1453,8 @@ RTLFUNC(TypeLen)
case SbxDOUBLE:
case SbxCURRENCY:
case SbxDATE:
- case SbxLONG64:
- case SbxULONG64:
+ case SbxSALINT64:
+ case SbxSALUINT64:
nLen = 8;
break;
@@ -1497,7 +1509,7 @@ RTLFUNC(CreateUnoServiceWithArguments)
{
(void)pBasic;
(void)bWrite;
-
+
RTL_Impl_CreateUnoServiceWithArguments( pBasic, rPar, bWrite );
}
@@ -2612,6 +2624,546 @@ RTLFUNC(Round)
rPar.Get(0)->PutDouble( dRes );
}
+void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUString& sFuncName, SbxVariable* pRet )
+{
+ static Reference< XFunctionAccess > xFunc;
+ Any aRes;
+ try
+ {
+ if ( !xFunc.is() )
+ {
+ Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ xFunc.set( xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FunctionAccess"))), UNO_QUERY_THROW);
+ }
+ }
+ Any aRet = xFunc->callFunction( sFuncName, aArgs );
+
+ unoToSbxValue( pRet, aRet );
+
+ }
+ catch( Exception& )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
+}
+
+RTLFUNC(SYD)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 4 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+ aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYD") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(SLN)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 3 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SLN") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(Pmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Pmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(PPmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double per = rPar.Get(2)->GetDouble();
+ double nper = rPar.Get(3)->GetDouble();
+ double pv = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ fv = rPar.Get(5)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= per;
+ aParams[ 2 ] <<= nper;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= fv;
+ aParams[ 5 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PPmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(PV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(NPV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 1 || nArgCount > 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ Sequence< Any > aParams( 2 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ Any aValues = sbxToUnoValue( rPar.Get(2),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ aParams[ 1 ] <<= aValues;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(NPer)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double pmt = rPar.Get(2)->GetDouble();
+ double pv = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= pmt;
+ aParams[ 2 ] <<= pv;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPer") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(MIRR)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 3 );
+ Any aValues = sbxToUnoValue( rPar.Get(1),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ aParams[ 0 ] <<= aValues;
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MIRR") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(IRR)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 1 || nArgCount > 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+ Any aValues = sbxToUnoValue( rPar.Get(1),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ // set default values for Optional args
+ double guess = 0.1;
+ // guess
+ if ( nArgCount >= 2 )
+ {
+ if( rPar.Get(2)->GetType() != SbxEMPTY )
+ guess = rPar.Get(2)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 2 );
+ aParams[ 0 ] <<= aValues;
+ aParams[ 1 ] <<= guess;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IRR") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(IPmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double per = rPar.Get(2)->GetInteger();
+ double nper = rPar.Get(3)->GetDouble();
+ double pv = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ fv = rPar.Get(5)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= per;
+ aParams[ 2 ] <<= nper;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= fv;
+ aParams[ 5 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IPmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(FV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double pv = 0;
+ double type = 0;
+
+ // pv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ pv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(DDB)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double cost = rPar.Get(1)->GetDouble();
+ double salvage = rPar.Get(2)->GetDouble();
+ double life = rPar.Get(3)->GetDouble();
+ double period = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double factor = 2;
+
+ // factor
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ factor = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= cost;
+ aParams[ 1 ] <<= salvage;
+ aParams[ 2 ] <<= life;
+ aParams[ 3 ] <<= period;
+ aParams[ 4 ] <<= factor;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DDB") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(Rate)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double nper = 0;
+ double pmt = 0;
+ double pv = 0;
+
+ nper = rPar.Get(1)->GetDouble();
+ pmt = rPar.Get(2)->GetDouble();
+ pv = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+ double guess = 0.1;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ // guess
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= nper;
+ aParams[ 1 ] <<= pmt;
+ aParams[ 2 ] <<= pv;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+ aParams[ 5 ] <<= guess;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rate") ), rPar.Get( 0 ) );
+}
+
RTLFUNC(StrReverse)
{
(void)pBasic;
@@ -2713,3 +3265,4 @@ RTLFUNC(Me)
refVar->PutObject( pClassModuleObject );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index c7e81cf162..44f87c16fb 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -774,3 +775,4 @@ RTLFUNC(TYP_JUMPEDITFLD)
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index a7e2a5ee38..e7ccfb7590 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -166,29 +167,41 @@ extern RTLFUNC(Kill); // JSM
extern RTLFUNC(MkDir); // JSM
extern RTLFUNC(RmDir); // JSM
extern RTLFUNC(SendKeys); // JSM
+extern RTLFUNC(DDB);
extern RTLFUNC(DimArray);
extern RTLFUNC(Dir);
extern RTLFUNC(DoEvents);
extern RTLFUNC(Exp);
extern RTLFUNC(FileLen);
extern RTLFUNC(Fix);
+extern RTLFUNC(FV);
extern RTLFUNC(Hex);
extern RTLFUNC(Input);
extern RTLFUNC(InStr);
extern RTLFUNC(InStrRev);
extern RTLFUNC(Int);
+extern RTLFUNC(IPmt);
+extern RTLFUNC(IRR);
extern RTLFUNC(Join);
extern RTLFUNC(LCase);
extern RTLFUNC(Left);
extern RTLFUNC(Log);
extern RTLFUNC(LTrim);
extern RTLFUNC(Mid);
+extern RTLFUNC(MIRR);
+extern RTLFUNC(NPer);
+extern RTLFUNC(NPV);
extern RTLFUNC(Oct);
+extern RTLFUNC(Pmt);
+extern RTLFUNC(PPmt);
+extern RTLFUNC(PV);
+extern RTLFUNC(Rate);
extern RTLFUNC(Replace);
extern RTLFUNC(Right);
extern RTLFUNC(RTrim);
extern RTLFUNC(RTL);
extern RTLFUNC(Sgn);
+extern RTLFUNC(SLN);
extern RTLFUNC(Space);
extern RTLFUNC(Split);
extern RTLFUNC(Sqr);
@@ -196,6 +209,7 @@ extern RTLFUNC(Str);
extern RTLFUNC(StrComp);
extern RTLFUNC(String);
extern RTLFUNC(StrReverse);
+extern RTLFUNC(SYD);
extern RTLFUNC(Tan);
extern RTLFUNC(UCase);
extern RTLFUNC(Val);
@@ -299,6 +313,7 @@ extern RTLFUNC(Switch);
extern RTLFUNC(Wait);
//i#64882# add new WaitUntil
extern RTLFUNC(WaitUntil);
+extern RTLFUNC(FuncCaller);
extern RTLFUNC(GetGUIVersion);
extern RTLFUNC(Choose);
@@ -353,3 +368,5 @@ extern RTLFUNC(TraceCommand);
extern double Now_Impl();
extern void Wait_Impl( bool bDurationBased, SbxArray& rPar );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 022cc40a5f..ddce051697 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -210,7 +211,7 @@ SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// Alle Opcodes mit zwei Operanden
&SbiRuntime::StepSTATIC, // Statische Variable (+StringId+StringId)
&SbiRuntime::StepTCREATE, // User Defined Objekte (+StringId+StringId)
&SbiRuntime::StepDCREATE, // Objekt-Array kreieren (+StringID+StringID)
- &SbiRuntime::StepGLOBAL_P, // Globale Variable definieren, die beim Neustart
+ &SbiRuntime::StepGLOBAL_P, // Globale Variable definieren, die beim Neustart
// von Basic nicht ueberschrieben wird (+StringID+Typ)
&SbiRuntime::StepFIND_G, // Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P
&SbiRuntime::StepDCREATE_REDIMP, // Objekt-Array redimensionieren (+StringID+StringID)
@@ -364,7 +365,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
LanguageType* peFormatterLangType, DateFormat* peFormatterDateFormat )
{
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
xFactory = comphelper::getProcessServiceFactory();
LanguageType eLangType;
@@ -544,8 +545,8 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
// Achtung: pMeth kann auch NULL sein (beim Aufruf des Init-Codes)
SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
- : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
+ : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
{
nFlags = pe ? pe->GetDebugFlags() : 0;
pIosys = pInst->pIosys;
@@ -653,7 +654,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
bByVal |= BOOL( ( p->eType & SbxBYREF ) == 0 );
t = (SbxDataType) ( p->eType & 0x0FFF );
- if( !bByVal && t != SbxVARIANT &&
+ if( !bByVal && t != SbxVARIANT &&
(!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) )
bByVal = TRUE;
}
@@ -737,7 +738,7 @@ BOOL SbiRuntime::Step()
else if( eOp >= SbOP1_START && eOp <= SbOP1_END )
{
nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24;
-
+
(this->*( aStep1[ eOp - SbOP1_START ] ) )( nOp1 );
}
else if( eOp >= SbOP2_START && eOp <= SbOP2_END )
@@ -776,7 +777,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;
@@ -790,14 +791,14 @@ BOOL SbiRuntime::Step()
StepRESUME( 1 );
else if( pError ) // On Error Goto ...
pCode = pError;
- else
+ else
bLetParentHandleThis = true;
}
else
{
bLetParentHandleThis = true;
pError = NULL; //terminate the handler
- }
+ }
if ( bLetParentHandleThis )
{
// AB 13.2.1997, neues Error-Handling:
@@ -1031,7 +1032,25 @@ SbxVariable* SbiRuntime::GetTOS( short n )
void SbiRuntime::TOSMakeTemp()
{
SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
- if( p->GetRefCount() != 1 )
+ if ( p->GetType() == SbxEMPTY )
+ p->Broadcast( SBX_HINT_DATAWANTED );
+
+ SbxVariable* pDflt = NULL;
+ 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
+ // pDft->pParent to be deleted, when p2->Compute() is
+ // called below pParent is accessed ( but its deleted )
+ // so set it to NULL now
+ pDflt->SetParent( NULL );
+ p = new SbxVariable( *pDflt );
+ p->SetFlag( SBX_READWRITE );
+ refExprStk->Put( p, nExprLvl - 1 );
+// return;
+ }
+
+ else if( p->GetRefCount() != 1 )
{
SbxVariable* pNew = new SbxVariable( *p );
pNew->SetFlag( SBX_READWRITE );
@@ -1040,7 +1059,6 @@ void SbiRuntime::TOSMakeTemp()
}
// Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
-
void SbiRuntime::PushGosub( const BYTE* pc )
{
if( ++nGosubLvl > MAXRECURSION )
@@ -1277,11 +1295,13 @@ void SbiRuntime::DllCall
}
USHORT
SbiRuntime::GetImageFlag( USHORT n ) const
-{
- return pImg->GetFlag( n );
-}
+{
+ return pImg->GetFlag( n );
+}
USHORT
SbiRuntime::GetBase()
-{
+{
return pImg->GetBase();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index cea7f3907c..4f9e726df8 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,10 @@
#include "runtime.hxx"
#include "stdobj.hxx"
#include <basic/sbstdobj.hxx>
+#include <sal/macros.h>
#include "rtlproto.hxx"
#include "sbintern.hxx"
-
+#include <hash_map>
// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
// Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
// benoetigen!
@@ -69,6 +71,45 @@ struct Methods {
USHORT nHash; // Hashcode
};
+struct StringHashCode
+{
+ size_t operator()( const String& rStr ) const
+ {
+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
+ }
+};
+
+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 },
@@ -175,7 +216,12 @@ 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 },
+ { "Cost", SbxDOUBLE, 0, NULL,0 },
+ { "Salvage", SbxDOUBLE, 0, NULL,0 },
+ { "Life", SbxDOUBLE, 0, NULL,0 },
+ { "Period", SbxDOUBLE, 0, NULL,0 },
+ { "Factor", SbxVARIANT, _OPT, NULL,0 },
{ "Date", SbxDATE, _LFUNCTION,RTLNAME(Date),0 },
{ "DateAdd", SbxDATE, 3 | _FUNCTION, RTLNAME(DateAdd),0 },
{ "Interval", SbxSTRING, 0,NULL,0 },
@@ -275,6 +321,12 @@ static Methods aMethods[] = {
{ "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
{ "Modulename", SbxSTRING, 0,NULL,0 },
+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
{ "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get),0 },
{ "filenumber", SbxINTEGER, 0,NULL,0 },
{ "recordnumber", SbxLONG, 0,NULL,0 },
@@ -335,6 +387,16 @@ static Methods aMethods[] = {
{ "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 },
+ { "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 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
{ "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
{ "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate),0 },
@@ -405,6 +467,10 @@ static Methods aMethods[] = {
{ "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 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
+ { "FinanceRate", SbxDOUBLE, 0, NULL,0 },
+ { "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
{ "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir),0 },
{ "pathname", SbxSTRING, 0,NULL,0 },
{ "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
@@ -421,6 +487,15 @@ static Methods aMethods[] = {
{ "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
{ "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, 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 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
{ "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
{ "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct),0 },
@@ -432,16 +507,46 @@ static Methods aMethods[] = {
{ "stop", SbxLONG, 0,NULL,0 },
{ "interval", SbxLONG, 0,NULL,0 },
{ "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
+
+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, 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 },
+ { "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 },
+
{ "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put),0 },
{ "filenumber", SbxINTEGER, 0,NULL,0 },
{ "recordnumber", SbxLONG, 0,NULL,0 },
{ "variablename", SbxVARIANT, 0,NULL,0 },
+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
{ "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor),0 },
{ "number", SbxINTEGER, 0,NULL,0 },
{ "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
{ "Number", SbxDOUBLE, _OPT, NULL,0 },
+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, 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 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
{ "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
@@ -495,6 +600,15 @@ 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 },
+ { "Cost", SbxDOUBLE, 0,NULL,0 },
+ { "Double", SbxDOUBLE, 0,NULL,0 },
+ { "Life", SbxDOUBLE, 0,NULL,0 },
+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
+ { "Cost", SbxDOUBLE, 0,NULL,0 },
+ { "Salvage", SbxDOUBLE, 0,NULL,0 },
+ { "Life", SbxDOUBLE, 0,NULL,0 },
+ { "Period", SbxDOUBLE, 0,NULL,0 },
{ "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space),0 },
{ "string", SbxLONG, 0,NULL,0 },
{ "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc),0 },
@@ -613,6 +727,7 @@ static Methods aMethods[] = {
{ "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
{ "Milliseconds", SbxLONG, 0,NULL,0 },
+{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
//#i64882#
{ "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
{ "Date", SbxDOUBLE, 0,NULL,0 },
@@ -691,13 +806,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
&& ( p->nHash == nHash_ )
&& ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
{
+ SbiInstance* pInst = pINST;
bFound = TRUE;
if( p->nArgs & _COMPTMASK )
{
- SbiInstance* pInst = pINST;
if( !pInst || !pInst->IsCompatibility() )
bFound = FALSE;
}
+ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
+ bFound = FALSE;
break;
}
nIndex += ( p->nArgs & _ARGSMASK ) + 1;
@@ -794,3 +911,4 @@ SbxInfo* SbiStdObject::GetInfo( short nIdx )
return pInfo_;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index cca55de2ba..58f2c047d8 100644
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -549,3 +550,4 @@ void SbStdClipboard::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 20577b673f..d563c91efe 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,6 +50,11 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
#include <algorithm>
#include <hash_map>
+// for a patch forward declaring these methods below makes sense
+// but, #FIXME lets really just move the methods to the top
+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
+
SbxVariable* getDefaultProp( SbxVariable* pRef );
void SbiRuntime::StepNOP()
@@ -60,34 +66,6 @@ void SbiRuntime::StepArith( SbxOperator eOp )
TOSMakeTemp();
SbxVariable* p2 = GetTOS();
-
- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
- // In the code which this is cut'npaste from there is a check for a ref
- // count != 1 based on which the copy of the SbxVariable is done.
- // see orig code in MakeTempTOS ( and I'm not sure what the significance,
- // of that is )
- // here we alway seem to have a refcount of 1. Also it seems that
- // MakeTempTOS is called for other operation, so I hold off for now
- // until I have a better idea
- if ( bVBAEnabled
- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
- )
- {
- SbxVariable* pDflt = getDefaultProp( p2 );
- if ( pDflt )
- {
- pDflt->Broadcast( SBX_HINT_DATAWANTED );
- // replacing new p2 on stack causes object pointed by
- // pDft->pParent to be deleted, when p2->Compute() is
- // called below pParent is accessed ( but its deleted )
- // so set it to NULL now
- pDflt->SetParent( NULL );
- p2 = new SbxVariable( *pDflt );
- p2->SetFlag( SBX_READWRITE );
- refExprStk->Put( p2, nExprLvl - 1 );
- }
- }
-
p2->ResetFlag( SBX_FIXED );
p2->Compute( eOp, *p1 );
@@ -106,23 +84,28 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
SbxVariableRef p1 = PopVar();
SbxVariableRef p2 = PopVar();
- // Make sure objects with default params have
+ // Make sure objects with default params have
// values ( and type ) set as appropriate
- SbxDataType p1Type = p1->GetType();
- SbxDataType p2Type = p2->GetType();
+ SbxDataType p1Type = p1->GetType();
+ SbxDataType p2Type = p2->GetType();
+ if ( p1Type == SbxEMPTY )
+ {
+ p1->Broadcast( SBX_HINT_DATAWANTED );
+ p1Type = p1->GetType();
+ }
+ if ( p2Type == SbxEMPTY )
+ {
+ p2->Broadcast( SBX_HINT_DATAWANTED );
+ p2Type = p2->GetType();
+ }
if ( p1Type == p2Type )
{
- if ( p1Type == SbxEMPTY )
- {
- p1->Broadcast( SBX_HINT_DATAWANTED );
- p2->Broadcast( SBX_HINT_DATAWANTED );
- }
// if both sides are an object and have default props
// then we need to use the default props
- // we don't need to worry if only one side ( lhs, rhs ) is an
- // object ( object side will get coerced to correct type in
+ // we don't need to worry if only one side ( lhs, rhs ) is an
+ // object ( object side will get coerced to correct type in
// Compare )
- else if ( p1Type == SbxOBJECT )
+ if ( p1Type == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( p1 );
if ( pDflt )
@@ -141,8 +124,21 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
}
static SbxVariable* pTRUE = NULL;
static SbxVariable* pFALSE = NULL;
-
- if( p2->Compare( eOp, *p1 ) )
+ static SbxVariable* pNULL = NULL;
+ // why do this on non-windows ?
+ // why do this at all ?
+ // I dumbly follow the pattern :-/
+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
+ {
+ if( !pNULL )
+ {
+ pNULL = new SbxVariable;
+ pNULL->PutNull();
+ pNULL->AddRef();
+ }
+ PushVar( pNULL );
+ }
+ else if( p2->Compare( eOp, *p1 ) )
{
if( !pTRUE )
{
@@ -206,7 +202,7 @@ namespace
sResult.Append('^');
- while (start < end)
+ while (start < end)
{
switch (*start)
{
@@ -388,20 +384,20 @@ void SbiRuntime::StepPUT()
refVar->SetFlag( SBX_WRITE );
}
- // if left side arg is an object or variant and right handside isn't
- // either an object or a variant then try and see if a default
+ // if left side arg is an object or variant and right handside isn't
+ // either an object or a variant then try and see if a default
// property exists.
// to use e.g. Range{"A1") = 34
- // could equate to Range("A1").Value = 34
+ // could equate to Range("A1").Value = 34
if ( bVBAEnabled )
{
- if ( refVar->GetType() == SbxOBJECT )
+ if ( refVar->GetType() == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( refVar );
if ( pDflt )
refVar = pDflt;
}
- if ( refVal->GetType() == SbxOBJECT )
+ if ( refVal->GetType() == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( refVal );
if ( pDflt )
@@ -785,6 +781,17 @@ void SbiRuntime::StepDIM()
// #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
void SbiRuntime::DimImpl( SbxVariableRef refVar )
{
+ // If refDim then this DIM statement is terminating a ReDIM and
+ // previous StepERASE_CLEAR for an array, the following actions have
+ // been delayed from ( StepERASE_CLEAR ) 'till here
+ if ( refRedim )
+ {
+ if ( !refRedimpArray ) // only erase the array not ReDim Preserve
+ lcl_eraseImpl( refVar, bVBAEnabled );
+ SbxDataType eType = refVar->GetType();
+ lcl_clearImpl( refVar, eType );
+ refRedim = NULL;
+ }
SbxArray* pDims = refVar->GetParameters();
// Muss eine gerade Anzahl Argumente haben
// Man denke daran, dass Arg[0] nicht zaehlt!
@@ -843,7 +850,7 @@ void implCopyDimArray( SbxDimArray* pNewArray, SbxDimArray* pOldArray, short nMa
{
if( nActualDim < nMaxDimIndex )
{
- implCopyDimArray( pNewArray, pOldArray, nMaxDimIndex, nActualDim + 1,
+ implCopyDimArray( pNewArray, pOldArray, nMaxDimIndex, nActualDim + 1,
pActualIndices, pLowerBounds, pUpperBounds );
}
else
@@ -950,6 +957,7 @@ void SbiRuntime::StepREDIMP()
void SbiRuntime::StepREDIMP_ERASE()
{
SbxVariableRef refVar = PopVar();
+ refRedim = refVar;
SbxDataType eType = refVar->GetType();
if( eType & SbxARRAY )
{
@@ -960,12 +968,6 @@ void SbiRuntime::StepREDIMP_ERASE()
refRedimpArray = pDimArray;
}
- // As in ERASE
- USHORT nSavFlags = refVar->GetFlags();
- refVar->ResetFlag( SBX_FIXED );
- refVar->SetType( SbxDataType(eType & 0x0FFF) );
- refVar->SetFlags( nSavFlags );
- refVar->Clear();
}
else
if( refVar->IsFixed() )
@@ -1009,7 +1011,7 @@ void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled )
SbxArray* pArray = PTR_CAST(SbxArray,pElemObj);
if ( pArray )
pArray->Clear();
- }
+ }
}
else
// AB 2.4.1996
@@ -1038,10 +1040,7 @@ void SbiRuntime::StepERASE()
void SbiRuntime::StepERASE_CLEAR()
{
- SbxVariableRef refVar = PopVar();
- lcl_eraseImpl( refVar, bVBAEnabled );
- SbxDataType eType = refVar->GetType();
- lcl_clearImpl( refVar, eType );
+ refRedim = PopVar();
}
void SbiRuntime::StepARRAYACCESS()
@@ -1189,7 +1188,7 @@ void SbiRuntime::StepINPUT()
// ErrorBox( NULL, WB_OK, aMsg ).Execute();
//****** DONT CHECK IN, TEST ONLY *******
//****** DONT CHECK IN, TEST ONLY *******
-
+
pCode = pRestart;
}
else
@@ -1436,3 +1435,4 @@ void SbiRuntime::StepERROR()
Error( error );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index f448f7900b..1e8a3a7426 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,7 +39,7 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
-bool checkUnoObjectType( SbUnoObject* refVal,
+bool checkUnoObjectType( SbUnoObject* refVal,
const String& aClass );
// Laden einer numerischen Konstanten (+ID)
@@ -93,6 +94,15 @@ void SbiRuntime::StepARGN( UINT32 nOp1 )
{
String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxVariableRef pVal = PopVar();
+ if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
+ {
+ // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
+ if ( pVal->GetType() == SbxEMPTY )
+ pVal->Broadcast( SBX_HINT_DATAWANTED );
+ // Methoden und Properties evaluieren!
+ SbxVariable* pRes = new SbxVariable( *pVal );
+ pVal = pRes;
+ }
refArgv->Put( pVal, nArgc );
refArgv->PutAlias( aAlias, nArgc++ );
}
@@ -160,7 +170,7 @@ void SbiRuntime::StepPAD( UINT32 nOp1 )
void SbiRuntime::StepJUMP( UINT32 nOp1 )
{
#ifdef DBG_UTIL
- // #QUESTION shouln't this be
+ // #QUESTION shouln't this be
// if( (BYTE*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() )
if( nOp1 >= pImg->GetCodeSize() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
@@ -182,7 +192,9 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 )
void SbiRuntime::StepJUMPF( UINT32 nOp1 )
{
SbxVariableRef p = PopVar();
- if( !p->GetBool() )
+ // In a test e.g. If Null then
+ // will evaluate Null will act as if False
+ if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
StepJUMP( nOp1 );
}
@@ -443,7 +455,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
SbClassData* pClassData;
if( pClassMod && (pClassData=pClassMod->pClassData) != NULL )
{
- SbxVariable* pClassVar =
+ SbxVariable* pClassVar =
pClassData->mxIfaces->Find( aClass, SbxCLASS_DONTCARE );
bRet = (pClassVar != NULL);
}
@@ -572,3 +584,4 @@ void SbiRuntime::StepBASED( UINT32 nOp1 )
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 4279abe002..fa055ac9f6 100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -1,3 +1,4 @@
+/* -*- 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,8 +30,6 @@
#include "precompiled_basic.hxx"
#include "runtime.hxx"
-#ifndef GCC
-#endif
#include "iosys.hxx"
#include "image.hxx"
#include "sbintern.hxx"
@@ -98,7 +97,7 @@ SbxVariable* SbiRuntime::FindElement
if( bLocal )
{
if ( bStatic )
- {
+ {
if ( pMeth )
pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
}
@@ -141,7 +140,7 @@ SbxVariable* SbiRuntime::FindElement
if ( pElem )
bSetName = false; // don't overwrite uno name
else
- pElem = getVBAConstant( aName );
+ pElem = VBAConstantHelper::instance().getVBAConstant( aName );
}
if( !pElem )
@@ -489,7 +488,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
// Falls wir ein Array haben, wollen wir bitte das Array-Element!
SbxArray* pPar;
- if( pElem->GetType() & SbxARRAY )
+ if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
{
SbxBase* pElemObj = pElem->GetObject();
SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj);
@@ -771,6 +770,8 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
SaveRef( q );
*q = *p;
p = q;
+ if ( i )
+ refParams->Put( p, i );
}
SetupArgs( p, nOp1 );
PushVar( CheckArray( p ) );
@@ -1299,3 +1300,4 @@ void SbiRuntime::StepSTATIC( UINT32 nOp1, UINT32 nOp2 )
StepSTATIC_Impl( aName, t );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sample/collelem.cxx b/basic/source/sample/collelem.cxx
index 7b7634e601..b88dc3bcbb 100644
--- a/basic/source/sample/collelem.cxx
+++ b/basic/source/sample/collelem.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -77,3 +78,4 @@ void SampleElement::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sample/makefile.mk b/basic/source/sample/makefile.mk
index 8acd751cfe..ccf1544b74 100644
--- a/basic/source/sample/makefile.mk
+++ b/basic/source/sample/makefile.mk
@@ -40,6 +40,9 @@ CXXFILES = \
object.cxx \
collelem.cxx
+EXCEPTIONSFILES= \
+ $(OBJ)$/object.obj \
+ $(OBJ)$/collelem.obj
OBJFILES = \
$(OBJ)$/object.obj \
diff --git a/basic/source/sample/object.cxx b/basic/source/sample/object.cxx
index 87e134472e..c1c78684ed 100644
--- a/basic/source/sample/object.cxx
+++ b/basic/source/sample/object.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,12 +31,8 @@
#include <tools/errcode.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbx.hxx>
-#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
-#endif
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include "object.hxx"
#include "collelem.hxx"
@@ -276,3 +273,4 @@ SbxObject* SampleObjectFac::CreateObject( const String& rClass )
return NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index cbcd5d97d3..200c10018c 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,10 +34,10 @@
#include <vector>
using namespace std;
-struct SbxDim { // eine Array-Dimension:
+struct SbxDim { // an array-dimension:
SbxDim* pNext; // Link
- INT32 nLbound, nUbound; // Begrenzungen
- INT32 nSize; // Anzahl Elemente
+ INT32 nLbound, nUbound; // Limitations
+ INT32 nSize; // Number of elements
};
class SbxVarEntry : public SbxVariableRef {
@@ -99,7 +100,7 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray )
if( pSrcRef->pAlias )
pDstRef->pAlias = new XubString( *pSrcRef->pAlias );
if( eType != SbxVARIANT )
- // Keine Objekte konvertieren
+ // Convert no objects
if( eType != SbxOBJECT || pSrc_->GetClass() != SbxCLASS_OBJECT )
((SbxVariable*) pSrc_)->Convert( eType );
pData->push_back( pDstRef );
@@ -149,7 +150,7 @@ USHORT SbxArray::Count() const
SbxVariableRef& SbxArray::GetRef32( UINT32 nIdx )
{
- // Array ggf. vergroessern
+ // If necessary extend the array
DBG_ASSERT( nIdx <= SBX_MAXINDEX32, "SBX: Array-Index > SBX_MAXINDEX32" );
// Very Hot Fix
if( nIdx > SBX_MAXINDEX32 )
@@ -167,7 +168,7 @@ SbxVariableRef& SbxArray::GetRef32( UINT32 nIdx )
SbxVariableRef& SbxArray::GetRef( USHORT nIdx )
{
- // Array ggf. vergroessern
+ // If necessary extend the array
DBG_ASSERT( nIdx <= SBX_MAXINDEX, "SBX: Array-Index > SBX_MAXINDEX" );
// Very Hot Fix
if( nIdx > SBX_MAXINDEX )
@@ -229,7 +230,7 @@ void SbxArray::Put32( SbxVariable* pVar, UINT32 nIdx )
{
if( pVar )
if( eType != SbxVARIANT )
- // Keine Objekte konvertieren
+ // Convert no objects
if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef32( nIdx );
@@ -249,7 +250,7 @@ void SbxArray::Put( SbxVariable* pVar, USHORT nIdx )
{
if( pVar )
if( eType != SbxVARIANT )
- // Keine Objekte konvertieren
+ // Convert no objects
if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef( nIdx );
@@ -363,8 +364,8 @@ void SbxArray::Remove( SbxVariable* pVar )
}
}
-// Uebernahme der Daten aus dem uebergebenen Array, wobei
-// gleichnamige Variable ueberschrieben werden.
+// Taking over of the data from the passed array, at which
+// the variable of the same name will be overwritten.
void SbxArray::Merge( SbxArray* p )
{
@@ -374,8 +375,8 @@ void SbxArray::Merge( SbxArray* p )
for( UINT32 i = 0; i < nSize; i++ )
{
SbxVarEntryPtr pRef1 = (*(p->pData))[i];
- // Ist das Element by name schon drin?
- // Dann ueberschreiben!
+ // Is the element by name already inside?
+ // Then overwrite!
SbxVariable* pVar = *pRef1;
if( pVar )
{
@@ -405,8 +406,8 @@ void SbxArray::Merge( SbxArray* p )
}
}
-// Suchen eines Elements ueber die Userdaten. Falls ein Element
-// ein Objekt ist, wird dieses ebenfalls durchsucht.
+// Search of an element via the user data. If the element is
+// object, it will also be scanned.
SbxVariable* SbxArray::FindUserData( UINT32 nData )
{
@@ -421,16 +422,16 @@ SbxVariable* SbxArray::FindUserData( UINT32 nData )
{
p = pVar;
p->ResetFlag( SBX_EXTFOUND );
- break; // JSM 06.10.95
+ break; // JSM 1995-10-06
}
- // Haben wir ein Array/Objekt mit Extended Search?
+ // Did we have an array/object with extended search?
else if( pVar->IsSet( SBX_EXTSEARCH ) )
{
switch( pVar->GetClass() )
{
case SbxCLASS_OBJECT:
{
- // Objekte duerfen ihren Parent nicht durchsuchen
+ // Objects are not allowed to scan their parent.
USHORT nOld = pVar->GetFlags();
pVar->ResetFlag( SBX_GBLSEARCH );
p = ((SbxObject*) pVar)->FindUserData( nData );
@@ -453,8 +454,8 @@ SbxVariable* SbxArray::FindUserData( UINT32 nData )
return p;
}
-// Suchen eines Elements ueber den Namen und den Typ. Falls ein Element
-// ein Objekt ist, wird dieses ebenfalls durchsucht.
+// Search of an element by his name and type. If an element is an object,
+// it will also be scanned..
SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t )
{
@@ -470,8 +471,7 @@ SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t )
SbxVariable* pVar = *pRef;
if( pVar && pVar->IsVisible() )
{
- // Die ganz sichere Suche klappt auch, wenn es
- // keinen Hascode gibt!
+ // The very secure search works as well, if there is no hashcode!
USHORT nVarHash = pVar->GetHashCode();
if( ( !nVarHash || nVarHash == nHash )
&& ( t == SbxCLASS_DONTCARE || pVar->GetClass() == t )
@@ -481,14 +481,14 @@ SbxVariable* SbxArray::Find( const XubString& rName, SbxClassType t )
p->ResetFlag( SBX_EXTFOUND );
break;
}
- // Haben wir ein Array/Objekt mit Extended Search?
+ // Did we have an array/object with extended search?
else if( bExtSearch && pVar->IsSet( SBX_EXTSEARCH ) )
{
switch( pVar->GetClass() )
{
case SbxCLASS_OBJECT:
{
- // Objekte duerfen ihren Parent nicht durchsuchen
+ // Objects are not allowed to scan their parent.
USHORT nOld = pVar->GetFlags();
pVar->ResetFlag( SBX_GBLSEARCH );
p = ((SbxObject*) pVar)->Find( rName, t );
@@ -545,7 +545,7 @@ BOOL SbxArray::StoreData( SvStream& rStrm ) const
{
UINT32 nElem = 0;
UINT32 n;
- // Welche Elemente sind ueberhaupt definiert?
+ // Which elements are even defined?
for( n = 0; n < pData->size(); n++ )
{
SbxVariableRef* pRef = (*pData)[n];
@@ -630,7 +630,7 @@ void SbxDimArray::Clear()
nDim = 0;
}
-// Dimension hinzufuegen
+// Add a dimension
void SbxDimArray::AddDimImpl32( INT32 lb, INT32 ub, BOOL bAllowSize0 )
{
@@ -675,7 +675,7 @@ void SbxDimArray::unoAddDim32( INT32 lb, INT32 ub )
}
-// Dimensionsdaten auslesen
+// Readout dimension data
BOOL SbxDimArray::GetDim32( INT32 n, INT32& rlb, INT32& rub ) const
{
@@ -708,7 +708,7 @@ BOOL SbxDimArray::GetDim( short n, short& rlb, short& rub ) const
return bRet;
}
-// Element-Ptr anhand einer Index-Liste
+// Element-Ptr with the help of an index list
UINT32 SbxDimArray::Offset32( const INT32* pIdx )
{
@@ -779,7 +779,7 @@ void SbxDimArray::Put32( SbxVariable* p, const INT32* pIdx )
}
-// Element-Nr anhand eines Parameter-Arrays
+// Element-Number with the help of Parameter-Array
UINT32 SbxDimArray::Offset32( SbxArray* pPar )
{
@@ -788,7 +788,7 @@ UINT32 SbxDimArray::Offset32( SbxArray* pPar )
SetError( SbxERR_BOUNDS ); return 0;
}
UINT32 nPos = 0;
- USHORT nOff = 1; // Nicht Element 0!
+ USHORT nOff = 1; // Non element 0!
for( SbxDim* p = pFirst; p && !IsError(); p = p->pNext )
{
INT32 nIdx = pPar->Get( nOff++ )->GetLong();
@@ -855,3 +855,4 @@ BOOL SbxDimArray::StoreData( SvStream& rStrm ) const
return SbxArray::StoreData( rStrm );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 5304d892b5..c1cda87577 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,15 +37,15 @@
#include <basic/sbxfac.hxx>
#include <basic/sbxbase.hxx>
-// AppData-Struktur fuer SBX:
+// AppData-Structure for SBX:
SV_IMPL_PTRARR(SbxParams,SbxParamInfo*);
SV_IMPL_PTRARR(SbxFacs,SbxFactory*);
TYPEINIT0(SbxBase)
-// SBX-Daten anfordern oder ggf. anlegen
-// wir legen den Bereich einfach an und verzichten auf die Freigabe!
+// Request SBX-Data or if necessary create them
+// we just create the area and waive the release!
SbxAppData* GetSbxData_Impl()
{
@@ -152,11 +153,11 @@ void SbxBase::AddFactory( SbxFactory* pFac )
SbxAppData* p = GetSbxData_Impl();
const SbxFactory* pTemp = pFac;
- // AB, 6.3.96: HandleLast-Flag beruecksichtigen
- USHORT nPos = p->aFacs.Count(); // Einfuege-Position
- if( !pFac->IsHandleLast() ) // Nur, wenn nicht selbst HandleLast
+ // From 1996-03-06: take the HandleLast-Flag into account
+ USHORT nPos = p->aFacs.Count(); // Insert-Position
+ if( !pFac->IsHandleLast() ) // Only if not self HandleLast
{
- // Neue Factory vor Factories mit HandleLast einordnen
+ // Rank new factory in front of factories with HandleLast
while( nPos > 0 &&
(static_cast<SbxFactory*>(p->aFacs.GetObject( nPos-1 )))->IsHandleLast() )
nPos--;
@@ -200,7 +201,7 @@ SbxBase* SbxBase::Create( UINT16 nSbxId, UINT32 nCreator )
case SBXID_METHOD: return new SbxMethod( aEmptyStr, SbxEMPTY );
case SBXID_PROPERTY: return new SbxProperty( aEmptyStr, SbxEMPTY );
}
- // Unbekanter Typ: ber die Factories gehen!
+ // Unknown type: go over the factories!
SbxAppData* p = GetSbxData_Impl();
SbxBase* pNew = NULL;
for( USHORT i = 0; i < p->aFacs.Count(); i++ )
@@ -245,7 +246,7 @@ SbxObject* SbxBase::CreateObject( const XubString& rClass )
static BOOL bStaticEnableBroadcasting = TRUE;
-// Sbx-Loesung als Ersatz fuer SfxBroadcaster::Enable()
+// Sbx-Solution in exchange for SfxBroadcaster::Enable()
void SbxBase::StaticEnableBroadcasting( BOOL bEnable )
{
bStaticEnableBroadcasting = bEnable;
@@ -263,7 +264,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
UINT32 nCreator, nSize;
rStrm >> nCreator >> nSbxId >> nFlags >> nVer;
- // Eine Dummheit meinerseits korrigieren:
+ // Correcting a foolishness of mine:
if( nFlags & SBX_RESERVED )
nFlags = ( nFlags & ~SBX_RESERVED ) | SBX_GBLSEARCH;
@@ -282,7 +283,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
rStrm.Seek( nOldPos );
if( !p->LoadCompleted() )
{
- // Loeschen des Objekts
+ // Deleting of the object
SbxBaseRef aRef( p );
p = NULL;
}
@@ -290,7 +291,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
else
{
rStrm.SetError( SVSTREAM_FILEFORMAT_ERROR );
- // Loeschen des Objekts
+ // Deleting of the object
SbxBaseRef aRef( p );
p = NULL;
}
@@ -300,7 +301,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm )
return p;
}
-// Sbx-Objekt im Stream ueberspringen
+// Skip the Sbx-Object inside the stream
void SbxBase::Skip( SvStream& rStrm )
{
UINT16 nSbxId, nFlags, nVer;
@@ -453,3 +454,4 @@ BOOL SbxInfo::StoreData( SvStream& rStrm ) const
return TRUE;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 8abfbeabab..5c6657b874 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,11 +33,6 @@
#include "sbxconv.hxx"
#include "sbxres.hxx"
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
enum SbxBOOL ImpGetBool( const SbxValues* p )
{
enum SbxBOOL nRes;
@@ -75,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:
@@ -143,16 +135,11 @@ 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;
}
@@ -184,15 +171,11 @@ void ImpPutBool( SbxValues* p, INT16 n )
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 );
@@ -235,18 +218,14 @@ void ImpPutBool( SbxValues* p, INT16 n )
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 );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index b70b82662a..2c194f564c 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -94,8 +95,13 @@ start:
else
nRes = (BYTE) 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;
}
@@ -104,8 +110,9 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); nRes = 0;
}
else
- nRes = (BYTE) p->nInt64;
+ nRes = (BYTE) val;
break;
+ }
case SbxSALUINT64:
if( p->uInt64 > SbxMAXBYTE )
{
@@ -128,20 +135,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 )
@@ -200,7 +198,7 @@ start:
case SbxBYREF | SbxBYTE:
nRes = p->nByte; break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYREF | SbxCHAR:
aTmp.nChar = *p->pChar; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -218,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:
@@ -258,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 );
@@ -311,19 +301,16 @@ 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 );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index ca52057a7c..322f95cf43 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,11 +32,6 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
xub_Unicode ImpGetChar( const SbxValues* p )
{
SbxValues aTmp;
@@ -85,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;
}
@@ -95,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 )
{
@@ -119,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 )
@@ -188,7 +183,7 @@ start:
case SbxBYREF | SbxCHAR:
nRes = *p->pChar; break;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYREF | SbxBYTE:
aTmp.nByte = *p->pByte; goto ref;
case SbxBYREF | SbxINTEGER:
@@ -206,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:
@@ -243,21 +234,17 @@ 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;
- // ab hier wird getestet
+ // from here on will be tested
case SbxBYTE:
aTmp.pByte = &p->nByte; goto direct;
case SbxULONG:
@@ -305,16 +292,12 @@ start:
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 );
@@ -322,3 +305,4 @@ start:
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index a8f1fc9fa9..5bc2e08f30 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -60,7 +61,7 @@ SbxCollection::SbxCollection( const XubString& rClass )
nRemoveHash = MakeHashCode( String::CreateFromAscii( pRemove ) );
}
Initialize();
- // Fuer Zugriffe auf sich selbst
+ // For Access on itself
StartListening( GetBroadcaster(), TRUE );
}
@@ -159,7 +160,7 @@ void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
SbxObject::SFX_NOTIFY( rCst, rId1, rHint, rId2 );
}
-// Default: Argument ist Objekt
+// Default: argument is object
void SbxCollection::CollAdd( SbxArray* pPar_ )
{
@@ -175,7 +176,7 @@ void SbxCollection::CollAdd( SbxArray* pPar_ )
}
}
-// Default: Index ab 1 oder der Objektname
+// Default: index from 1 or object name
void SbxCollection::CollItem( SbxArray* pPar_ )
{
@@ -199,7 +200,7 @@ void SbxCollection::CollItem( SbxArray* pPar_ )
}
}
-// Default: Index ab 1
+// Default: index from 1
void SbxCollection::CollRemove( SbxArray* pPar_ )
{
@@ -250,7 +251,7 @@ SbxStdCollection& SbxStdCollection::operator=( const SbxStdCollection& r )
SbxStdCollection::~SbxStdCollection()
{}
-// Default: Fehler, wenn falsches Objekt
+// Default: Error, if wrong object
void SbxStdCollection::Insert( SbxVariable* p )
{
@@ -299,3 +300,4 @@ BOOL SbxStdCollection::StoreData( SvStream& rStrm ) const
return bRes;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx
index 83e1a8dbc8..3d2934e0f4 100644
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,13 +47,15 @@ extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
double ImpRound( double );
INT16 ImpGetInteger( const SbxValues* );
void ImpPutInteger( SbxValues*, 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
@@ -70,37 +73,18 @@ void ImpPutSingle( SbxValues*, float );
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
-
// 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
@@ -123,7 +107,7 @@ 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* );
@@ -142,10 +126,12 @@ void ImpPutULong( SbxValues*, UINT32 );
// SBXBOOL.CXX
enum SbxBOOL ImpGetBool( const SbxValues* );
-void ImpPutBool( SbxValues*, INT16 );
+void ImpPutBool( SbxValues*, INT16 );
// ByteArry <--> String
SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
::rtl::OUString ByteArrayToString(SbxArray* pArr);
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 9ca7f8e0cd..1235a41129 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -1,10 +1,11 @@
+/* -*- 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
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* This file is part of OpenOffice.org.
*
@@ -28,96 +29,302 @@
// 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:
@@ -133,25 +340,28 @@ 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;
- // ab hier muss getestet werden
+ // from here on had to be tested
case SbxBYREF | SbxLONG:
aTmp.nLong = *p->pLong; goto ref;
case SbxBYREF | SbxULONG:
@@ -161,28 +371,30 @@ 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 )
{
- // Hier sind Tests notwendig
+ // Here are tests necessary
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -201,24 +413,26 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // 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:
@@ -239,79 +453,97 @@ 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 = (BYTE) 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 = (INT16) r; 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 = (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 = (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 = (UINT32) val;
+ 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 );
}
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index f1a4c3b6a0..5f9bcaeb06 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -66,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:
@@ -101,13 +98,13 @@ double ImpGetDate( const SbxValues* p )
xub_StrLen nCheckPos = 0;
short nType = 127;
- // Standard-Vorlagen des Formatters haben nur zweistellige
- // Jahreszahl. Deshalb eigenes Format registrieren
+ // Default templates of the formatter have only two-digit
+ // date. Therefore register an own format.
- // HACK, da der Numberformatter in PutandConvertEntry die Platzhalter
- // fuer Monat, Tag, Jahr nicht entsprechend der Systemeinstellung
- // austauscht. Problem: Print Year(Date) unter engl. BS
- // siehe auch basic\source\runtime\runtime.cxx
+ // HACK, because the number formatter in PutandConvertEntry replace the wildcard
+ // for month, day, year not according to the configuration.
+ // Problem: Print Year(Date) under Engl. OS
+ // quod vide basic\source\runtime\runtime.cxx
SvtSysLocale aSysLocale;
DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
@@ -173,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:
@@ -201,7 +194,7 @@ start:
case SbxDOUBLE:
p->nDouble = n; break;
- // ab hier wird getestet
+ // from here will be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -218,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:
@@ -260,7 +249,7 @@ start:
SvtSysLocale aSysLocale;
DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
String aStr;
- // ist der ganzzahlige Teil 0, wollen wir kein Jahr!
+ // if the whole-number part is 0, we want no year!
if( n <= -1.0 || n >= 1.0 )
{
// Time only if != 00:00:00
@@ -397,10 +386,11 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index c8009245d0..045349a11b 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,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:
@@ -128,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:
@@ -146,7 +147,7 @@ void ImpPutDouble( SbxValues* p, double n, BOOL bCoreString )
start:
switch( +p->eType )
{
- // Hier sind Tests notwendig
+ // Here are tests necessary
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -155,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;
@@ -176,7 +176,19 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ 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;
case SbxSALUINT64:
@@ -297,10 +309,11 @@ start:
{
SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( n ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 09fa957041..d53c529707 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,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 )
@@ -53,7 +51,6 @@ SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
(void)rDec;
#endif
mnRefCount = 0;
- // GnDecCounter++;
}
SbxDecimal::SbxDecimal
@@ -493,38 +490,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:
@@ -557,17 +548,13 @@ start:
case SbxBYREF | SbxUSHORT:
pnDecRes->setUShort( *p->pUShort ); break;
- // ab hier muss getestet werden
+ // from here on had to be tested
case SbxBYREF | SbxSINGLE:
aTmp.nSingle = *p->pSingle; goto ref;
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:
@@ -597,7 +584,7 @@ void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec )
start:
switch( +p->eType )
{
- // hier muss getestet werden
+ // here had to be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -607,30 +594,28 @@ 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;
- // ab hier nicht mehr
+ // from here on no longer
case SbxDECIMAL:
case SbxBYREF | SbxDECIMAL:
{
if( pDec != p->pDecimal )
{
releaseDecimalPtr( p->pDecimal );
- // if( p->pDecimal )
- // p->pDecimal->ReleaseRef();
p->pDecimal = pDec;
if( pDec )
pDec->addRef();
@@ -652,20 +637,6 @@ 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:
@@ -730,6 +701,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;
@@ -755,7 +732,6 @@ start:
*p->pSingle = 0;
}
break;
- // *p->pSingle = (float) n; break;
case SbxBYREF | SbxDATE:
case SbxBYREF | SbxDOUBLE:
if( !pDec->getDouble( *p->pDouble ) )
@@ -764,28 +740,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 );
}
@@ -795,3 +749,4 @@ start:
#endif
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx
index 3b623476bf..85d5509190 100644
--- a/basic/source/sbx/sbxdec.hxx
+++ b/basic/source/sbx/sbxdec.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -120,3 +121,4 @@ public:
friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight );
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 1ee1090566..1a84221cc0 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
#include <tools/errcode.hxx>
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <basic/sbx.hxx>
@@ -68,13 +67,13 @@ static const xub_Unicode* SkipWhitespace( const xub_Unicode* p )
return p;
}
-// Scannen eines Symbol. Das Symbol wird in rSym eingetragen, der Returnwert
-// ist die neue Scanposition. Bei Fehlern ist das Symbol leer.
+// Scanning of a symbol. The symbol were inserted in rSym, the return value
+// is the new scan position. The symbol is at errors empty.
static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const SbxSimpleCharClass& rCharClass )
{
USHORT nLen = 0;
- // Haben wir ein Sondersymbol?
+ // Did we have a nonstandard symbol?
if( *p == '[' )
{
rSym = ++p;
@@ -84,7 +83,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
}
else
{
- // Ein Symbol muss mit einem Buchstaben oder einem Underline beginnen
+ // A symbol had to begin with a alphabetic character or an underline
if( !rCharClass.isAlpha( *p ) && *p != '_' )
SbxBase::SetError( SbxERR_SYNTAX );
else
@@ -93,7 +92,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
// Dann darf es Buchstaben, Zahlen oder Underlines enthalten
while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
p++, nLen++;
- // BASIC-Standard-Suffixe werden ignoriert
+ // BASIC-Standard-Suffixes were ignored
if( *p && (*p == '%' || *p == '&' || *p == '!' || *p == '#' || *p == '$' ) )
p++;
}
@@ -102,7 +101,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
return p;
}
-// Qualifizierter Name. Element.Element....
+// Qualified name. Element.Element....
static SbxVariable* QualifiedName
( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, SbxClassType t )
@@ -113,21 +112,21 @@ static SbxVariable* QualifiedName
const xub_Unicode* p = SkipWhitespace( *ppBuf );
if( aCharClass.isAlpha( *p ) || *p == '_' || *p == '[' )
{
- // Element einlesen
+ // Read in the element
refVar = Element( pObj, pGbl, &p, t, aCharClass );
while( refVar.Is() && (*p == '.' || *p == '!') )
{
- // Es folgt noch ein Objektelement. Das aktuelle Element
- // muss also ein SBX-Objekt sein oder liefern!
+ // It follows still an objectelement. The current element
+ // had to be a SBX-Object or had to deliver such an object!
pObj = PTR_CAST(SbxObject,(SbxVariable*) refVar);
if( !pObj )
- // Dann muss es ein Objekt liefern
+ // Then it had to deliver an object
pObj = PTR_CAST(SbxObject,refVar->GetObject());
refVar.Clear();
if( !pObj )
break;
p++;
- // Und das naechste Element bitte
+ // And the next element please
refVar = Element( pObj, pGbl, &p, t, aCharClass );
}
}
@@ -139,8 +138,8 @@ static SbxVariable* QualifiedName
return refVar;
}
-// Einlesen eines Operanden. Dies kann eine Zahl, ein String oder
-// eine Funktion (mit optionalen Parametern) sein.
+// Read in of an operand. This could be a number, a string or
+// a function (with optional parameters).
static SbxVariable* Operand
( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf, BOOL bVar )
@@ -154,7 +153,7 @@ static SbxVariable* Operand
|| *p == '-'
|| *p == '&' ) )
{
- // Eine Zahl kann direkt eingescant werden!
+ // A number could be scanned in directly!
USHORT nLen;
if( !refVar->Scan( XubString( p ), &nLen ) )
refVar.Clear();
@@ -163,15 +162,15 @@ static SbxVariable* Operand
}
else if( !bVar && *p == '"' )
{
- // Ein String
+ // A string
XubString aString;
p++;
for( ;; )
{
- // Das ist wohl ein Fehler
+ // This is perhaps an error
if( !*p )
return NULL;
- // Doppelte Quotes sind OK
+ // Double quotes are OK
if( *p == '"' )
if( *++p != '"' )
break;
@@ -187,8 +186,8 @@ static SbxVariable* Operand
return refVar;
}
-// Einlesen einer einfachen Term. Die Operatoren +, -, * und /
-// werden unterstuetzt.
+// Read in of a simple term. The operands +, -, * and /
+// are supported.
static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf )
{
@@ -201,7 +200,7 @@ static SbxVariable* MulDiv( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
SbxVariableRef refVar2( Operand( pObj, pGbl, &p, FALSE ) );
if( refVar2.Is() )
{
- // temporaere Variable!
+ // temporary variable!
SbxVariable* pVar = refVar;
pVar = new SbxVariable( *pVar );
refVar = pVar;
@@ -263,7 +262,7 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
{
if( *p == '=' )
{
- // Nur auf Props zuweisen!
+ // Assign only onto properties!
if( refVar->GetClass() != SbxCLASS_PROPERTY )
{
SbxBase::SetError( SbxERR_BAD_ACTION );
@@ -283,7 +282,7 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
}
}
else
- // Einfacher Aufruf: einmal aktivieren
+ // Simple call: once activating
refVar->Broadcast( SBX_HINT_DATAWANTED );
}
*ppBuf = p;
@@ -292,9 +291,9 @@ static SbxVariable* Assign( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode*
return refVar;
}
-// Einlesen eines Elements. Dies ist ein Symbol, optional gefolgt
-// von einer Parameterliste. Das Symbol wird im angegebenen Objekt
-// gesucht und die Parameterliste wird ggf. angefuegt.
+// Read in of an element. This is a symbol, optional followed
+// by a parameter list. The symbol will be searched in the
+// specified object and the parameter list will be attached if necessary.
static SbxVariable* Element
( SbxObject* pObj, SbxObject* pGbl, const xub_Unicode** ppBuf,
@@ -313,29 +312,29 @@ static SbxVariable* Element
if( refVar.Is() )
{
refVar->SetParameters( NULL );
- // folgen noch Parameter?
+ // Follow still parameter?
p = SkipWhitespace( p );
if( *p == '(' )
{
p++;
SbxArrayRef refPar = new SbxArray;
USHORT nArg = 0;
- // Wird sind mal relaxed und akzeptieren auch
- // das Zeilen- oder Komandoende als Begrenzer
- // Parameter immer global suchen!
+ // We are once relaxed and accept as well
+ // the line- or commandend as delimiter
+ // Search parameter always global!
while( *p && *p != ')' && *p != ']' )
{
SbxVariableRef refArg = PlusMinus( pGbl, pGbl, &p );
if( !refArg )
{
- // Fehler beim Parsing
+ // Error during the parsing
refVar.Clear(); break;
}
else
{
- // Man kopiere den Parameter, damit
- // man den aktuellen Zustand hat (loest auch
- // den Aufruf per Zugriff aus)
+ // One copies the parameter, so that
+ // one have the current status (triggers also
+ // the call per access)
SbxVariable* pArg = refArg;
refPar->Put( new SbxVariable( *pArg ), ++nArg );
}
@@ -358,7 +357,7 @@ static SbxVariable* Element
return refVar;
}
-// Hauptroutine
+// Mainroutine
SbxVariable* SbxObject::Execute( const XubString& rTxt )
{
@@ -399,3 +398,4 @@ SbxVariable* SbxObject::FindQualified( const XubString& rName, SbxClassType t )
return pVar;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index b847646957..533de965db 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1166,3 +1167,4 @@ BOOL SbxBasicFormater::isBasicFormat( String sFormatStrg )
return FALSE;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 0ed76dfdef..cc973d23da 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -95,6 +96,22 @@ start:
else
nRes = (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 = (INT16) (tstVal);
+ break;
+ }
case SbxSALINT64:
if( p->nInt64 > SbxMAXINT )
{
@@ -117,22 +134,12 @@ start:
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 );
}
@@ -150,7 +157,7 @@ start:
else
nRes = (INT16) ImpRound( dVal );
break;
- }
+ }
case SbxLPSTR:
case SbxSTRING:
case SbxBYREF | SbxSTRING:
@@ -194,7 +201,7 @@ start:
case SbxBYREF | SbxBOOL:
nRes = *p->pInteger; break;
- // ab hier muss getestet werden
+ // from here had to be tested
case SbxBYREF | SbxLONG:
aTmp.nLong = *p->pLong; goto ref;
case SbxBYREF | SbxULONG:
@@ -207,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:
@@ -232,7 +235,7 @@ void ImpPutInteger( SbxValues* p, INT16 n )
start:
switch( +p->eType )
{
- // hier muss getestet werden
+ // here had to be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -248,7 +251,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // from here no tests needed
case SbxINTEGER:
case SbxBOOL:
p->nInteger = n; break;
@@ -259,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 );
@@ -322,12 +321,15 @@ start:
SbxBase::SetError( SbxERR_OVERFLOW ); n = 0;
}
*p->pULong = (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;
@@ -337,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 );
@@ -384,6 +380,7 @@ sal_uInt64 ImpDoubleToSalUInt64( double d )
return nRes;
}
+
double ImpSalUInt64ToDouble( sal_uInt64 n )
{
double d = 0.0;
@@ -415,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:
@@ -471,7 +455,7 @@ start:
if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
nRes = 0;
else
- nRes = ImpDoubleToSalInt64( d );
+ nRes = (sal_Int64) d;
}
}
break;
@@ -498,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;
@@ -510,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;
@@ -542,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:
@@ -554,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;
@@ -561,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:
@@ -659,16 +636,7 @@ start:
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:
@@ -709,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 )
{
@@ -737,6 +694,7 @@ start:
}
else
nRes = (sal_uInt64) p->nInt64;
+ break;
case SbxSALUINT64:
nRes = p->uInt64; break;
@@ -804,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;
@@ -813,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:
@@ -845,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:
@@ -857,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:
@@ -938,14 +888,12 @@ start:
*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:
@@ -961,3 +909,4 @@ start:
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index 8ef9f5bd86..6fb566d8ad 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -74,28 +75,28 @@ start:
else
nRes = (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 = (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 )
@@ -161,7 +162,7 @@ start:
case SbxBYREF | SbxLONG:
nRes = *p->pLong; break;
- // ab hier muss getestet werden
+ // from here had to be tested
case SbxBYREF | SbxULONG:
aTmp.nULong = *p->pULong; goto ref;
case SbxBYREF | SbxERROR:
@@ -172,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;
@@ -198,7 +196,7 @@ void ImpPutLong( SbxValues* p, INT32 n )
start:
switch( +p->eType )
{
- // Ab hier muss getestet werden
+ // From here had to be tested
case SbxCHAR:
aTmp.pChar = &p->nChar; goto direct;
case SbxBYTE:
@@ -206,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:
@@ -222,7 +215,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // ab hier nicht mehr
+ // from here no longer
case SbxLONG:
p->nLong = n; break;
case SbxSINGLE:
@@ -230,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:
@@ -319,23 +314,10 @@ 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 );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxmstrm.cxx b/basic/source/sbx/sbxmstrm.cxx
index f9db6de140..c2eeaeff7d 100644
--- a/basic/source/sbx/sbxmstrm.cxx
+++ b/basic/source/sbx/sbxmstrm.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,3 +38,5 @@ SbxDataType SbxMemoryStream::GetType() const
SbxMemoryStream::~SbxMemoryStream()
{
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 43ee8e6944..197beeba40 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -1,10 +1,11 @@
+/* -*- 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
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* This file is part of OpenOffice.org.
*
@@ -30,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>
@@ -78,11 +78,11 @@ 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() );
@@ -98,7 +98,7 @@ static void CheckParentsOnDelete( SbxObject* pObj, SbxArray* p )
SbxVariableRef& rRef = p->GetRef( i );
if( rRef->IsBroadcaster() )
pObj->EndListening( rRef->GetBroadcaster(), TRUE );
- // Hat das Element mehr als eine Referenz und noch einen Listener?
+ // Did the element have more then one reference and still a Listener?
if( rRef->GetRefCount() > 1 )
{
rRef->SetParent( NULL );
@@ -191,16 +191,16 @@ 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!
+ // I myself was already searched through!
USHORT nOwn = pCur->GetFlags();
pCur->ResetFlag( SBX_EXTSEARCH );
- // Ich suche bereits global!
+ // I search already global!
USHORT nPar = pCur->pParent->GetFlags();
pCur->pParent->ResetFlag( SBX_GBLSEARCH );
pRes = pCur->pParent->FindUserData( nData );
@@ -253,21 +253,21 @@ 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!
+ // I myself was already searched through!
USHORT nOwn = pCur->GetFlags();
pCur->ResetFlag( SBX_EXTSEARCH );
- // Ich suche bereits global!
+ // I search already global!
USHORT nPar = pCur->pParent->GetFlags();
pCur->pParent->ResetFlag( SBX_GBLSEARCH );
pRes = pCur->pParent->Find( rName, t );
@@ -289,16 +289,16 @@ 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 )
{
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 );
@@ -309,7 +309,7 @@ BOOL SbxObject::Call( const XubString& rName, SbxArray* pParam )
return FALSE;
}
-SbxProperty* SbxObject::GetDfltProperty()
+SbxProperty* SbxObject::GetDfltProperty()
{
if ( !pDfltProp && aDfltPropName.Len() )
{
@@ -322,7 +322,7 @@ SbxProperty* SbxObject::GetDfltProperty()
void SbxObject::SetDfltProperty( const XubString& rName )
{
if ( rName != aDfltPropName )
- pDfltProp = NULL;
+ pDfltProp = NULL;
aDfltPropName = rName;
SetModified( TRUE );
}
@@ -342,9 +342,9 @@ void SbxObject::SetDfltProperty( SbxProperty* p )
SetModified( 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 )
{
@@ -361,7 +361,7 @@ 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 )
@@ -377,12 +377,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 )
{
@@ -395,13 +395,13 @@ 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
+/* Due to often problems (e.g. #67000) first of all completly out
#ifdef DBG_UTIL
if( pRes->GetHashCode() != nNameHash
&& pRes->GetHashCode() != nParentHash )
@@ -436,7 +436,7 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
pVar->SetParent( this );
pArray->Put( pVar, pArray->Count() );
SetModified( TRUE );
- // Das Objekt lauscht immer
+ // The object listen always
StartListening( pVar->GetBroadcaster(), TRUE );
Broadcast( SBX_HINT_OBJECTCHANGED );
return pVar;
@@ -444,13 +444,13 @@ SbxVariable* SbxObject::Make( const XubString& rName, SbxClassType ct, SbxDataTy
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
+/* Due to often problems (e.g. #67000) first of all completly out
#ifdef DBG_UTIL
if( pRes->GetHashCode() != nNameHash
&& pRes->GetHashCode() != nParentHash )
@@ -474,7 +474,7 @@ SbxObject* SbxObject::MakeObject( const XubString& rName, const XubString& rClas
pVar->SetParent( this );
pObjs->Put( pVar, pObjs->Count() );
SetModified( TRUE );
- // Das Objekt lauscht immer
+ // The object listen always
StartListening( pVar->GetBroadcaster(), TRUE );
Broadcast( SBX_HINT_OBJECTCHANGED );
}
@@ -487,21 +487,21 @@ void SbxObject::Insert( SbxVariable* pVar )
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
+/* Due to often problems (e.g. #67000) first of all completly out
#ifdef DBG_UTIL
if( pOld->GetHashCode() != nNameHash
&& pOld->GetHashCode() != nParentHash )
@@ -545,8 +545,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
+// From 1997-04-23, 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;
@@ -585,7 +585,7 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Spezial-Methode, gleichnamige Controls zulassen
+// From 1997-03-23, special method, allow controls of the same name
void SbxObject::VCPtrInsert( SbxVariable* pVar )
{
SbxArray* pArray = NULL;
@@ -643,11 +643,11 @@ void SbxObject::Remove( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Loeschen per Pointer fuer Controls (doppelte Namen!)
+// From 1997-03-23, cleanup per Pointer for Controls (double names!)
void SbxObject::VCPtrRemove( SbxVariable* pVar )
{
USHORT nIdx;
- // Neu FindVar-Methode, sonst identisch mit normaler Methode
+ // New FindVar-Method, otherwise identical with the normal method
SbxArray* pArray = VCPtrFindVar( pVar, nIdx );
if( pArray && nIdx < pArray->Count() )
{
@@ -664,7 +664,7 @@ void SbxObject::VCPtrRemove( SbxVariable* pVar )
}
}
-// AB 23.3.1997, Zugehoerige Spezial-Methode, nur ueber Pointer suchen
+// From 1997-03-23, associated special method, search only by Pointer
SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, USHORT& nArrayIdx )
{
SbxArray* pArray = NULL;
@@ -732,19 +732,19 @@ static BOOL LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray )
return TRUE;
}
-// Der Load eines Objekts ist additiv!
+// The load of an object is additive!
BOOL SbxObject::LoadData( SvStream& rStrm, USHORT 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;
pDfltProp = NULL;
if( !SbxVariable::LoadData( rStrm, nVer ) )
return FALSE;
- // Wenn kein fremdes Objekt enthalten ist, uns selbst eintragen
+ // If it contains no alien object, insert ourselves
if( aData.eType == SbxOBJECT && !aData.pObj )
aData.pObj = this;
sal_uInt32 nSize;
@@ -764,7 +764,7 @@ BOOL SbxObject::LoadData( SvStream& rStrm, USHORT nVer )
|| !LoadArray( rStrm, this, pProps )
|| !LoadArray( rStrm, this, pObjs ) )
return FALSE;
- // Properties setzen
+ // Set properties
if( aDfltProp.Len() )
pDfltProp = (SbxProperty*) pProps->Find( aDfltProp, SbxCLASS_PROPERTY );
SetModified( FALSE );
@@ -801,10 +801,10 @@ BOOL SbxObject::StoreData( SvStream& rStrm ) const
XubString SbxObject::GenerateSource( const XubString &rLinePrefix,
const SbxObject* )
{
- // Properties in einem String einsammeln
+ // Collect the properties in a String
XubString aSource;
SbxArrayRef xProps( GetProperties() );
- FASTBOOL bLineFeed = FALSE;
+ bool bLineFeed = false;
for ( USHORT nProp = 0; nProp < xProps->Count(); ++nProp )
{
SbxPropertyRef xProp = (SbxProperty*) xProps->Get(nProp);
@@ -813,28 +813,28 @@ 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
- bLineFeed = TRUE;
+ bLineFeed = true;
aSource += rLinePrefix;
aSource += '.';
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( "\"" );
@@ -843,7 +843,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;
}
@@ -892,7 +892,7 @@ static BOOL CollectAttrs( const SbxBase* p, XubString& rRes )
void SbxObject::Dump( SvStream& rStrm, BOOL bFill )
{
- // Einr"uckung
+ // Shifting
static USHORT nLevel = 0;
if ( nLevel > 10 )
{
@@ -904,11 +904,11 @@ void SbxObject::Dump( SvStream& rStrm, BOOL bFill )
for ( USHORT 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( "
@@ -957,7 +957,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 &&
@@ -990,7 +990,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 &&
@@ -1051,98 +1051,18 @@ SbxClassType SbxProperty::GetClass() const
return SbxCLASS_PROPERTY;
}
-void SbxObject::GarbageCollection( ULONG nObjects )
+void SbxObject::GarbageCollection( ULONG /*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
*/
{
- (void)nObjects;
-
- static BOOL bInGarbageCollection = FALSE;
- if ( bInGarbageCollection )
- return;
- bInGarbageCollection = TRUE;
-
-#if 0
- // erstes Object dieser Runde anspringen
- BOOL bAll = !nObjects;
- if ( bAll )
- rObjects.First();
- SbxObject *pObj = rObjects.GetCurObject();
- if ( !pObj )
- pObj = rObjects.First();
-
- while ( pObj && 0 != nObjects-- )
- {
- // hat der Parent nur noch 1 Ref-Count?
- SbxObject *pParent = PTR_CAST( SbxObject, pObj->GetParent() );
- if ( pParent && 1 == pParent->GetRefCount() )
- {
- // dann alle Properies des Objects durchsuchen
- SbxArray *pProps = pObj->GetProperties();
- for ( USHORT n = 0; n < pProps->Count(); ++n )
- {
- // verweist die Property auf den Parent des Object?
- SbxVariable *pProp = pProps->Get(n);
- const SbxValues &rValues = pProp->GetValues_Impl();
- if ( SbxOBJECT == rValues.eType &&
- pParent == rValues.pObj )
- {
-#ifdef DBG_UTIL
- DbgOutf( "SBX: %s.%s with Object %s was garbage",
- pObj->GetName().GetStr(),
- pProp->GetName().GetStr(),
- pParent->GetName().GetStr() );
-#endif
- // dann freigeben
- pProp->SbxValue::Clear();
- Sound::Beep();
- break;
- }
- }
- }
-
- // zum n"achsten
- pObj = rObjects.Next();
- if ( !bAll && !pObj )
- pObj = rObjects.First();
- }
-#endif
-
-// AB 28.10. Zur 507a vorerst raus, da SfxBroadcaster::Enable() wegfaellt
-#if 0
-#ifdef DBG_UTIL
- SbxVarList_Impl &rVars = GetSbxData_Impl()->aVars;
- DbgOutf( "SBX: garbage collector done, %lu objects remainding",
- rVars.Count() );
- if ( rVars.Count() > 200 && rVars.Count() < 210 )
- {
- SvFileStream aStream( "d:\\tmp\\dump.sbx", STREAM_STD_WRITE );
- SfxBroadcaster::Enable(FALSE);
- for ( ULONG n = 0; n < rVars.Count(); ++n )
- {
- SbxVariable *pVar = rVars.GetObject(n);
- SbxObject *pObj = PTR_CAST(SbxObject, pVar);
- USHORT nFlags = pVar->GetFlags();
- pVar->SetFlag(SBX_NO_BROADCAST);
- if ( pObj )
- pObj->Dump(aStream);
- else if ( !pVar->GetParent() || !pVar->GetParent()->ISA(SbxObject) )
- pVar->Dump(aStream);
- pVar->SetFlags(nFlags);
- }
- SfxBroadcaster::Enable(TRUE);
- }
-#endif
-#endif
- bInGarbageCollection = FALSE;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx
index 40cae63485..612911aaad 100644
--- a/basic/source/sbx/sbxres.cxx
+++ b/basic/source/sbx/sbxres.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -75,7 +76,7 @@ static const char* pSbxRes[] = {
"Item",
"Remove",
- "Error ", // mit Blank!
+ "Error ", // with blank!
"False",
"True"
};
@@ -89,3 +90,4 @@ SbxRes::SbxRes( USHORT nId )
: ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) )
{}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx
index 1685123c5f..eb2e202665 100644
--- a/basic/source/sbx/sbxres.hxx
+++ b/basic/source/sbx/sbxres.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,9 @@
#include <tools/string.hxx>
-// Zur Zeit sind Ressources im SVTOOLS-Projekt nicht vorgesehen.
-// Da es sich um unkritische Ressourcen handelt (BASIC-Keywords),
-// koennen wir mit Dummies arbeiten.
+// Currently there are no resources provided in the SVTOOLS-Project.
+// Because it is non-critical resources (BASIC-Keywords),
+// we can work with dummies.
#define STRING_TYPES 0
#define STRING_EMPTY 0
@@ -85,3 +86,5 @@ const char* GetSbxRes( USHORT );
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 3bf354c41a..5fb1f8e6e3 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,9 +38,7 @@
#include <stdlib.h>
#endif
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <math.h>
#include <string.h>
#include <ctype.h>
@@ -406,7 +405,7 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreStrin
*p++ = '-';
}
double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14;
- myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum > dMaxNumWithoutExp ) ) ? 4:0,
+ myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >= dMaxNumWithoutExp ) ) ? 4:0,
FALSE, TRUE, cDecimalSep );
// Trailing Zeroes weg:
for( p = cBuf; *p &&( *p != 'E' ); p++ ) {}
@@ -663,7 +662,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
@@ -675,12 +674,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 ),
@@ -698,7 +697,7 @@ VbaFormatInfo* getFormatInfo( const String& rFmt )
{
if( rFmt.EqualsIgnoreCaseAscii( pInfo->mpVbaFormat ) )
break;
- i++;
+ i++;
}
return pInfo;
}
@@ -725,7 +724,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 ) )
{
@@ -743,7 +742,7 @@ 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 );
@@ -755,7 +754,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
BOOL bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, nNumber );
- // number format, use SvNumberFormatter to handle it.
+ // number format, use SvNumberFormatter to handle it.
if( bSuccess )
{
String aFmtStr = *pFmt;
@@ -774,14 +773,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 )
{
@@ -802,7 +801,7 @@ 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 );
if( nMin < 10 && aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ) )
@@ -889,7 +888,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
sal_Unicode cComma = rData.getNumDecimalSep().GetBuffer()[0];
sal_Unicode c1000 = rData.getNumThousandSep().GetBuffer()[0];
String aCurrencyStrg = rData.getCurrSymbol();
-
+
// Initialisierung des Basic-Formater-Hilfsobjekts:
// hole die Resourcen f"ur die vordefinierten Ausgaben
// des Format()-Befehls, z.B. f"ur "On/Off".
@@ -966,3 +965,4 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 521a8ff04a..04eae155af 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,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 )
@@ -71,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;
@@ -95,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 );
@@ -162,19 +160,15 @@ start:
nRes = *p->pUShort; break;
case SbxBYREF | SbxSINGLE:
nRes = *p->pSingle; break;
- // ab hier muss getestet werden
+ // from here had to be tested
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;
@@ -205,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:
@@ -226,7 +216,7 @@ start:
aTmp.eType = SbxDataType( p->eType | SbxBYREF );
p = &aTmp; goto start;
- // keine Tests ab hier
+ // from here no tests
case SbxSINGLE:
p->nSingle = n; break;
case SbxDATE:
@@ -333,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 )
@@ -350,10 +340,11 @@ start:
{
d = n;
}
- *p->pLong64 = ImpDoubleToCurrency( n ); break;
+ *p->pnInt64 = ImpDoubleToCurrency( d ); break;
default:
SbxBase::SetError( SbxERR_CONVERSION );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index b4d1c402dd..f0cbe7ed0c 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,17 +33,10 @@
#include "sbxconv.hxx"
#include "sbxres.hxx"
#include "runtime.hxx"
-#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
-#endif
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
-// 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 )
{
@@ -75,7 +69,7 @@ using namespace rtl;
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;
@@ -107,7 +101,7 @@ using namespace rtl;
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:
@@ -133,7 +127,7 @@ using namespace rtl;
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:
@@ -147,16 +141,16 @@ using namespace rtl;
// AB 10.4.97, neue Funktion fuer 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, TRUE ); // true = bCoreString
else
- ImpPutDouble( &aTmp, *p->pDouble, /*bCoreString=*/TRUE );
+ ImpPutDouble( &aTmp, *p->pDouble, TRUE ); // true = bCoreString
return aRes;
}
else
@@ -194,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 );
@@ -250,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)
{
@@ -293,7 +292,7 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr)
::rtl::OUString ByteArrayToString(SbxArray* pArr)
{
USHORT nCount = pArr->Count();
- OUStringBuffer aStrBuf;
+ ::rtl::OUStringBuffer aStrBuf;
sal_Unicode aChar = 0;
for( USHORT i = 0 ; i < nCount ; i++ )
{
@@ -317,3 +316,6 @@ 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 94eca8aa34..e7cde92520 100644
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,6 +81,18 @@ start:
else
nRes = (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 = (UINT16) (p->nInt64 / CURRENCY_FACTOR);
+ break;
case SbxSALINT64:
if( p->nInt64 > SbxMAXUINT )
{
@@ -114,20 +127,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 )
@@ -189,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:
@@ -204,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:
@@ -242,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:
@@ -313,19 +309,16 @@ 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 );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index b68358c246..687ecd8072 100644
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -84,8 +85,6 @@ start:
break;
case SbxDATE:
case SbxDOUBLE:
- case SbxLONG64:
- case SbxULONG64:
case SbxSALINT64:
case SbxSALUINT64:
case SbxCURRENCY:
@@ -94,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 )
@@ -167,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:
@@ -180,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;
@@ -212,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:
@@ -221,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:
@@ -234,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;
@@ -298,24 +285,16 @@ 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 );
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 945e66ceaf..70466ffd50 100755
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,163 +29,22 @@
// 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"
-// AB 29.10.99 Unicode
-#ifndef _USE_NO_NAMESPACE
-using namespace rtl;
-#endif
-
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;
-}
-/////////////////////////// Fehlerbehandlung /////////////////////////////
+///////////////////////////// error handling //////////////////////////////
+// bring back ?? was ever in ?? currently ifdef out ?
#ifdef _USED
-// NOCH NACHZUBAUEN!
+// STILL Reverse ENGINEERING!
-// Das Default-Handling setzt nur den Fehlercode.
+// The default handling sets the error code only.
#ifndef WNT
#if defined ( UNX )
@@ -208,8 +68,7 @@ int matherr( struct _exception* p )
#endif // _USED
-
-///////////////////////////// Konstruktoren //////////////////////////////
+///////////////////////////// constructors //////////////////////////////
SbxValue::SbxValue() : SbxBase()
{
@@ -229,9 +88,9 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase()
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 SbxSALUINT64: n |= SbxBYREF; aData.puInt64 = (sal_uInt64*) p; break;
+ case SbxSALINT64:
+ case SbxCURRENCY: n |= SbxBYREF; aData.pnInt64 = (sal_Int64*) p; break;
case SbxLONG: n |= SbxBYREF; aData.pLong = (INT32*) p; break;
case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break;
case SbxDATE:
@@ -241,7 +100,7 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase()
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 SbxCHAR: n |= SbxBYREF; aData.pChar = (sal_Unicode*) p; break;
case SbxBYTE: n |= SbxBYREF; aData.pByte = (BYTE*) p; break;
case SbxINT: n |= SbxBYREF; aData.pInt = (int*) p; break;
case SbxOBJECT:
@@ -276,7 +135,7 @@ SbxValue::SbxValue( const SbxValue& r )
{
((SbxValue*) &r)->Broadcast( SBX_HINT_DATAWANTED );
aData = r.aData;
- // Pointer kopieren, Referenzen inkrementieren
+ // Copy pointer, increment references
switch( aData.eType )
{
case SbxSTRING:
@@ -306,7 +165,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
{
// string -> byte array
if( IsFixed() && (aData.eType == SbxOBJECT)
- && aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
+ && aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
&& (r.aData.eType == SbxSTRING) )
{
::rtl::OUString aStr = r.GetString();
@@ -328,16 +187,16 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
return *this;
}
}
- // Den Inhalt der Variablen auslesen
+ // Readout the content of the variables
SbxValues aNew;
if( IsFixed() )
- // fest: dann muss der Typ stimmen
+ // firm: then the type had to match
aNew.eType = aData.eType;
else if( r.IsFixed() )
- // Quelle fest: Typ uebernehmen
+ // Source firm: take over the type
aNew.eType = SbxDataType( r.aData.eType & 0x0FFF );
else
- // beides Variant: dann isses egal
+ // both variant: then it is equal
aNew.eType = SbxVARIANT;
if( r.Get( aNew ) )
Put( aNew );
@@ -353,10 +212,10 @@ SbxValue::~SbxValue()
SetFlag( SBX_WRITE );
SbxValue::Clear();
#else
- // Provisorischer Fix fuer Solaris 5.0 Compiler Bug
- // bei Nutzung virtueller Vererbung. Virtuelle Calls
- // im Destruktor vermeiden. Statt Clear() zu rufen
- // moegliche Objekt-Referenzen direkt freigeben.
+ // Provisional fix for the Solaris 5.0 compiler bbug
+ // at using virtual inheritance. Avoid virtual calls
+ // in the destructor. Instead of calling clear()
+ // de-allocate posible object references direct.
if( aData.eType == SbxOBJECT )
{
if( aData.pObj && aData.pObj != this )
@@ -423,12 +282,12 @@ void SbxValue::Clear()
void SbxValue::Broadcast( ULONG )
{}
-//////////////////////////// Daten auslesen //////////////////////////////
+//////////////////////////// Readout data //////////////////////////////
-// Ermitteln der "richtigen" Variablen. Falls es ein Objekt ist, wird
-// entweder das Objekt selbst oder dessen Default-Property angesprochen.
-// Falls die Variable eine Variable oder ein Objekt enthaelt, wird
-// dieses angesprochen.
+// Detect the "right" variables. If it is an object, will be addressed either
+// the object itself or its default property.
+// If the variable contain a variable or an object, this will be
+// addressed.
SbxValue* SbxValue::TheRealValue() const
{
@@ -446,19 +305,19 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
SbxDataType t = SbxDataType( p->aData.eType & 0x0FFF );
if( t == SbxOBJECT )
{
- // Der Block enthaelt ein Objekt oder eine Variable
+ // The block contains an object or a variable
SbxObject* pObj = PTR_CAST(SbxObject,p->aData.pObj);
if( pObj )
{
- // Hat das Objekt eine Default-Property?
+ // Has the object a default property?
SbxVariable* pDflt = pObj->GetDfltProperty();
- // Falls dies ein Objekt ist und sich selbst enthaelt,
- // koennen wir nicht darauf zugreifen
- // #55226# Die alte Bedingung, um einen Fehler zu setzen,
- // ist nicht richtig, da z.B. eine ganz normale Variant-
- // Variable mit Objekt davon betroffen sein kann, wenn ein
- // anderer Wert zugewiesen werden soll. Daher mit Flag.
+ // If this is an object and contains itself,
+ // we cannot access on it
+ // #55226# 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.
if( bObjInObjError && !pDflt &&
((SbxValue*) pObj)->aData.eType == SbxOBJECT &&
((SbxValue*) pObj)->aData.pObj == pObj )
@@ -478,18 +337,18 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
*/
break;
}
- // Haben wir ein Array?
+ // Did we have an array?
SbxArray* pArray = PTR_CAST(SbxArray,p->aData.pObj);
if( pArray )
{
- // Ggf. Parameter holen
+ // When indicated get the parameter
SbxArray* pPar = NULL;
SbxVariable* pVar = PTR_CAST(SbxVariable,p);
if( pVar )
pPar = pVar->GetParameters();
if( pPar )
{
- // Haben wir ein dimensioniertes Array?
+ // Did we have a dimensioned array?
SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,p->aData.pObj);
if( pDimArray )
p = pDimArray->Get( pPar );
@@ -498,7 +357,7 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
break;
}
}
- // Sonst einen SbxValue annehmen
+ // Elsewise guess a SbxValue
SbxValue* pVal = PTR_CAST(SbxValue,p->aData.pObj);
if( pVal )
p = pVal;
@@ -524,8 +383,8 @@ BOOL SbxValue::Get( SbxValues& rRes ) const
}
else
{
- // Falls nach einem Objekt oder einem VARIANT gefragt wird, nicht
- // die wahren Werte suchen
+ // If there was asked for an object or a VARIANT, don't search
+ // the real values
SbxValue* p = (SbxValue*) this;
if( rRes.eType != SbxOBJECT && rRes.eType != SbxVARIANT )
p = TheRealValue();
@@ -544,7 +403,7 @@ 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:
@@ -595,7 +454,7 @@ BOOL SbxValue::Get( SbxValues& rRes ) const
}
else
{
- // Objekt enthielt sich selbst
+ // Object contained itself
SbxDataType eTemp = rRes.eType;
memset( &rRes, 0, sizeof( SbxValues ) );
rRes.eType = eTemp;
@@ -675,28 +534,26 @@ BOOL SbxValue::GetBool() const
#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 )
-
-
-//////////////////////////// Daten schreiben /////////////////////////////
+GET( GetByte, SbxBYTE, BYTE, nByte )
+GET( GetChar, SbxCHAR, xub_Unicode, nChar )
+GET( GetCurrency, SbxCURRENCY, sal_Int64, nInt64 )
+GET( GetDate, SbxDATE, double, nDouble )
+GET( GetData, SbxDATAOBJECT, void*, pData )
+GET( GetDouble, SbxDOUBLE, double, nDouble )
+GET( GetErr, SbxERROR, UINT16, nUShort )
+GET( GetInt, SbxINT, int, nInt )
+GET( GetInteger, SbxINTEGER, INT16, nInteger )
+GET( GetLong, SbxLONG, INT32, nLong )
+GET( GetObject, SbxOBJECT, SbxBase*, pObj )
+GET( GetSingle, SbxSINGLE, float, nSingle )
+GET( GetULong, SbxULONG, UINT32, nULong )
+GET( GetUShort, SbxUSHORT, 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 )
{
@@ -710,11 +567,11 @@ BOOL SbxValue::Put( const SbxValues& rVal )
SetError( SbxERR_NOTIMP );
else
{
- // Falls nach einem Objekt gefragt wird, nicht
- // die wahren Werte suchen
+ // If there was asked for an object, don't search
+ // the real values
SbxValue* p = this;
if( rVal.eType != SbxOBJECT )
- p = TheRealValue( FALSE ); // #55226 Hier keinen Fehler erlauben
+ p = TheRealValue( FALSE ); // #55226 Don't allow an error here
if( p )
{
if( !p->CanWrite() )
@@ -731,7 +588,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;
@@ -758,17 +615,17 @@ BOOL SbxValue::Put( const SbxValues& rVal )
case SbxOBJECT:
if( !p->IsFixed() || p->aData.eType == SbxOBJECT )
{
- // ist schon drin
+ // is already inside
if( p->aData.eType == SbxOBJECT && p->aData.pObj == rVal.pObj )
break;
- // Nur den Werteteil loeschen!
+ // Delete only the value part!
p->SbxValue::Clear();
- // eingentliche Zuweisung
+ // real allocation
p->aData.pObj = rVal.pObj;
- // ggf. Ref-Count mitzaehlen
+ // if necessary cont in Ref-Count
if( p->aData.pObj && p->aData.pObj != p )
{
if ( p != this )
@@ -821,24 +678,24 @@ BOOL SbxValue::PutStringExt( const ::rtl::OUString& r )
// Kopieren, bei Unicode gleich konvertieren
::rtl::OUString aStr( r );
- // Eigenen Typ bestimmen (nicht wie in Put() mit TheRealValue(),
- // Objekte werden sowieso nicht behandelt)
+ // Identify the own type (not as in Put() with TheRealValue(),
+ // Objects are not handled anyway)
SbxDataType eTargetType = SbxDataType( aData.eType & 0x0FFF );
- // Source-Value basteln
+ // tinker a Source-Value
SbxValues aRes;
aRes.eType = SbxSTRING;
- // Nur, wenn wirklich was konvertiert wurde, Kopie nehmen,
- // sonst Original (Unicode bleibt erhalten)
+ // Only if really something was converted, take the copy,
+ // elsewise take the original (Unicode remain)
BOOL bRet;
if( ImpConvStringExt( aStr, eTargetType ) )
aRes.pOUString = (::rtl::OUString*)&aStr;
else
aRes.pOUString = (::rtl::OUString*)&r;
- // #34939: Bei Strings. die eine Zahl enthalten und wenn this einen
- // Num-Typ hat, Fixed-Flag setzen, damit der Typ nicht veraendert wird
+ // #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();
if( ( eTargetType >= SbxINTEGER && eTargetType <= SbxCURRENCY ) ||
( eTargetType >= SbxCHAR && eTargetType <= SbxUINT ) ||
@@ -853,8 +710,8 @@ BOOL SbxValue::PutStringExt( const ::rtl::OUString& r )
Put( aRes );
bRet = BOOL( !IsError() );
- // Falls das mit dem FIXED einen Error gegeben hat, zuruecksetzen
- // (UI-Aktion sollte keinen Error ergeben, sondern nur scheitern)
+ // If it throwed an error with FIXED, set it back
+ // (UI-Action should not cast an error, but only fail)
if( !bRet )
ResetError();
@@ -945,8 +802,8 @@ BOOL SbxValue::p( t n ) \
{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return BOOL( !IsError() ); }
PUT( PutByte, SbxBYTE, BYTE, nByte )
-PUT( PutChar, SbxCHAR, xub_Unicode, nChar )
-PUT( PutCurrency, SbxCURRENCY, const SbxINT64&, nLong64 )
+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 )
@@ -954,28 +811,26 @@ PUT( PutErr, SbxERROR, UINT16, nUShort )
PUT( PutInt, SbxINT, int, nInt )
PUT( PutInteger, SbxINTEGER, INT16, nInteger )
PUT( PutLong, SbxLONG, INT32, nLong )
-PUT( PutLong64, SbxLONG64, const SbxINT64&, nLong64 )
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( PutInt64, SbxSALINT64, sal_Int64, nInt64 )
PUT( PutUInt64, SbxSALUINT64, sal_uInt64, uInt64 )
PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal )
-////////////////////////// Setzen des Datentyps ///////////////////////////
+////////////////////////// Setting of the data type ///////////////////////////
BOOL SbxValue::IsFixed() const
{
return ( (GetFlags() & SBX_FIXED) | (aData.eType & SbxBYREF) ) != 0;
}
-// Eine Variable ist numerisch, wenn sie EMPTY oder wirklich numerisch ist
-// oder einen vollstaendig konvertierbaren String enthaelt
+// A variable is numeric, if it is EMPTY or realy numeric
+// or if it contains a complete convertible String
-// #41692, fuer RTL und Basic-Core getrennt implementieren
+// #41692, implement it for RTL and Basic-Core seperably
BOOL SbxValue::IsNumeric() const
{
return ImpIsNumeric( /*bOnlyIntntl*/FALSE );
@@ -993,7 +848,7 @@ BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const
{
SetError( SbxERR_PROP_WRITEONLY ); return FALSE;
}
- // Downcast pruefen!!!
+ // Test downcast!!!
if( this->ISA(SbxVariable) )
((SbxVariable*)this)->Broadcast( SBX_HINT_DATAWANTED );
SbxDataType t = GetType();
@@ -1039,7 +894,7 @@ BOOL SbxValue::SetType( SbxDataType t )
return TRUE;
if( ( t & 0x0FFF ) == SbxVARIANT )
{
- // Versuch, den Datentyp auf Variant zu setzen
+ // Trial to set the data type to Variant
ResetFlag( SBX_FIXED );
if( IsFixed() )
{
@@ -1055,7 +910,7 @@ BOOL SbxValue::SetType( SbxDataType t )
}
else
{
- // Eventuelle Objekte freigeben
+ // De-allocate potential objects
switch( aData.eType )
{
case SbxSTRING:
@@ -1078,7 +933,7 @@ BOOL SbxValue::SetType( SbxDataType t )
break;
default: break;
}
- // Das klappt immer, da auch die Float-Repraesentationen 0 sind.
+ // This works always, because the Float representations are 0 as well.
memset( &aData, 0, sizeof( SbxValues ) );
aData.eType = t;
}
@@ -1095,7 +950,7 @@ BOOL SbxValue::Convert( SbxDataType eTo )
return FALSE;
if( eTo == SbxVARIANT )
{
- // Versuch, den Datentyp auf Variant zu setzen
+ // Trial to set the data type to Variant
ResetFlag( SBX_FIXED );
if( IsFixed() )
{
@@ -1104,19 +959,19 @@ BOOL SbxValue::Convert( SbxDataType eTo )
else
return TRUE;
}
- // Convert from Null geht niemals. Einmal Null, immer Null!
+ // Converting from zero doesn't work. Once zero, always zero!
if( aData.eType == SbxNULL )
{
SetError( SbxERR_CONVERSION ); return FALSE;
}
- // Konversion der Daten:
+ // Conversion of the data:
SbxValues aNew;
aNew.eType = eTo;
if( Get( aNew ) )
{
- // Der Datentyp konnte konvertiert werden. Bei Fixed-Elementen
- // ist hier Ende, da die Daten nicht uebernommen zu werden brauchen
+ // The data type could be converted. It ends here with fixed elements,
+ // because the data had not to be taken over
if( !IsFixed() )
{
SetType( eTo );
@@ -1129,11 +984,11 @@ BOOL SbxValue::Convert( SbxDataType eTo )
else
return FALSE;
}
-////////////////////////////////// Rechnen /////////////////////////////////
+////////////////////////////////// Calculating /////////////////////////////////
BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
- bool bVBAInterop = SbiRuntime::isVBAEnabled();
+ bool bVBAInterop = SbiRuntime::isVBAEnabled();
SbxDataType eThisType = GetType();
SbxDataType eOpType = rOp.GetType();
@@ -1144,21 +999,21 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
SetError( SbxERR_PROP_READONLY );
else if( !rOp.CanRead() )
SetError( SbxERR_PROP_WRITEONLY );
- // Sonderregel 1: Ist ein Operand Null, ist das Ergebnis Null
+ // Special rule 1: If one operand is zero, the result is zero
else if( eThisType == SbxNULL || eOpType == SbxNULL )
SetType( SbxNULL );
- // Sonderregel 2: Ist ein Operand Empty, ist das Ergebnis der 2. Operand
- else if( eThisType == SbxEMPTY
- && !bVBAInterop
+ // Special rule 2: If the operand is Empty, the result is the 2. operand
+ else if( eThisType == SbxEMPTY
+ && !bVBAInterop
)
*this = rOp;
- // 13.2.96: Nicht schon vor Get auf SbxEMPTY pruefen
+ // 1996-2-13: Don't test already before Get upon SbxEMPTY
else
{
SbxValues aL, aR;
bool bDecimal = false;
- if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING ) ||
- ( eThisType != SbxSTRING && eOpType == SbxSTRING ) ) &&
+ if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING && eOpType != SbxEMPTY ) ||
+ ( eThisType != SbxSTRING && eThisType != SbxEMPTY && eOpType == SbxSTRING ) ) &&
( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS ) )
{
goto Lbl_OpIsDouble;
@@ -1167,10 +1022,10 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
if( eOp == SbxCAT || eOp == SbxPLUS )
{
- // AB 5.11.1999, OUString beruecksichtigen
+ // From 1999-11-5, keep OUString in mind
aL.eType = aR.eType = SbxSTRING;
rOp.Get( aR );
- // AB 8.12.1999, #70399: Hier wieder GetType() rufen, Get() kann Typ aendern!
+ // From 1999-12-8, #70399: Here call GetType() again, Get() can change the type!
if( rOp.GetType() == SbxEMPTY )
goto Lbl_OpIsEmpty;
Get( aL );
@@ -1191,34 +1046,26 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
SetError( SbxERR_CONVERSION );
}
else if( eOpType == SbxSTRING && rOp.IsFixed() )
- { // Numerisch: rechts darf kein String stehen
+ { // 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 )
{
@@ -1229,13 +1076,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;
@@ -1244,14 +1095,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;
@@ -1261,37 +1110,42 @@ 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;
case SbxNOT:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = ~aL.nLong64;
+ {
+ if ( aL.eType != SbxBOOL )
+ aL.nInt64 = ~aL.nInt64;
+ else
+ aL.nLong = ~aL.nLong;
+ }
else
aL.nLong = ~aL.nLong;
break;
@@ -1299,8 +1153,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;
@@ -1311,7 +1165,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
releaseDecimalPtr( aL.pDecimal );
goto Lbl_OpIsEmpty;
}
- if( Get( aL ) )
+ if( Get( aL ) )
{
if( aL.pDecimal && aR.pDecimal )
{
@@ -1351,65 +1205,94 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
else if( GetType() == SbxCURRENCY || rOp.GetType() == SbxCURRENCY )
{
+ double dTest;
aL.eType = SbxCURRENCY;
aR.eType = SbxCURRENCY;
if( rOp.Get( aR ) )
{
- static BigInt n10K( 10000 );
-
if( rOp.GetType() == SbxEMPTY )
goto Lbl_OpIsEmpty;
if( Get( aL ) ) switch( eOp )
{
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 );
}
}
}
else
-Lbl_OpIsDouble:
- { // Andere Operatoren
+Lbl_OpIsDouble:
+ { // other types and operators including Date, Double and Single
aL.eType = aR.eType = SbxDOUBLE;
if( rOp.Get( aR ) )
{
@@ -1432,6 +1315,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:
@@ -1440,9 +1326,6 @@ Lbl_OpIsDouble:
SetError( SbxERR_NOTIMP );
}
- // #45465 Date braucht bei + eine Spezial-Behandlung
- if( eOp == SbxPLUS && (GetType() == SbxDATE || rOp.GetType() == SbxDATE ) )
- aL.eType = SbxDATE;
}
}
@@ -1463,11 +1346,11 @@ Lbl_OpIsEmpty:
return bRes;
}
-// Die Vergleichs-Routine liefert TRUE oder FALSE.
+// The comparison routine deliver TRUE or FALSE.
BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
{
- bool bVBAInterop = SbiRuntime::isVBAEnabled();
+ bool bVBAInterop = SbiRuntime::isVBAEnabled();
BOOL bRes = FALSE;
SbxError eOld = GetError();
@@ -1481,25 +1364,25 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
}
else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY )
bRes = !bVBAInterop ? TRUE : ( eOp == SbxEQ ? TRUE : FALSE );
- // Sonderregel 1: Ist ein Operand Null, ist das Ergebnis FALSE
+ // Special rule 1: If an operand is zero, the result is FALSE
else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL )
bRes = FALSE;
- // Sonderregel 2: Wenn beide Variant sind und einer ist numerisch,
- // und der andere ein String, ist num < str
+ // 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
+ && ( rOp.GetType() == SbxSTRING && GetType() != SbxSTRING && IsNumeric() ) && !bVBAInterop
)
bRes = BOOL( eOp == SbxLT || eOp == SbxLE || eOp == SbxNE );
else if( !IsFixed() && !rOp.IsFixed()
- && ( GetType() == SbxSTRING && rOp.GetType() != SbxSTRING && rOp.IsNumeric() )
-&& !bVBAInterop
+ && ( GetType() == SbxSTRING && rOp.GetType() != SbxSTRING && rOp.IsNumeric() )
+&& !bVBAInterop
)
bRes = BOOL( eOp == SbxGT || eOp == SbxGE || eOp == SbxNE );
else
{
SbxValues aL, aR;
- // Wenn einer der Operanden ein String ist,
- // findet ein Stringvergleich statt
+ // If one of the operands is a String,
+ // a String comparing take place
if( GetType() == SbxSTRING || rOp.GetType() == SbxSTRING )
{
aL.eType = aR.eType = SbxSTRING;
@@ -1521,8 +1404,8 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
SetError( SbxERR_NOTIMP );
}
}
- // AB 19.12.95: Wenn SbxSINGLE beteiligt, auf SINGLE konvertieren,
- // sonst gibt es numerische Fehler
+ // From 1995-12-19: If SbxSINGLE participate, then convert to SINGLE,
+ // elsewise it shows a numeric error
else if( GetType() == SbxSINGLE || rOp.GetType() == SbxSINGLE )
{
aL.eType = aR.eType = SbxSINGLE;
@@ -1578,7 +1461,7 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
releaseDecimalPtr( aL.pDecimal );
releaseDecimalPtr( aR.pDecimal );
}
- // Alles andere auf SbxDOUBLE-Basis vergleichen
+ // Everything else comparing on a SbxDOUBLE-Basis
else
{
aL.eType = aR.eType = SbxDOUBLE;
@@ -1621,10 +1504,12 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
return bRes;
}
-///////////////////////////// Lesen/Schreiben ////////////////////////////
+///////////////////////////// Reading/Writing ////////////////////////////
BOOL SbxValue::LoadData( SvStream& r, USHORT )
{
+ // #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;
r >> nType;
@@ -1638,7 +1523,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
r >> aData.nLong; break;
case SbxSINGLE:
{
- // Floats als ASCII
+ // Floats as ASCII
XubString aVal;
r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
double d;
@@ -1654,7 +1539,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
case SbxDATE:
case SbxDOUBLE:
{
- // Floats als ASCII
+ // Floats as ASCII
XubString aVal;
r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US );
SbxDataType t;
@@ -1665,15 +1550,21 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
}
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:
@@ -1722,7 +1613,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
{
BYTE n;
r >> n;
- // Passt der Int auf diesem System?
+ // Match the Int on this system?
if( n > SAL_TYPES_SIZEOFINT )
r >> aData.nLong, aData.eType = SbxLONG;
else
@@ -1733,7 +1624,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
{
BYTE n;
r >> n;
- // Passt der UInt auf diesem System?
+ // Match the UInt on this system?
if( n > SAL_TYPES_SIZEOFINT )
r >> aData.nULong, aData.eType = SbxULONG;
else
@@ -1773,7 +1664,7 @@ BOOL SbxValue::StoreData( SvStream& r ) const
case SbxLONG:
r << aData.nLong; break;
case SbxDATE:
- // #49935: Als double speichern, sonst Fehler beim Einlesen
+ // #49935: Save as double, elsewise an error during the read in
((SbxValue*)this)->aData.eType = (SbxDataType)( ( nType & 0xF000 ) | SbxDOUBLE );
r.WriteByteString( GetCoreString(), RTL_TEXTENCODING_ASCII_US );
((SbxValue*)this)->aData.eType = (SbxDataType)nType;
@@ -1782,15 +1673,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:
@@ -1808,7 +1700,7 @@ BOOL SbxValue::StoreData( SvStream& r ) const
case SbxUSHORT:
r << aData.nUShort; break;
case SbxOBJECT:
- // sich selbst als Objektptr speichern geht nicht!
+ // to save itself as Objektptr doesn't work!
if( aData.pObj )
{
if( PTR_CAST(SbxValue,aData.pObj) != this )
@@ -1824,7 +1716,7 @@ BOOL SbxValue::StoreData( SvStream& r ) const
break;
case SbxCHAR:
{
- char c = sal::static_int_cast< char >(aData.nChar);
+ char c = sal::static_int_cast< char >(aData.nChar);
r << c;
break;
}
@@ -1862,3 +1754,4 @@ BOOL SbxValue::StoreData( SvStream& r ) const
return TRUE;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index e11a408a14..cb42234903 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,6 @@
#include "svl/brdcst.hxx"
#include <basic/sbx.hxx>
-#include <basic/sbxbase.hxx>
#include "sbxres.hxx"
#include "sbxconv.hxx"
#include <math.h>
@@ -84,7 +84,6 @@ SbxVariable::SbxVariable() : SbxValue()
nHash = 0;
#ifdef DBG_UTIL
DbgOutf( "SbxVariable::Ctor %lx=%ld", (void*)this, ++nVar );
- GetSbxData_Impl()->aVars.Insert( this, LIST_APPEND );
#endif
}
@@ -119,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
}
@@ -132,7 +130,6 @@ 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
}
@@ -146,7 +143,6 @@ 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 );
@@ -163,31 +159,31 @@ SfxBroadcaster& SbxVariable::GetBroadcaster()
return *pCst;
}
-// Eines Tages kann man vielleicht den Parameter 0 schleifen,
-// dann entfaellt die Kopiererei...
+// Perhaps some day one could cut the parameter 0.
+// then the copying will be dropped ...
void SbxVariable::Broadcast( ULONG nHintId )
{
if( pCst && !IsSet( SBX_NO_BROADCAST ) && StaticIsEnabledBroadcasting() )
{
- // Da die Methode von aussen aufrufbar ist, hier noch einmal
- // die Berechtigung testen
+ // Because the method could be called from outside, check the Da die Methode von aussen aufrufbar ist, hier noch einmal
+ // rights here again
if( nHintId & SBX_HINT_DATAWANTED )
if( !CanRead() )
return;
if( nHintId & SBX_HINT_DATACHANGED )
if( !CanWrite() )
return;
- // Weitere Broadcasts verhindern
+ // Avoid further broadcasting
SfxBroadcaster* pSave = pCst;
pCst = NULL;
USHORT nSaveFlags = GetFlags();
SetFlag( SBX_READWRITE );
if( mpPar.Is() )
- // this, als Element 0 eintragen, aber den Parent nicht umsetzen!
+ // Register this as element 0, but don't change over the parent!
mpPar->GetRef( 0 ) = this;
pSave->Broadcast( SbxHint( nHintId, this ) );
- delete pCst; // wer weiss schon, auf welche Gedanken mancher kommt?
+ delete pCst; // who knows already, onto which thoughts someone comes?
pCst = pSave;
SetFlags( nSaveFlags );
}
@@ -215,7 +211,7 @@ void SbxVariable::SetParameters( SbxArray* p )
}
-/////////////////////////// Name der Variablen ///////////////////////////
+/////////////////////////// Name of the variables ///////////////////////////
void SbxVariable::SetName( const XubString& rName )
{
@@ -228,15 +224,15 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
static char cSuffixes[] = " %&!#@ $";
if( t == SbxNAME_NONE )
return maName;
- // Parameter-Infos anfordern (nicht fuer Objekte)
+ // Request parameter-information (not for objects)
((SbxVariable*)this)->GetInfo();
- // Nix anfuegen, wenn einfache Property (keine leeren Klammern)
+ // Append nothing, if it is a simple property (no empty brackets)
if( !pInfo
|| ( !pInfo->aParams.Count() && GetClass() == SbxCLASS_PROPERTY ) )
return maName;
xub_Unicode cType = ' ';
XubString aTmp( maName );
- // Kurzer Typ? Dann holen, evtl. ist dieser 0.
+ // short type? Then fetch it, posible this is 0.
SbxDataType et = GetType();
if( t == SbxNAME_SHORT_TYPES )
{
@@ -258,7 +254,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
aTmp += String( SbxRes( STRING_BYREF ) );
aTmp += q->aName;
cType = ' ';
- // Kurzer Typ? Dann holen, evtl. ist dieser 0.
+ // short type? Then fetch it, posible this is 0.
if( t == SbxNAME_SHORT_TYPES )
{
if( nt <= SbxSTRING )
@@ -274,7 +270,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
{
if( q->eType & SbxARRAY )
aTmp.AppendAscii( "()" );
- // langer Typ?
+ // long type?
if( t != SbxNAME_SHORT )
{
aTmp += String( SbxRes( STRING_AS ) );
@@ -287,7 +283,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
}
}
aTmp += ')';
- // Langer Typ? Dann holen
+ // Long type? Then fetch it
if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
{
aTmp += String( SbxRes( STRING_AS ) );
@@ -301,7 +297,7 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const
return aToolString;
}
-// Einen simplen Hashcode erzeugen: Es werden die ersten 6 Zeichen gewertet.
+// Create a simple hashcode: the first six characters were evaluated.
USHORT SbxVariable::MakeHashCode( const XubString& rName )
{
@@ -314,7 +310,7 @@ USHORT SbxVariable::MakeHashCode( const XubString& rName )
{
BYTE c = (BYTE)*p;
p++;
- // Falls wir ein Schweinezeichen haben, abbrechen!!
+ // If we have a commen sigen break!!
if( c >= 0x80 )
return 0;
n = sal::static_int_cast< USHORT >( ( n << 3 ) + toupper( c ) );
@@ -322,7 +318,7 @@ USHORT SbxVariable::MakeHashCode( const XubString& rName )
return n;
}
-////////////////////////////// Operatoren ////////////////////////////////
+////////////////////////////// Operators ////////////////////////////////
SbxVariable& SbxVariable::operator=( const SbxVariable& r )
{
@@ -339,7 +335,7 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
return *this;
}
-//////////////////////////////// Konversion ////////////////////////////////
+//////////////////////////////// Conversion ////////////////////////////////
SbxDataType SbxVariable::GetType() const
{
@@ -361,17 +357,17 @@ void SbxVariable::SetModified( BOOL b )
if( IsSet( SBX_NO_MODIFY ) )
return;
SbxBase::SetModified( b );
- if( pParent && pParent != this ) //??? HotFix: Rekursion raus MM
+ if( pParent && pParent != this ) //??? HotFix: Recursion out here MM
pParent->SetModified( b );
}
void SbxVariable::SetParent( SbxObject* p )
{
#ifdef DBG_UTIL
- // wird der Parent eines SbxObjects gesetzt?
+ // Will the parent of a SbxObject be set?
if ( p && ISA(SbxObject) )
{
- // dann mu\s dieses auch Child vom neuen Parent sein
+ // then this had to be a child of the new parent
BOOL bFound = FALSE;
SbxArray *pChilds = p->GetObjects();
if ( pChilds )
@@ -454,7 +450,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
UINT32 nTemp;
rStrm >> nTemp;
nUserData = nTemp;
- // Korrektur: Alte Methoden haben statt SbxNULL jetzt SbxEMPTY
+ // correction: old methods have instead of SbxNULL now SbxEMPTY
if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD )
nType = SbxEMPTY;
SbxValues aTmp;
@@ -509,14 +505,14 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
DBG_ASSERT( !this, "Nicht unterstuetzer Datentyp geladen" );
return FALSE;
}
- // Wert putten
+ // putt value
if( nType != SbxNULL && nType != SbxEMPTY && !Put( aTmp ) )
return FALSE;
}
rStrm >> cMark;
- // cMark ist auch eine Versionsnummer!
+ // cMark is also a version number!
// 1: initial version
- // 2: mit nUserData
+ // 2: with nUserData
if( cMark )
{
if( cMark > 2 )
@@ -524,7 +520,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
pInfo = new SbxInfo;
pInfo->LoadData( rStrm, (USHORT) cMark );
}
- // Privatdaten nur laden, wenn es eine SbxVariable ist
+ // Load private data only, if it is a SbxVariable
if( GetClass() == SbxCLASS_VARIABLE && !LoadPrivateData( rStrm, nVer ) )
return FALSE;
((SbxVariable*) this)->Broadcast( SBX_HINT_DATACHANGED );
@@ -539,16 +535,16 @@ BOOL SbxVariable::StoreData( SvStream& rStrm ) const
BOOL bValStore;
if( this->IsA( TYPE(SbxMethod) ) )
{
- // #50200 Verhindern, dass Objekte, die zur Laufzeit als Return-Wert
- // in der Methode als Value gespeichert sind, mit gespeichert werden
+ // #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();
pThis->SetFlag( SBX_WRITE );
pThis->SbxValue::Clear();
pThis->SetFlags( nSaveFlags );
- // Damit die Methode in keinem Fall ausgefuehrt wird!
- // CAST, um const zu umgehen!
+ // So that the method will not be executed in any case!
+ // CAST, to avoid const!
pThis->SetFlag( SBX_NO_BROADCAST );
bValStore = SbxValue::StoreData( rStrm );
pThis->ResetFlag( SBX_NO_BROADCAST );
@@ -563,12 +559,12 @@ BOOL SbxVariable::StoreData( SvStream& rStrm ) const
rStrm << (UINT32)nUserData;
if( pInfo.Is() )
{
- rStrm << (BYTE) 2; // Version 2: mit UserData!
+ rStrm << (BYTE) 2; // Version 2: with UserData!
pInfo->StoreData( rStrm );
}
else
rStrm << (BYTE) 0;
- // Privatdaten nur speichern, wenn es eine SbxVariable ist
+ // Save private data only, if it is a SbxVariable
if( GetClass() == SbxCLASS_VARIABLE )
return StorePrivateData( rStrm );
else
@@ -637,7 +633,7 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
if( p && p->GetId() == SBX_HINT_DYING )
{
xAlias.Clear();
- // Alias loeschen?
+ // delete the alias?
if( pParent )
pParent->Remove( this );
}
@@ -656,7 +652,7 @@ void SbxVariable::Dump( SvStream& rStrm, BOOL bFill )
rStrm << " no parent";
rStrm << " ) ";
- // bei Object-Vars auch das Object ausgeben
+ // output also the object at object-vars
if ( GetValues_Impl().eType == SbxOBJECT &&
GetValues_Impl().pObj &&
GetValues_Impl().pObj != this &&
@@ -669,3 +665,4 @@ void SbxVariable::Dump( SvStream& rStrm, BOOL bFill )
rStrm << endl;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index aee3d18392..afb57078c2 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,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>
@@ -73,6 +75,8 @@ using namespace osl;
using com::sun::star::uno::Reference;
+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+
//============================================================================
// Implementation class SfxDialogLibraryContainer
@@ -132,7 +136,7 @@ bool writeOasis2OOoLibraryElement(
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue(
- OUString::createFromAscii(("DefaultContext")) ) >>= xContext );
+ OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< lang::XMultiComponentFactory > xSMgr(
xContext->getServiceManager() );
@@ -224,6 +228,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 );
@@ -252,6 +285,54 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
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;
}
@@ -336,7 +417,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
// Create InputStream, TODO: Implement own InputStreamProvider
// to avoid creating the DialogModel here!
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
aRetAny <<= xISP;
return aRetAny;
}
@@ -352,8 +433,8 @@ SfxLibraryContainer* SfxDialogLibraryContainer::createInstanceImpl( void )
}
-static OUString aResourceFileNameBase = OUString::createFromAscii( "DialogStrings" );
-static OUString aResourceFileCommentBase = OUString::createFromAscii( "# Strings for Dialog Library " );
+static OUString aResourceFileNameBase(RTL_CONSTASCII_USTRINGPARAM("DialogStrings"));
+static OUString aResourceFileCommentBase(RTL_CONSTASCII_USTRINGPARAM("# Strings for Dialog Library "));
// Resource handling
Reference< ::com::sun::star::resource::XStringResourcePersistence >
@@ -380,7 +461,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
// TODO: Ctor
xRet = Reference< resource::XStringResourcePersistence >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.resource.StringResourceWithStorage" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.resource.StringResourceWithStorage")) ), UNO_QUERY );
uno::Reference< embed::XStorage > xLibrariesStor;
uno::Reference< embed::XStorage > xLibraryStor;
@@ -428,7 +509,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
// TODO: Ctor
xRet = Reference< resource::XStringResourcePersistence >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.resource.StringResourceWithLocation")) ), UNO_QUERY );
// TODO: Ctor
if( xRet.is() )
@@ -484,7 +565,11 @@ void SfxDialogLibraryContainer::onNewRootStorage()
}
}
-
+sal_Bool SAL_CALL
+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& /*Library*/ ) throw (uno::RuntimeException)
+{
+ return sal_False; // dialog library has no executable code
+}
//============================================================================
// Service
@@ -506,9 +591,9 @@ Sequence< ::rtl::OUString > SAL_CALL SfxDialogLibraryContainer::getSupportedServ
Sequence< OUString > SfxDialogLibraryContainer::getSupportedServiceNames_static()
{
Sequence< OUString > aServiceNames( 2 );
- aServiceNames[0] = OUString::createFromAscii( "com.sun.star.script.DocumentDialogLibraryContainer" );
+ aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.DocumentDialogLibraryContainer"));
// plus, for compatibility:
- aServiceNames[1] = OUString::createFromAscii( "com.sun.star.script.DialogLibraryContainer" );
+ aServiceNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.DialogLibraryContainer"));
return aServiceNames;
}
@@ -520,7 +605,7 @@ OUString SfxDialogLibraryContainer::getImplementationName_static()
MutexGuard aGuard( Mutex::getGlobalMutex() );
if( bNeedsInit )
{
- aImplName = OUString::createFromAscii( "com.sun.star.comp.sfx2.DialogLibraryContainer" );
+ aImplName = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sfx2.DialogLibraryContainer"));
bNeedsInit = sal_False;
}
return aImplName;
@@ -656,3 +741,4 @@ bool SAL_CALL SfxDialogLibrary::isLibraryElementValid( ::com::sun::star::uno::An
}
//============================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/modsizeexceeded.cxx b/basic/source/uno/modsizeexceeded.cxx
index acd48d8872..5a557e56ac 100644
--- a/basic/source/uno/modsizeexceeded.cxx
+++ b/basic/source/uno/modsizeexceeded.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -66,3 +67,4 @@ ModuleSizeExceeded::isApprove() const
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 4668ca4418..2daedc5a7c 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,18 +34,16 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#ifndef __RSC //autogen
#include <tools/errinf.hxx>
#endif
#include <osl/mutex.hxx>
-#include <vos/diagnose.hxx>
+#include <osl/diagnose.h>
#include <rtl/uri.hxx>
#include <rtl/strbuf.hxx>
#include <comphelper/processfactory.hxx>
-#ifndef INCLUDED_COMPHELPER_ANYTOSTRING_HXX
#include <comphelper/anytostring.hxx>
-#endif
#include "namecont.hxx"
#include <basic/basicmanagerrepository.hxx>
@@ -67,9 +66,7 @@
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
#include "com/sun/star/deployment/ExtensionManager.hpp"
#include <comphelper/storagehelper.hxx>
-#ifndef _RTL_USTRING_HXX_
#include <comphelper/anytostring.hxx>
-#endif
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
@@ -343,14 +340,14 @@ SfxLibraryContainer::SfxLibraryContainer( void )
}
mxSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
if( !mxSFI.is() )
{
OSL_ENSURE( 0, "### couln't create SimpleFileAccess component\n" );
}
mxStringSubstitution = Reference< XStringSubstitution >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.util.PathSubstitution" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")) ), UNO_QUERY );
if( !mxStringSubstitution.is() )
{
OSL_ENSURE( 0, "### couln't create PathSubstitution component\n" );
@@ -535,14 +532,14 @@ static void createVariableURL( OUString& rStr, const OUString& rLibName,
const OUString& rInfoFileName, bool bUser )
{
if( bUser )
- rStr = OUString::createFromAscii( "$(USER)/basic/" );
+ rStr = OUString(RTL_CONSTASCII_USTRINGPARAM("$(USER)/basic/"));
else
- rStr = OUString::createFromAscii( "$(INST)/share/basic/" );
+ rStr = OUString(RTL_CONSTASCII_USTRINGPARAM("$(INST)/share/basic/"));
rStr += rLibName;
- rStr += OUString::createFromAscii( "/" );
+ rStr += OUString(sal_Unicode('/'));
rStr += rInfoFileName;
- rStr += OUString::createFromAscii( ".xlb/" );
+ rStr += OUString(RTL_CONSTASCII_USTRINGPARAM(".xlb/"));
}
sal_Bool SfxLibraryContainer::init( const OUString& rInitialDocumentURL, const uno::Reference< embed::XStorage >& rxInitialStorage )
@@ -983,7 +980,6 @@ 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
@@ -1029,7 +1025,6 @@ sal_Bool SfxLibraryContainer::init_Impl(
}
else
{
- bSecondTime = true;
aPrevUserBasicInetObj = aPrevUserBasicInetObj_2;
aPrevFolder = aPrevUserBasicInetObj.GetMainURL( INetURLObject::NO_DECODE );
}
@@ -1207,7 +1202,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
@@ -1229,9 +1224,9 @@ void SfxLibraryContainer::implScanExtensions( void )
// Add index file to URL
OUString aIndexFileURL = aLibURL;
if( nReduceCopy == 0 )
- aIndexFileURL += OUString::createFromAscii( "/" );
+ aIndexFileURL += OUString(sal_Unicode('/'));
aIndexFileURL += maInfoFileName;
- aIndexFileURL += OUString::createFromAscii( ".xlb" );
+ aIndexFileURL += OUString(RTL_CONSTASCII_USTRINGPARAM(".xlb"));
// Create link
const bool bReadOnly = false;
@@ -1700,9 +1695,6 @@ sal_Bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib,
}
catch( Exception& )
{
- // throw WrappedTargetException( OUString::createFromAscii( "parsing error!\n" ),
- // Reference< XInterface >(),
- // makeAny( e ) );
OSL_ENSURE( 0, "Parsing error\n" );
SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath );
ULONG nErrorCode = ERRCODE_IO_GENERAL;
@@ -1766,7 +1758,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();
@@ -1777,7 +1769,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;
@@ -2072,7 +2064,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 );
@@ -2089,8 +2081,6 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
ULONG nErrorCode = ERRCODE_IO_GENERAL;
ErrorHandler::HandleError( nErrorCode );
}
-
- delete pLibArray;
}
@@ -2712,7 +2702,7 @@ void SAL_CALL SfxLibraryContainer::exportLibrary( const OUString& Name, const OU
if( Handler.is() )
{
xToUseSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
- ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
if( xToUseSFI.is() )
xToUseSFI->setInteractionHandler( Handler );
}
@@ -3131,8 +3121,8 @@ void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerLi
//============================================================================
// Implementation class ScriptExtensionIterator
-static rtl::OUString aBasicLibMediaType( rtl::OUString::createFromAscii( "application/vnd.sun.star.basic-library" ) );
-static rtl::OUString aDialogLibMediaType( rtl::OUString::createFromAscii( "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 )
@@ -3156,7 +3146,7 @@ ScriptExtensionIterator::ScriptExtensionIterator( void )
if( !m_xContext.is() )
{
throw RuntimeException(
- ::rtl::OUString::createFromAscii( "ScriptExtensionIterator::init(), no XComponentContext" ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptExtensionIterator::init(), no XComponentContext")),
Reference< XInterface >() );
}
}
@@ -3201,7 +3191,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
break;
}
case END_REACHED:
- VOS_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
+ OSL_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
break;
}
}
@@ -3283,11 +3273,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;
@@ -3329,12 +3319,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;
@@ -3346,11 +3336,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;
@@ -3396,7 +3386,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
{
const Reference< deployment::XPackage >* pUserPackages = m_aUserPackagesSeq.getConstArray();
Reference< deployment::XPackage > xPackage = pUserPackages[ m_iUserPackage ];
- VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextUserScriptPackage(): Invalid package" );
+ OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextUserScriptPackage(): Invalid package" );
m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
}
@@ -3449,7 +3439,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
{
const Reference< deployment::XPackage >* pSharedPackages = m_aSharedPackagesSeq.getConstArray();
Reference< deployment::XPackage > xPackage = pSharedPackages[ m_iSharedPackage ];
- VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextSharedScriptPackage(): Invalid package" );
+ OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextSharedScriptPackage(): Invalid package" );
m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
}
@@ -3522,3 +3512,5 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
}
} // namespace basic
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/sbmodule.cxx b/basic/source/uno/sbmodule.cxx
index 922b503baf..f054225a8b 100644
--- a/basic/source/uno/sbmodule.cxx
+++ b/basic/source/uno/sbmodule.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,3 +43,4 @@ namespace basic
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/sbmodule.hxx b/basic/source/uno/sbmodule.hxx
index 10e027fdf1..64e9f16c2c 100644
--- a/basic/source/uno/sbmodule.hxx
+++ b/basic/source/uno/sbmodule.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,3 +44,4 @@ namespace basic
#endif // SBMODULE_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/sbservices.cxx b/basic/source/uno/sbservices.cxx
index c57c888f29..77361efb40 100644
--- a/basic/source/uno/sbservices.cxx
+++ b/basic/source/uno/sbservices.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,4 @@ namespace basic
IMPLEMENT_COMPONENT_LIBRARY_API( ::basic::BasicModule, ::basic::initializeModule )
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index b4222e7fb5..bdece76d7b 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,9 +44,7 @@
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <comphelper/processfactory.hxx>
-#ifndef _COMPHELPER_STORAGEHELPER_HXX_
#include <comphelper/storagehelper.hxx>
-#endif
#include <unotools/streamwrap.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <osl/mutex.hxx>
@@ -66,7 +65,8 @@
#include <xmlscript/xmlmod_imexp.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/util/VetoException.hpp>
-
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
+#include <cppuhelper/implbase1.hxx>
namespace basic
{
@@ -136,7 +136,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa
return pImplLib->mbPasswordProtected;
}
-
// Ctor for service
SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
:maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
@@ -1157,6 +1156,17 @@ void SfxScriptLibraryContainer::onNewRootStorage()
{
}
+sal_Bool SAL_CALL
+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
+{
+ BasicManager* pBasicMgr = getBasicManager();
+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
+ if ( pBasicMgr )
+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name
+ // default to it has code if we can't decide
+ return sal_True;
+}
+
//============================================================================
// Service
void createRegistryInfo_SfxScriptLibraryContainer()
@@ -1177,9 +1187,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;
}
@@ -1191,7 +1201,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;
@@ -1318,3 +1328,5 @@ void SAL_CALL SfxScriptLibrary::removeModuleInfo( const ::rtl::OUString& ModuleN
//============================================================================
} // namespace basic
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk
index 5d12a3f455..1ee30e2fef 100644
--- a/basic/util/makefile.mk
+++ b/basic/util/makefile.mk
@@ -66,10 +66,6 @@ SHL1STDLIBS= \
$(VOSLIB) \
$(XMLSCRIPTLIB)
-.IF "$(SOLAR_JAVA)" != "TRUE"
-SHL1STDLIBS+=$(SJLIB)
-.ENDIF
-
.IF "$(GUI)"=="WNT"
SHL1STDLIBS+= \
$(UWINAPILIB) \
diff --git a/basic/workben/makefile.mk b/basic/workben/makefile.mk
index e83050e41e..5ecce0917d 100644
--- a/basic/workben/makefile.mk
+++ b/basic/workben/makefile.mk
@@ -58,7 +58,7 @@ APP1STDLIBS= \
#.ENDIF
#.IF "$(GUI)"=="UNX"
#APP1STDLIBS+= \
-# $(VOSLIB) \
+# \
# $(SALLIB)
#.ENDIF
diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx
index aff81c0e9d..0e03ffff75 100644
--- a/basic/workben/mgrtest.cxx
+++ b/basic/workben/mgrtest.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,10 +38,6 @@
#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
@@ -327,7 +324,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- // liegt in einem anderen Storage !!!
+ // is located in another storage !!!
USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) );
if ( nLib != LIB_NOTFOUND )
{
@@ -366,7 +363,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- // liegt in einem anderen Storage !!!
+ // is located in another storage !!!
SvStorageRef xStorage = new SvStorage( "d:\\mystore2.svs" );
if ( !pBasMgr->AddLib( *xStorage, pLib3Str, FALSE ) )
Sound::Beep();
@@ -512,11 +509,11 @@ void TestWindow::CheckError()
}
}
-void __EXPORT TestWindow::Paint( const Rectangle& rRec )
+void TestWindow::Paint( const Rectangle& rRec )
{
}
-void __EXPORT TestWindow::Resize()
+void TestWindow::Resize()
{
Size aTBSz = aToolBox.CalcWindowSizePixel();
aToolBox.SetSizePixel( Size( GetOutputSizePixel().Width(), aTBSz.Height()) );
@@ -524,12 +521,12 @@ void __EXPORT TestWindow::Resize()
ShowInfo();
}
-void __EXPORT TestWindow::KeyInput( const KeyEvent& rKEvt )
+void TestWindow::KeyInput( const KeyEvent& rKEvt )
{
char nCharCode = rKEvt.GetCharCode();
USHORT nCode = rKEvt.GetKeyCode().GetCode();
- // Nur bei Alt-Return
+ // Only at Alt-Return
if ( ( nCode == KEY_RETURN ) && rKEvt.GetKeyCode().IsMod2() )
;
else
@@ -538,16 +535,16 @@ void __EXPORT TestWindow::KeyInput( const KeyEvent& rKEvt )
UpdateToolBox();
}
-void __EXPORT TestWindow::MouseMove( const MouseEvent& rMEvt )
+void TestWindow::MouseMove( const MouseEvent& rMEvt )
{
}
-void __EXPORT TestWindow::MouseButtonDown( const MouseEvent& rMEvt )
+void TestWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
ShowInfo();
}
-void __EXPORT TestWindow::MouseButtonUp( const MouseEvent& rMEvt )
+void TestWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
UpdateToolBox();
}
@@ -572,12 +569,12 @@ IMPL_LINK( TestWindow, BasicErrorHdl, StarBASIC *, pBasic )
return 0;
}
-void __EXPORT TestApp::Main( void )
+void TestApp::Main( void )
{
Main( 0, NULL );
}
-void __EXPORT TestApp::Main( int, char*[] )
+void TestApp::Main( int, char*[] )
{
BasicDLL aBasiDLL;
SvFactory::Init();
@@ -589,3 +586,5 @@ void __EXPORT TestApp::Main( int, char*[] )
TestApp aTestApp;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */