diff options
Diffstat (limited to 'basic')
177 files changed, 2403 insertions, 967 deletions
diff --git a/basic/inc/basic/basicmanagerrepository.hxx b/basic/inc/basic/basicmanagerrepository.hxx index c4ff6d515026..e486c3880f41 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 6d50e1cddc07..8f55b4f8f247 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 89dca9198b8e..360063bbface 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. @@ -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 aecf55c26a22..2434dd40ea10 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 3b86d54d6b39..9feb0edbef98 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/mybasic.hxx b/basic/inc/basic/mybasic.hxx index 02002f43cdd4..2f520253a6b3 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. @@ -92,3 +93,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 20cdbe1d4aa4..d804ae4c722d 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> @@ -39,9 +40,12 @@ typedef Environment::value_type EnvironmentVariable; class Process { // Internal members and methods - NAMESPACE_VOS(OArgumentList) *pArgumentList; - NAMESPACE_VOS(OEnvironment) *pEnvList; - NAMESPACE_VOS(OProcess) *pProcess; + sal_uInt32 m_nArgumentCount; + rtl_uString **m_pArgumentList; + sal_uInt32 m_nEnvCount; + rtl_uString **m_pEnvList; + rtl::OUString m_aProcessName; + oslProcess m_pProcess; BOOL ImplIsRunning(); long ImplGetExitCode(); BOOL bWasGPF; @@ -61,3 +65,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 70512584f9b7..1b0b6a3f65b4 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 c34176e0bde7..db072193d852 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 ebfcd22d19af..8b1c9a9ce77f 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; @@ -72,7 +74,7 @@ public: void GetLineRange( USHORT&, USHORT& ); // Interface to execute a method from the applications - virtual ErrCode Call( SbxValue* pRet = NULL ); + 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 abb482f7bfe5..94fd9d845e12 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. @@ -59,6 +60,8 @@ class SbModule : public SbxObject SbModuleImpl* mpSbModuleImpl; // Impl data std::vector< String > mModuleVariableNames; + SbModule(); + SbModule(const SbModule&); protected: com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper; @@ -132,6 +135,7 @@ public: BOOL LoadBinaryData( SvStream& ); BOOL ExceedsLegacyModuleSize(); void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const; + bool HasExeCode(); BOOL IsVBACompat() const; void SetVBACompat( BOOL bCompat ); INT32 GetModuleType() { return mnType; } @@ -185,3 +189,5 @@ SV_DECL_IMPL_REF(SbClassModuleObject); #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx index 9ff46d1931f3..2e77d32a43d4 100644 --- a/basic/inc/basic/sbobjmod.hxx +++ b/basic/inc/basic/sbobjmod.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * OpenOffice.org - a multi-platform office productivity suite @@ -117,3 +118,4 @@ SV_DECL_IMPL_REF(SbObjModule); #endif #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbprop.hxx b/basic/inc/basic/sbprop.hxx index 60cd9e5353c0..fc39c2e5f936 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 2f482db4b5ec..f25ddcf02c09 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. @@ -216,3 +217,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 79a8e93970e6..a33b1c343bdc 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. @@ -141,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 d816d424313b..0539246e071b 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 5f754159ba23..a4fa718c8467 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. @@ -77,11 +78,7 @@ struct SbxParamInfo ~SbxParamInfo() {} }; -//#if 0 // _SOLAR__PRIVATE SV_DECL_PTRARR_DEL(SbxParams,SbxParamInfo*,4,4) -//#else -//typedef SvPtrarr SbxParams; -//#endif #endif @@ -365,3 +362,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 0812b2622828..275007de807e 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. @@ -58,3 +59,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 83e474521cc2..786a5213f646 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 72716f3f6deb..ca707168687b 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. @@ -344,3 +345,5 @@ enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 }; #endif // __RSC #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbxfac.hxx b/basic/inc/basic/sbxfac.hxx index f72cebd8d979..986339d48aac 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 0e8ab2466271..0e20dbfd0279 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 5cc9af6f877a..d508d1c3e11e 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 ebd6a2b93484..f4c6fd7c5ad5 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 a1ed962502cd..387dc4c7caa5 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 467b86ee604c..25c875df9222 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 0cddcbdf8d17..f1af839f2471 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. @@ -512,3 +513,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 05eb70db84a8..81570d3f60c8 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. @@ -157,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 1827d013c492..be65e0ed3092 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. @@ -72,3 +73,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 d12d05c3436a..f79778c61ee0 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/modsizeexceeded.hxx b/basic/inc/modsizeexceeded.hxx index e2d716259f09..414b7aff72e0 100644 --- a/basic/inc/modsizeexceeded.hxx +++ b/basic/inc/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/pch/precompiled_basic.cxx b/basic/inc/pch/precompiled_basic.cxx index c27c1c7a66a6..29280bf5059a 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 e8f9e004ca6a..dd755b1294bf 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 "vcl/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 ecc85bfa4000..b54d77974fef 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/source/app/app.cxx b/basic/source/app/app.cxx index 209163f7bf46..8f6f21aa3240 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. @@ -1938,3 +1939,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 863543702ce3..e743a978db69 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. @@ -188,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 34762e339a90..527390f9a46c 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. @@ -293,3 +294,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 632df58248d3..a7796fb3854b 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. @@ -68,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 3891fe188445..e7181ab00286 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. @@ -297,3 +298,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 c9ea8ed89041..2399d42a54ed 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. @@ -66,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 af9c0ec90a7c..cd5bc34b39a8 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. @@ -111,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 c5be8836efd9..9dedf5c428aa 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 d5c6f2c3f44c..7800b25d1af1 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. @@ -653,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 7df72eed16f0..7867b6e051dd 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. @@ -135,3 +136,5 @@ public: DECLARE_LIST( EditList, AppWin* ) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx index e6c9f550ad5b..1c540e48f825 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/brkpnts.cxx b/basic/source/app/brkpnts.cxx index 27415a13698a..6401b3829bd9 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. @@ -382,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 05a03666a71b..1d44ef2c2d1a 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. @@ -92,3 +93,4 @@ public: +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx index cbb114108c56..7f588b8a2619 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 e33bf15cccf1..6bc0513ccafa 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. @@ -1489,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 0977b59212d6..278635e2825f 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. @@ -357,3 +358,5 @@ public: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk index 07ceed6e5116..e62b11c0beb4 100644 --- a/basic/source/app/makefile.mk +++ b/basic/source/app/makefile.mk @@ -38,32 +38,21 @@ LIBTARGET = NO # --- Common ------------------------------------------------------------ -OBJFILES = \ - $(OBJ)$/ttbasic.obj \ - $(OBJ)$/basicrt.obj \ - $(OBJ)$/processw.obj \ - $(OBJ)$/process.obj \ - $(OBJ)$/brkpnts.obj \ - $(OBJ)$/mybasic.obj \ - $(OBJ)$/status.obj \ - $(OBJ)$/printer.obj \ - $(OBJ)$/appwin.obj \ - $(OBJ)$/appedit.obj \ - $(OBJ)$/appbased.obj \ - $(OBJ)$/apperror.obj \ - $(OBJ)$/textedit.obj \ - $(OBJ)$/msgedit.obj \ - $(OBJ)$/dialogs.obj \ - EXCEPTIONSFILES = \ - $(OBJ)$/app.obj \ - $(OBJ)$/printer.obj \ - $(OBJ)$/process.obj - -.IF "$(GUI)" == "WNT" -EXCEPTIONSFILES += \ - $(OBJ)$/process.obj -.ENDIF + $(OBJ)$/app.obj \ + $(OBJ)$/appbased.obj \ + $(OBJ)$/appedit.obj \ + $(OBJ)$/apperror.obj \ + $(OBJ)$/appwin.obj \ + $(OBJ)$/basicrt.obj \ + $(OBJ)$/brkpnts.obj \ + $(OBJ)$/dialogs.obj \ + $(OBJ)$/msgedit.obj \ + $(OBJ)$/mybasic.obj \ + $(OBJ)$/printer.obj \ + $(OBJ)$/process.obj \ + $(OBJ)$/status.obj \ + $(OBJ)$/textedit.obj SRS1NAME=$(TARGET) SRC1FILES = \ @@ -76,21 +65,8 @@ SRC1FILES = \ LIB1TARGET=$(LB)$/app.lib LIB1ARCHIV=$(LB)$/libapp.a LIB1OBJFILES = \ - $(OBJ)$/basicrt.obj \ + $(EXCEPTIONSFILES) \ $(OBJ)$/processw.obj \ - $(OBJ)$/process.obj \ - $(OBJ)$/brkpnts.obj \ - $(OBJ)$/app.obj \ - $(OBJ)$/mybasic.obj \ - $(OBJ)$/status.obj \ - $(OBJ)$/printer.obj \ - $(OBJ)$/appwin.obj \ - $(OBJ)$/appedit.obj \ - $(OBJ)$/appbased.obj \ - $(OBJ)$/apperror.obj \ - $(OBJ)$/textedit.obj \ - $(OBJ)$/msgedit.obj \ - $(OBJ)$/dialogs.obj \ $(OBJ)$/sbintern.obj # --- Targets ------------------------------------------------------------ diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx index 9a2fa9ecf66e..16e8639c7430 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. @@ -991,3 +992,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 6aec1403f0c2..02355eb21a15 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. @@ -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 a1246a74e3e6..c5ae5e4c4a49 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. @@ -296,3 +297,4 @@ void BasicError::Show() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx index 0064271cfca3..84cddf422759 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. @@ -110,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 aeb42af72dee..b884a642e76f 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 38a930947faf..837820eb1234 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,10 +36,10 @@ #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> #include <basic/ttstrhlp.hxx> @@ -50,29 +51,46 @@ #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 ) { - NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo; - pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo ); - if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) ) + oslProcessInfo aProcessInfo; + osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo ); + if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) ) return TRUE; else return FALSE; @@ -83,11 +101,11 @@ BOOL Process::ImplIsRunning() long Process::ImplGetExitCode() { - if ( pProcess ) + if ( m_pProcess ) { - NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo; - pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo ); - if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) ) + oslProcessInfo aProcessInfo; + osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo ); + if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) ) SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); return aProcessInfo.Code; } @@ -101,13 +119,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]; @@ -122,42 +141,45 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const nParamCount++; } } - pArgumentList = new NAMESPACE_VOS(OArgumentList)( pParamList, nCount ); - + m_nArgumentCount = nParamCount; + m_pArgumentList = new rtl_uString*[m_nArgumentCount]; + for ( i = 0 ; i < m_nArgumentCount ; i++ ) + { + m_pArgumentList[i] = NULL; + rtl_uString_assign( &(m_pArgumentList[i]), pParamList[i].pData ); + } + delete [] pParamList; - ::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( (*aIter).second ); - pEnvArray[nEnvCount] = aTemp; - nEnvCount++; + m_pEnvList[m_nEnvCount] = NULL; + rtl_uString_assign( &(m_pEnvList[m_nEnvCount]), aTemp.pData ); + m_nEnvCount++; aIter++; } - pEnvList = new NAMESPACE_VOS(OEnvironment)( pEnvArray, nEnvCount ); } ::rtl::OUString aNormalizedAppPath; osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath ); - pProcess = new NAMESPACE_VOS(OProcess)( aNormalizedAppPath ); + m_aProcessName = aNormalizedAppPath;; bHasBeenStarted = FALSE; - delete [] pParamList; - delete [] pEnvArray; } } BOOL Process::Start() { // Start program BOOL bSuccess=FALSE; - if ( pProcess && !ImplIsRunning() ) + if ( m_pProcess && !ImplIsRunning() ) { bWasGPF = FALSE; #ifdef WNT @@ -166,23 +188,19 @@ BOOL Process::Start() try { #endif - if ( pEnvList ) - { - bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption) - ( NAMESPACE_VOS(OProcess)::TOption_SearchPath - /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/ - /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ), - *pArgumentList, - *pEnvList ) == NAMESPACE_VOS(OProcess)::E_None; - } - else - { - bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption) - ( NAMESPACE_VOS(OProcess)::TOption_SearchPath - /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/ - /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ), - *pArgumentList ) == NAMESPACE_VOS(OProcess)::E_None; - } + bSuccess = osl_executeProcess( + m_aProcessName.pData, + m_pArgumentList, + m_nArgumentCount, + osl_Process_SEARCHPATH + /*| osl_Process_DETACHED*/ + /*| osl_Process_WAIT*/, + NULL, + NULL, + m_pEnvList, + m_nEnvCount, + &m_pProcess ) == osl_Process_E_None; + #ifdef WNT } catch( ... ) @@ -221,7 +239,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 71fced98a4cf..accd727df62f 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. @@ -274,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 cca19b0286d2..0972ed3f5269 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. @@ -86,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 604fdedfc133..d1e1a2be8d70 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. @@ -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 fd9ab033009e..7c3b04bed8cc 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/testbasi.cxx b/basic/source/app/testbasi.cxx index b63986b63b2d..05818806c8a8 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 150ea75ce242..c70a90779754 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. @@ -862,3 +863,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 b3cc40381de6..094896fa87f4 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. @@ -135,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 98ffc1e4c08d..cfc12a85dcc4 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 04d74daa1bb7..8810da66b5e9 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/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index aa3dad1062c6..c49ebeeeaa37 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. @@ -637,3 +638,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 5567edbb4280..1c60b9024dee 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. @@ -1139,6 +1140,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 ); @@ -2488,3 +2508,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 acb2b57c283b..fdef98bce335 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. @@ -685,3 +686,4 @@ void SbiDisas::StrmOp( String& rText ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx index 0ec0454e2bb5..5d1538eba062 100644 --- a/basic/source/classes/errobject.cxx +++ b/basic/source/classes/errobject.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. @@ -223,3 +224,4 @@ void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OU m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 463a4c80685c..37b8037bf9e3 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. @@ -155,18 +156,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 ); } } @@ -254,7 +255,7 @@ Any BasicScriptListener_Impl::approveFiring( const ScriptEvent& aScriptEvent ) void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeException ) { // TODO: ??? - //NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + //SolarMutexGuard aGuard; //xSbxObj.Clear(); } @@ -485,15 +486,8 @@ Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, Star return aDlgLibAny; } -static ::rtl::OUString aDecorationPropName = - ::rtl::OUString::createFromAscii( "Decoration" ); -static ::rtl::OUString aTitlePropName = - ::rtl::OUString::createFromAscii( "Title" ); - void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) { - static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" ); - (void)pBasic; (void)bWrite; @@ -552,11 +546,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,43 +566,43 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) StarBASIC* pFoundBasic = NULL; OSL_TRACE("About to try get a hold of ThisComponent"); Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ; - aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); - // If we found the dialog then it belongs to the Search basic - if ( !pFoundBasic ) - { - Reference< frame::XDesktop > xDesktop( xMSF->createInstance - ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), - UNO_QUERY ); - Reference< container::XEnumeration > xModels; - if ( xDesktop.is() ) + aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); + // If we found the dialog then it belongs to the Search basic + if ( !pFoundBasic ) { - Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); - if ( xComponents.is() ) - xModels.set( xComponents->createEnumeration(), UNO_QUERY ); - if ( xModels.is() ) + Reference< frame::XDesktop > xDesktop( xMSF->createInstance + ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), + UNO_QUERY ); + Reference< container::XEnumeration > xModels; + if ( xDesktop.is() ) + { + Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); + if ( xComponents.is() ) + xModels.set( xComponents->createEnumeration(), UNO_QUERY ); + if ( xModels.is() ) + { + while ( xModels->hasMoreElements() ) { - while ( xModels->hasMoreElements() ) + Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); + if ( xNextModel.is() ) { - Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); - if ( xNextModel.is() ) + BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); + if ( pMgr ) + aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); + if ( aDlgLibAny.hasValue() ) { - BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); - if ( pMgr ) - aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); - if ( aDlgLibAny.hasValue() ) - { - bDocDialog = true; - xModel = xNextModel; - break; - } + bDocDialog = true; + xModel = xNextModel; + break; } } } } } + } if ( pFoundBasic ) bDocDialog = pFoundBasic->IsDocBasic(); - Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel ); + Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel ); Sequence< Any > aArgs( 4 ); if( bDocDialog ) @@ -616,23 +613,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; @@ -644,3 +641,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 2bdfbfd3f287..654ad79df750 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. @@ -431,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; @@ -540,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 50b871c9d2ef..2c01c49f814c 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 - // search service and instantiate - 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 a68d203fcee3..4cebf35be0c7 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> @@ -54,7 +53,7 @@ #include "filefmt.hxx" #include "sb.hrc" #include <basrid.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include "errobject.hxx" #include <hash_map> @@ -63,8 +62,6 @@ #include <com/sun/star/script/ModuleInfo.hpp> using namespace ::com::sun::star::script; -// #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE ) - SV_IMPL_VARARR(SbTextPortions,SbTextPortion) TYPEINIT1(StarBASIC,SbxObject) @@ -76,9 +73,6 @@ using com::sun::star::uno::Any; using com::sun::star::uno::UNO_QUERY; using com::sun::star::lang::XMultiServiceFactory; -const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); -const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); - SbxObject* StarBASIC::getVBAGlobals( ) { if ( !pVBAGlobals ) @@ -87,7 +81,7 @@ SbxObject* StarBASIC::getVBAGlobals( ) if ( GetUNOConstant("ThisComponent", aThisDoc) ) { Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY ); - if ( xDocFac.is() ) + if ( xDocFac.is() ) { try { @@ -99,6 +93,7 @@ SbxObject* StarBASIC::getVBAGlobals( ) } } } + const String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE ); } return pVBAGlobals; @@ -107,6 +102,7 @@ SbxObject* StarBASIC::getVBAGlobals( ) // i#i68894# SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t ) { + const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); if( rName == aThisComponent ) return NULL; // rename to init globals @@ -611,93 +607,7 @@ SbClassModuleObject::~SbClassModuleObject() void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ) { - bool bDone = false; - - const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); - if( pHint ) - { - SbxVariable* pVar = pHint->GetVar(); - SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar ); - if( pProcProperty ) - { - bDone = true; - - if( pHint->GetId() == SBX_HINT_DATAWANTED ) - { - String aProcName; - aProcName.AppendAscii( "Property Get " ); - aProcName += pProcProperty->GetName(); - - SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD ); - if( pMeth ) - { - SbxValues aVals; - aVals.eType = SbxVARIANT; - - SbxArray* pArg = pVar->GetParameters(); - USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0; - if( nVarParCount > 1 ) - { - SbxArrayRef xMethParameters = new SbxArray; - xMethParameters->Put( pMeth, 0 ); // Method as parameter 0 - for( USHORT i = 1 ; i < nVarParCount ; ++i ) - { - SbxVariable* pPar = pArg->Get( i ); - xMethParameters->Put( pPar, i ); - } - - pMeth->SetParameters( xMethParameters ); - pMeth->Get( aVals ); - pMeth->SetParameters( NULL ); - } - else - { - pMeth->Get( aVals ); - } - - pVar->Put( aVals ); - } - } - else if( pHint->GetId() == SBX_HINT_DATACHANGED ) - { - SbxVariable* pMeth = NULL; - - bool bSet = pProcProperty->isSet(); - if( bSet ) - { - pProcProperty->setSet( false ); - - String aProcName; - aProcName.AppendAscii( "Property Set " ); - aProcName += pProcProperty->GetName(); - pMeth = Find( aProcName, SbxCLASS_METHOD ); - } - if( !pMeth ) // Let - { - String aProcName; - aProcName.AppendAscii( "Property Let " ); - aProcName += pProcProperty->GetName(); - pMeth = Find( aProcName, SbxCLASS_METHOD ); - } - - if( pMeth ) - { - // Setup parameters - SbxArrayRef xArray = new SbxArray; - xArray->Put( pMeth, 0 ); // Method as parameter 0 - xArray->Put( pVar, 1 ); - pMeth->SetParameters( xArray ); - - SbxValues aVals; - pMeth->Get( aVals ); - pMeth->SetParameters( NULL ); - } - } - } - } - - if( !bDone ) - SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); } SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t ) @@ -1217,7 +1127,6 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) INT32 nType = p->GetModuleType(); if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM ) continue; - // otherwise check if the element is available // unset GBLSEARCH-Flag (due to Rekursion) USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH; @@ -1551,7 +1460,7 @@ BOOL runsInSetup( void ) void StarBASIC::MakeErrorText( SbError nId, const String& aMsg ) { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; if( bStaticSuppressSfxResource ) { @@ -1595,7 +1504,7 @@ 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 error during runtime -> stop programm if( IsRunning() ) @@ -1637,7 +1546,7 @@ 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 ) @@ -2107,3 +2016,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 55b5f7f371ce..0732b0c0e1d4 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 684edbc11bbe..876513216205 100644 --- 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,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_basic.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <tools/errcode.hxx> #include <svl/hint.hxx> @@ -58,6 +59,7 @@ #include <com/sun/star/script/XInvocationAdapterFactory.hpp> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> +#include <com/sun/star/script/XDefaultMethod.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/reflection/XIdlArray.hpp> @@ -69,7 +71,7 @@ #include <com/sun/star/bridge/oleautomation/Decimal.hpp> #include <com/sun/star/bridge/oleautomation/Currency.hpp> #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp> - +#include <com/sun/star/script/XAutomationInvocation.hpp> using com::sun::star::uno::Reference; using namespace com::sun::star::uno; @@ -155,6 +157,21 @@ SbxVariable* getDefaultProp( SbxVariable* pRef ) return pDefaultProp; } +void SetSbUnoObjectDfltPropName( SbxObject* pObj ) +{ + SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj); + if ( pUnoObj ) + { + String sDfltPropName; + + if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) ) + { + OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() ); + pUnoObj->SetDfltProperty( sDfltPropName ); + } + } +} + Reference< XComponentContext > getComponentContext_Impl( void ) { static Reference< XComponentContext > xContext; @@ -456,6 +473,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; @@ -1505,6 +1548,101 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty return aRetVal; } +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 ) { @@ -2011,11 +2149,24 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { try { - // get the value - Any aRetAny = mxInvocation->getValue( pProp->GetName() ); - + 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& ) { @@ -2140,52 +2291,7 @@ 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); - - // ATTENTION: Don't forget for Sbx-Parameter the offset! - 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++ ) - { - // ATTENTION: Don't forget for Sbx-Parameter the offset! - pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ), - bBlockConversionToSmallestType ); - } - } + processAutomationParams( pParams, args, bOLEAutomation, nParamCount ); } // call the method @@ -2220,26 +2326,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, } else if( bInvocation && mxInvocation.is() ) { - Sequence< INT16 > OutParamIndex; - Sequence< Any > OutParam; - Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam ); - - // take over the value from Uno to Sbx + Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation ); unoToSbxValue( pVar, aRetAny ); - - 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 ] ); - } - } } // remove parameter here, because this was not done anymore in unoToSbxValue() @@ -3177,11 +3265,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); @@ -3189,39 +3282,77 @@ 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 ); - VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() ); - if ( it != aConstCache.end() ) + 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 = aConstHash.find( sKey.toAsciiLowerCase() ); + + if ( it != aConstHash.end() ) { pConst = new SbxVariable( SbxVARIANT ); pConst->SetName( rName ); unoToSbxValue( pConst, it->second ); } + return pConst; } @@ -3774,7 +3905,7 @@ BasicAllListener_Impl::~BasicAllListener_Impl() void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet ) { - NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + SolarMutexGuard guard; if( xSbxObj.Is() ) { @@ -3839,7 +3970,7 @@ Any BasicAllListener_Impl::approveFiring( const AllEventObject& Event ) throw ( // Methods of XEventListener void BasicAllListener_Impl ::disposing(const EventObject& ) throw ( RuntimeException ) { - NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + SolarMutexGuard guard; xSbxObj.Clear(); } @@ -4213,7 +4344,7 @@ void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty, if( !m_bProxyIsClassModuleObject ) throw UnknownPropertyException(); - NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + SolarMutexGuard guard; ::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Set ") ); aPropertyFunctionName += m_aPrefix; @@ -4254,7 +4385,7 @@ Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty ) if( !m_bProxyIsClassModuleObject ) throw UnknownPropertyException(); - NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + SolarMutexGuard guard; ::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Get ") ); aPropertyFunctionName += m_aPrefix; @@ -4292,7 +4423,7 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, Sequence< Any >& ) throw( CannotConvertException, InvocationTargetException ) { - NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + SolarMutexGuard guard; Any aRet; if( !m_xScopeObj.Is() ) @@ -4429,3 +4560,4 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP return bSuccess; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index bfcb22b62d0a..089a963cf05c 100644 --- 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> @@ -50,12 +50,13 @@ #include <svtools/syntaxhighlight.hxx> #include <basic/basrdll.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <basic/sbobjmod.hxx> #include <cppuhelper/implbase2.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/XVBACompatibility.hpp> +#include <com/sun/star/document/XVbaMethodParameter.hpp> #include <com/sun/star/beans/XPropertySet.hpp> using namespace com::sun::star; @@ -498,7 +499,6 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ ) return 0L; } -#if 0 bool UnlockControllerHack( StarBASIC* pBasic ) { bool bRes = false; @@ -524,7 +524,7 @@ bool UnlockControllerHack( StarBASIC* pBasic ) } return bRes; } -#endif + ///////////////////////////////////////////////////////////////////////////// // A Basic module has set EXTSEARCH, so that the elements, that the modul contains, @@ -793,6 +793,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 ) @@ -847,6 +923,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r ) aOUSource = r; StartDefinitions(); SbiTokenizer aTok( r ); + aTok.SetCompatible( IsVBACompat() ); while( !aTok.IsEof() ) { SbiToken eEndTok = NIL; @@ -1034,12 +1111,14 @@ void SbModule::SetVBACompat( BOOL bCompat ) // Run a Basic-subprogram 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 ) { @@ -1051,29 +1130,6 @@ 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; - } - } - } - // Delete the Error-Stack SbErrorStack*& rErrStack = GetSbData()->pErrStack; delete rErrStack; @@ -1172,6 +1228,15 @@ USHORT SbModule::Run( SbMethod* pMeth ) delete pRt; pMOD = pOldMod; + if ( pINST->nCallLvl == 0 && IsVBACompat() ) + { + // VBA always ensure screenupdating is enabled after completing + StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); + if ( pBasic && pBasic->IsDocBasic() ) + { + UnlockControllerHack( pBasic ); + } + } if( bDelInst ) { // #57841 Clear Uno-Objects, which were helt in RTL functions, @@ -1182,7 +1247,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(); @@ -1199,10 +1264,8 @@ USHORT SbModule::Run( SbMethod* pMeth ) // VBA always ensure screenupdating is enabled after completing StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); -#if 0 if ( pBasic && pBasic->IsDocBasic() && !pINST ) UnlockControllerHack( pBasic ); -#endif if( bDelInst ) { // #57841 Clear Uno-Objects, which were helt in RTL functions, @@ -1213,6 +1276,8 @@ USHORT SbModule::Run( SbMethod* pMeth ) pINST = NULL; } if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST ) + bQuit = true; + if ( bQuit ) { Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL ); } @@ -1663,6 +1728,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 ) @@ -1712,7 +1823,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm ) return bRet; } - BOOL SbModule::LoadCompleted() { SbxArray* p = GetMethods(); @@ -1780,6 +1890,7 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p ) nLine1 = nLine2 = 0; refStatics = new SbxArray; + mCaller = 0; // From: 1996-07.02: HACK due to 'Referenz could not be saved' SetFlag( SBX_NO_MODIFY ); } @@ -1794,6 +1905,7 @@ SbMethod::SbMethod( const SbMethod& r ) nLine1 = r.nLine1; nLine2 = r.nLine2; refStatics = r.refStatics; + mCaller = r.mCaller; SetFlag( SBX_NO_MODIFY ); } @@ -1862,9 +1974,14 @@ SbxInfo* SbMethod::GetInfo() // Interface to execute a method of the applications // #34191# With special RefCounting, damit so that the Basic was not fired of by CloseDocument() // The return value will be delivered as string. -ErrCode SbMethod::Call( SbxValue* pRet ) +ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller ) { - // Increment the RefCount of the module + 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(); @@ -1891,7 +2008,7 @@ ErrCode SbMethod::Call( SbxValue* pRet ) // Release objects pMod_->ReleaseRef(); pBasic->ReleaseRef(); - + mCaller = 0; return nErr; } @@ -2073,10 +2190,9 @@ public: } } - //liuchen 2009-7-21, support Excel VBA Form_QueryClose event - virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) + + virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException) { -#if IN_THE_FUTURE uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY ); if ( xDialog.is() ) { @@ -2104,9 +2220,8 @@ public: } mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) ); -#endif } - //liuchen 2009-7-21 + virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { @@ -2201,15 +2316,14 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun ) Sequence< Any > aArguments; triggerMethod( aMethodToRun, aArguments ); } -void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& /*aArguments*/) +void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments) { OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() ); // Search method SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD ); if( pMeth ) { -#if IN_THE_FUTURE - //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters + if ( aArguments.getLength() > 0 ) // Setup parameters { SbxArrayRef xArray = new SbxArray; @@ -2237,8 +2351,7 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any pMeth->SetParameters( NULL ); } else -//liuchen 2009-7-21 -#endif + { SbxValues aVals; pMeth->Get( aVals ); @@ -2324,7 +2437,7 @@ void SbUserFormModule::Load() InitObject(); } -//liuchen 2009-7-21 change to accmordate VBA's beheavior + void SbUserFormModule::Unload() { OSL_TRACE("** Unload() "); @@ -2340,7 +2453,10 @@ void SbUserFormModule::Unload() triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams); aParams[0] >>= nCancel; - if (nCancel == 1) + // basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 ) + // test agains 0 ( false ) and assume anything else is true + // ( Note: ) this used to work ( something changes somewhere ) + if (nCancel != 0) { return; } @@ -2371,7 +2487,7 @@ void SbUserFormModule::Unload() OSL_TRACE("UnloadObject completed ( we hope )"); } } -//liuchen + void SbUserFormModule::InitObject() { @@ -2401,7 +2517,7 @@ void SbUserFormModule::InitObject() aArgs[ 0 ] = uno::Any(); aArgs[ 1 ] <<= m_xDialog; aArgs[ 2 ] <<= m_xModel; - aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() ); + aArgs[ 3 ] <<= sProjectName; pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) ); uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW ); // remove old listener if it exists @@ -2441,3 +2557,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 74559bf0e6c4..5a6aa36970ef 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. @@ -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 93fb18baf86e..da8d6d96e8af 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. @@ -163,8 +164,6 @@ void SbiCodeGen::Save() rMod.bIsProxyModule = false; } - if( pParser->bText ) - p->SetFlag( SBIMG_COMPARETEXT ); // GlobalCode-Flag if( pParser->HasGlobalCode() ) p->SetFlag( SBIMG_INITCODE ); @@ -244,6 +243,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 ) @@ -537,3 +538,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 59d77e3f3757..ce76fc065af4 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.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,6 +30,8 @@ #include "precompiled_basic.hxx" #include <basic/sbx.hxx> #include "sbcomp.hxx" +#include "sbunoobj.hxx" + SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ); @@ -153,7 +156,7 @@ 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; @@ -426,7 +429,10 @@ 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 @@ -1043,11 +1049,27 @@ void SbiParser::DefDeclare( BOOL bPrivate ) } } +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. +} + // Aufruf einer SUB oder FUNCTION void SbiParser::Call() { - String aName( aSym ); SbiExpression aVar( this, SbSYMBOL ); aVar.Gen( FORCE_CALL ); aGen.Gen( _GET ); @@ -1201,3 +1223,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 3e034af204f5..eb6c27360959 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. @@ -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 d47c86f86ea8..bfd0aea3271b 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. @@ -486,3 +487,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 7a4ea5965558..5622f3663ab8 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. @@ -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 ); @@ -580,7 +585,11 @@ SbiExprNode* SbiExpression::Unary() eTok = NEG; case NOT: pParser->Next(); - pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); + // process something like "Do While Not "foo"="" " + if( pParser->IsVBASupportOn() ) + pNd = new SbiExprNode( pParser, Like(), eTok, NULL ); + else + pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); break; case PLUS: pParser->Next(); @@ -736,7 +745,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; @@ -1134,3 +1143,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 b211ea0b7b08..7ca4a7babdea 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 bd4540a8ffde..260ac341a46a 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/makefile.mk b/basic/source/comp/makefile.mk index d65f6a431e43..5fe64ceae091 100644 --- a/basic/source/comp/makefile.mk +++ b/basic/source/comp/makefile.mk @@ -35,25 +35,22 @@ TARGET=comp .INCLUDE : settings.mk SLOFILES= \ - $(SLO)$/buffer.obj \ - $(SLO)$/codegen.obj \ - $(SLO)$/dim.obj \ + $(EXCEPTIONSFILES) \ + $(SLO)$/buffer.obj \ $(SLO)$/exprgen.obj \ $(SLO)$/exprnode.obj \ - $(SLO)$/exprtree.obj \ - $(SLO)$/io.obj \ + $(SLO)$/io.obj \ $(SLO)$/loops.obj \ - $(SLO)$/parser.obj \ $(SLO)$/sbcomp.obj \ - $(SLO)$/scanner.obj \ $(SLO)$/symtbl.obj \ $(SLO)$/token.obj EXCEPTIONSFILES= \ - $(SLO)$/codegen.obj \ - $(SLO)$/dim.obj \ - $(SLO)$/exprtree.obj \ - $(SLO)$/parser.obj + $(SLO)$/codegen.obj \ + $(SLO)$/dim.obj \ + $(SLO)$/exprtree.obj \ + $(SLO)$/parser.obj \ + $(SLO)$/scanner.obj # --- Targets -------------------------------------------------------------- diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 3d7178ae7688..6d6c02ce0308 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 5b7e5c70591d..5c0a31fc47a6 100644 --- 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. @@ -475,3 +476,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 dd68f20893f5..a430ae0f7460 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. @@ -580,3 +581,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 d6b3dbb878fc..5778655406f8 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. @@ -534,3 +535,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 8cb3126f03f1..bd853a9bda89 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 cbb1a1702354..7a6a2092693d 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 a3fe02227cfd..cfafcddec8e0 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 cd1787d6ff01..2c39e711f993 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 328a085e6c29..93929dab42a9 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 737d1274718f..94c10ca86b2e 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. @@ -94,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(); @@ -171,3 +174,4 @@ protected: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx index 39e6e319caae..1e94a3927e93 100644 --- a/basic/source/inc/errobject.hxx +++ b/basic/source/inc/errobject.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: throw (com::sun::star::uno::RuntimeException); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 851d0d6f1fe5..852978b5740f 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. @@ -264,3 +265,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 dccdec703dd3..0319daf7261b 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 9b427c9b6276..24a530ed1061 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. @@ -106,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 a64310582ca5..6d04889776b7 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. @@ -109,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 7fd6eb06f607..2b3b65f74eca 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. @@ -35,6 +36,7 @@ #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <com/sun/star/script/XLibraryContainerExport.hpp> +#include <com/sun/star/script/XLibraryQueryExecutable.hpp> #include <com/sun/star/script/XLibraryContainer3.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> @@ -59,6 +61,7 @@ #include <cppuhelper/implbase2.hxx> #include <cppuhelper/compbase8.hxx> +#include <cppuhelper/compbase9.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/script/vba/XVBACompatibility.hpp> @@ -67,13 +70,14 @@ class BasicManager; namespace basic { -typedef ::cppu::WeakComponentImplHelper8< +typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::lang::XInitialization, ::com::sun::star::script::XStorageBasedLibraryContainer, ::com::sun::star::script::XLibraryContainerPassword, ::com::sun::star::script::XLibraryContainerExport, ::com::sun::star::script::XLibraryContainer3, ::com::sun::star::container::XContainer, + ::com::sun::star::script::XLibraryQueryExecutable, ::com::sun::star::script::vba::XVBACompatibility, ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper; @@ -764,3 +768,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 6abb52df93f1..a6ebfdc5df20 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. @@ -96,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 ff7eff027f83..309ff38c5564 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 733a65db7f61..3db87e49817c 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 bd030ade499e..1381d082dcdd 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. @@ -191,3 +192,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 cd75be1a1ec2..b6b0814d1e33 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. @@ -196,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 @@ -285,7 +285,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 @@ -455,6 +457,7 @@ public: SbMethod* GetCaller(); SbxArray* GetLocals(); SbxArray* GetParams(); + SbxVariable* GetExternalCaller(){ return mpExtCaller; } SbxBase* FindElementExtern( const String& rName ); static bool isVBAEnabled(); @@ -521,3 +524,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 6335a55da62f..2918e67880f0 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 4c54e2301bd5..7003b5a0a1bb 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 80c301821884..f2cc8a3d3865 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 a9b035e79da2..b3aa275aec0d 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/sbtrace.hxx b/basic/source/inc/sbtrace.hxx index e8a482c2f6e9..daa10d7f9b57 100644 --- a/basic/source/inc/sbtrace.hxx +++ b/basic/source/inc/sbtrace.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 @@ void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 5a5981379fb7..011ffb9a7e02 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. @@ -41,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 { @@ -319,6 +321,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 bd41d992aacc..5a6a29c1a9c7 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. @@ -142,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 091fbc24cdbe..1b68e089c451 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. @@ -122,7 +123,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); @@ -197,3 +200,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 000e39973eb3..9087b81e3028 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 f2fbaa0ac1f1..b8457b3c811b 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 ec07dcbd8518..544eef119e01 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. @@ -70,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, @@ -179,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 799caf0cd954..a705aa24aa00 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 40257b9cb67a..a2536bfab045 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. @@ -188,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 f61ceb366ab0..65be2e76ecff 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. @@ -60,3 +61,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr.cxx index 04f1ee0a8acc..2afaa356640f 100644 --- a/basic/source/runtime/dllmgr.cxx +++ b/basic/source/runtime/dllmgr.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. @@ -736,3 +737,5 @@ 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.hxx b/basic/source/runtime/dllmgr.hxx index fdff8c2849be..1507ffe7f94f 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 1c1c085870ed..cc385ce4a199 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. @@ -193,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 e26fd0a7e384..40cf7f2f3ece 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. @@ -35,7 +36,7 @@ #include <osl/security.h> #include <osl/file.hxx> #include <tools/urlobj.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include "runtime.hxx" @@ -66,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; @@ -343,7 +343,7 @@ BOOL hasUno( void ) class OslStream : public SvStream { - File maFile; + osl::File maFile; short mnStrmMode; public: @@ -375,14 +375,14 @@ OslStream::OslStream( const String& rName, short nStrmMode ) nFlags = 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 != OpenFlag_Read ) { nFlags |= OpenFlag_Create; nRet = maFile.open( nFlags ); } - if( nRet != FileBase::E_None ) + if( nRet != osl::FileBase::E_None ) { SetError( ERRCODE_IO_GENERAL ); } @@ -397,7 +397,7 @@ OslStream::~OslStream() ULONG OslStream::GetData( void* pData, ULONG nSize ) { sal_uInt64 nBytesRead = nSize; - FileBase::RC nRet = FileBase::E_None; + osl::FileBase::RC nRet = osl::FileBase::E_None; nRet = maFile.read( pData, nBytesRead, nBytesRead ); return (ULONG)nBytesRead; } @@ -405,14 +405,14 @@ ULONG OslStream::GetData( void* pData, ULONG nSize ) ULONG OslStream::PutData( const void* pData, ULONG nSize ) { sal_uInt64 nBytesWritten; - FileBase::RC nRet = FileBase::E_None; + osl::FileBase::RC nRet = osl::FileBase::E_None; nRet = maFile.write( pData, (sal_uInt64)nSize, nBytesWritten ); return (ULONG)nBytesWritten; } ULONG OslStream::SeekPos( ULONG nPos ) { - FileBase::RC nRet; + osl::FileBase::RC nRet; if( nPos == STREAM_SEEK_TO_END ) { nRet = maFile.setPos( Pos_End, 0 ); @@ -432,7 +432,7 @@ void OslStream::FlushData() void OslStream::SetSize( ULONG nSize ) { - FileBase::RC nRet = FileBase::E_None; + osl::FileBase::RC nRet = osl::FileBase::E_None; nRet = maFile.setSize( (sal_uInt64)nSize ); } @@ -1035,7 +1035,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() ) @@ -1044,3 +1044,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 6ea1f1f20ba1..1e06e74d48ff 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,7 +32,7 @@ #include <tools/date.hxx> #include <basic/sbxvar.hxx> -#include <vos/process.hxx> +#include <osl/process.h> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/sound.hxx> @@ -46,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" @@ -71,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 */ @@ -99,6 +104,8 @@ using namespace com::sun::star::io; #include <stdlib.h> #include <ctype.h> +SbxVariable* getDefaultProp( SbxVariable* pRef ); + #if defined (WIN) || defined (WNT) || defined (OS2) #include <direct.h> // _getdcwd get current work directory, _chdrive #endif @@ -117,6 +124,9 @@ using namespace com::sun::star::io; #include <io.h> #endif + +#include <basic/sbobjmod.hxx> + #include <basic/sbobjmod.hxx> static void FilterWhiteSpace( String& rStr ) @@ -702,6 +712,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 & ) @@ -936,6 +976,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) @@ -2407,7 +2467,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) @@ -2418,7 +2489,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) @@ -3400,8 +3486,8 @@ RTLFUNC(Shell) } else { - USHORT nOptions = NAMESPACE_VOS(OProcess)::TOption_SearchPath| - NAMESPACE_VOS(OProcess)::TOption_Detached; + oslProcessOption nOptions = osl_Process_SEARCHPATH | osl_Process_DETACHED; + String aCmdLine = rPar.Get(1)->GetString(); // Zusaetzliche Parameter anhaengen, es muss eh alles geparsed werden if( nArgCount >= 4 ) @@ -3478,81 +3564,79 @@ RTLFUNC(Shell) nWinStyle = rPar.Get(2)->GetInteger(); switch( nWinStyle ) { - case 2: - nOptions |= NAMESPACE_VOS(OProcess)::TOption_Minimized; - break; - case 3: - nOptions |= NAMESPACE_VOS(OProcess)::TOption_Maximized; - break; - case 10: - nOptions |= NAMESPACE_VOS(OProcess)::TOption_FullScreen; - break; + case 2: + nOptions |= osl_Process_MINIMIZED; + break; + case 3: + nOptions |= osl_Process_MAXIMIZED; + break; + case 10: + nOptions |= osl_Process_FULLSCREEN; + break; } BOOL bSync = FALSE; if( nArgCount >= 5 ) bSync = rPar.Get(4)->GetBool(); if( bSync ) - nOptions |= NAMESPACE_VOS(OProcess)::TOption_Wait; + nOptions |= osl_Process_WAIT; } - NAMESPACE_VOS(OProcess)::TProcessOption eOptions = - (NAMESPACE_VOS(OProcess)::TProcessOption)nOptions; - // #72471 Parameter aufbereiten 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++; 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); } } - //const char* pParams = aParams.Len() ? aParams.GetStr() : 0; - NAMESPACE_VOS(OProcess)* pApp; - pApp = new NAMESPACE_VOS(OProcess)( aOUStrProgUNC ); - BOOL bSucc; - if( nParamCount == 0 ) + oslProcess pApp; + BOOL bSucc = osl_executeProcess( + aOUStrProgUNC.pData, + pParamList, + nParamCount, + nOptions, + NULL, + NULL, + NULL, 0, + &pApp ) == osl_Process_E_None; + + osl_freeProcessHandle( pApp ); + + for(int j = 0; i < nParamCount; i++) { - bSucc = pApp->execute( eOptions ) == NAMESPACE_VOS(OProcess)::E_None; + rtl_uString_release(pParamList[j]); + pParamList[j] = NULL; } - 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()) { - NAMESPACE_VOS(OArgumentList) aArgList( pArgumentList, nParamCount ); - bSucc = pApp->execute( eOptions, aArgList ) == NAMESPACE_VOS(OProcess)::E_None; + oslProcessInfo aInfo; + osl_getProcessInfo( pApp, osl_Process_IDENTIFIER, &aInfo ); + nResult = aInfo.Ident; } - /* - if( nParamCount == 0 ) - pApp = new NAMESPACE_VOS(OProcess)( pProg ); - else - pApp = new NAMESPACE_VOS(OProcess)( pProg, pParamList, nParamCount ); - BOOL bSucc = pApp->execute( eOptions ) == NAMESPACE_VOS(OProcess)::E_None; - */ - - delete pApp; - delete[] pArgumentList; if( !bSucc ) StarBASIC::Error( SbERR_FILE_NOT_FOUND ); else - rPar.Get(0)->PutLong( 0 ); + rPar.Get(0)->PutLong( nResult ); } } @@ -3623,6 +3707,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; @@ -3634,7 +3777,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 ); @@ -4577,3 +4725,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 ebffbee9f23c..73c40c0cbeb6 100644 --- 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. @@ -76,11 +77,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 ) { @@ -526,13 +531,11 @@ RTLFUNC(DoEvents) (void)pBasic; (void)bWrite; (void)rPar; - // Dummy implementation as the following code leads - // to performance problems for unknown reasons - //Timer aTimer; - //aTimer.SetTimeout( 1 ); - //aTimer.Start(); - //while ( aTimer.IsActive() ) - // Application::Reschedule(); +// don't undstand what upstream are up to +// we already process application events etc. in between +// basic runtime pcode ( on a timed basis ) + // always return 0 + rPar.Get(0)->PutInteger( 0 ); } RTLFUNC(GetGUIVersion) @@ -2516,6 +2519,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::createFromAscii( "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; @@ -2617,3 +3160,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 663d12fbcd72..42b0dd0dddca 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 5437654f69a0..9eb6f495f433 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. @@ -165,29 +166,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); @@ -195,6 +208,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); @@ -297,6 +311,7 @@ extern RTLFUNC(Switch); extern RTLFUNC(Wait); //i#64882# add new WaitUntil extern RTLFUNC(WaitUntil); +extern RTLFUNC(FuncCaller); extern RTLFUNC(GetGUIVersion); extern RTLFUNC(Choose); @@ -347,3 +362,5 @@ extern RTLFUNC(Partition); // Fong 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 1bb6fb82e113..f09aadfe3f70 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. @@ -46,6 +47,8 @@ #include "errobject.hxx" #include "sbtrace.hxx" +SbxVariable* getDefaultProp( SbxVariable* pRef ); + using namespace ::com::sun::star; bool SbiRuntime::isVBAEnabled() @@ -544,7 +547,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth ) SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart ) : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ), - pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0) + pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0) { nFlags = pe ? pe->GetDebugFlags() : 0; pIosys = pInst->pIosys; @@ -601,6 +604,13 @@ SbiRuntime::~SbiRuntime() void SbiRuntime::SetVBAEnabled(bool bEnabled ) { bVBAEnabled = bEnabled; + if ( bVBAEnabled ) + { + if ( pMeth ) + mpExtCaller = pMeth->mCaller; + } + else + mpExtCaller = 0; } // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt @@ -1029,7 +1039,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 ) ) ) + { + 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 ); @@ -1038,7 +1066,6 @@ void SbiRuntime::TOSMakeTemp() } // Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf - void SbiRuntime::PushGosub( const BYTE* pc ) { if( ++nGosubLvl > MAXRECURSION ) @@ -1266,3 +1293,5 @@ 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 4455901bfeba..f5f54dad8515 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 }, @@ -171,7 +212,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 }, @@ -216,7 +262,7 @@ static Methods aMethods[] = { { "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 }, { "FileSpec", SbxSTRING, _OPT, NULL,0 }, { "attrmask", SbxINTEGER, _OPT, NULL,0 }, -{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 }, +{ "DoEvents", SbxINTEGER, _FUNCTION, RTLNAME(DoEvents),0 }, { "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 }, { "FileSpec", SbxSTRING, 0,NULL,0 }, { "DumpAll", SbxINTEGER, _OPT, NULL,0 }, @@ -271,6 +317,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 }, @@ -331,6 +383,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 }, @@ -401,6 +463,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 }, @@ -417,6 +483,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 }, @@ -428,16 +503,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 }, @@ -491,6 +596,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 }, @@ -605,6 +719,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 }, @@ -683,13 +798,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; @@ -786,3 +903,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 94b7973c7e77..28bda15bcacc 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 06a8bb19af00..156df6aa7e38 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. @@ -48,6 +49,11 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl:: #include <algorithm> +// 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() @@ -59,34 +65,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 ); @@ -109,19 +87,24 @@ void SbiRuntime::StepCompare( SbxOperator eOp ) // values ( and type ) set as appropriate 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 // Compare ) - else if ( p1Type == SbxOBJECT ) + if ( p1Type == SbxOBJECT ) { SbxVariable* pDflt = getDefaultProp( p1 ); if ( pDflt ) @@ -141,8 +124,21 @@ void SbiRuntime::StepCompare( SbxOperator eOp ) #ifndef WIN 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 ) { @@ -163,9 +159,14 @@ void SbiRuntime::StepCompare( SbxOperator eOp ) PushVar( pFALSE ); } #else - BOOL bRes = p2->Compare( eOp, *p1 ); SbxVariable* pRes = new SbxVariable; - pRes->PutBool( bRes ); + if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) ) + pRes->PutNull(); + else + { + BOOL bRes = p2->Compare( eOp, *p1 ); + pRes->PutBool( bRes ); + } PushVar( pRes ); #endif } @@ -679,6 +680,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! @@ -844,6 +856,7 @@ void SbiRuntime::StepREDIMP() void SbiRuntime::StepREDIMP_ERASE() { SbxVariableRef refVar = PopVar(); + refRedim = refVar; SbxDataType eType = refVar->GetType(); if( eType & SbxARRAY ) { @@ -854,12 +867,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() ) @@ -932,10 +939,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() @@ -1330,3 +1334,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 e23ef864218e..e023750cc27a 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. @@ -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++ ); } @@ -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 ); } @@ -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 587b0ae7a590..543c69a34b97 100644 --- 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" @@ -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 ); } // #72382 VORSICHT! Liefert jetzt wegen unbekannten // Modulen IMMER ein Ergebnis! @@ -457,7 +456,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); @@ -489,7 +488,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) pPar->Put( NULL, 0 ); } // Index-Access bei UnoObjekten beruecksichtigen - else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) ) + else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) ) { pPar = pElem->GetParameters(); if ( pPar ) @@ -733,6 +732,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 ) ); @@ -1259,3 +1260,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 887917048c61..b7b2e717aedc 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 9aeb8e353414..5261f13cfe43 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 c9729293a346..99501a1b7c70 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. @@ -272,3 +273,4 @@ SbxObject* SampleObjectFac::CreateObject( const String& rClass ) return NULL; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/makefile.mk b/basic/source/sbx/makefile.mk index dfd8e72bf4da..cc20080cbe9c 100644 --- a/basic/source/sbx/makefile.mk +++ b/basic/source/sbx/makefile.mk @@ -41,34 +41,35 @@ SRS1NAME=$(TARGET) SRC1FILES= format.src SLOFILES= \ - $(SLO)$/sbxbase.obj \ - $(SLO)$/sbxres.obj \ - $(SLO)$/sbxvalue.obj \ - $(SLO)$/sbxvals.obj \ - $(SLO)$/sbxvar.obj \ - $(SLO)$/sbxarray.obj \ - $(SLO)$/sbxobj.obj \ - $(SLO)$/sbxcoll.obj \ - $(SLO)$/sbxexec.obj \ - $(SLO)$/sbxint.obj \ - $(SLO)$/sbxlng.obj \ - $(SLO)$/sbxsng.obj \ - $(SLO)$/sbxmstrm.obj \ - $(SLO)$/sbxdbl.obj \ + $(EXCEPTIONSFILES) \ + $(SLO)$/sbxbase.obj \ + $(SLO)$/sbxbool.obj \ + $(SLO)$/sbxbyte.obj \ + $(SLO)$/sbxchar.obj \ + $(SLO)$/sbxcoll.obj \ $(SLO)$/sbxcurr.obj \ - $(SLO)$/sbxdate.obj \ - $(SLO)$/sbxstr.obj \ - $(SLO)$/sbxbool.obj \ - $(SLO)$/sbxchar.obj \ - $(SLO)$/sbxbyte.obj \ - $(SLO)$/sbxuint.obj \ - $(SLO)$/sbxulng.obj \ - $(SLO)$/sbxform.obj \ - $(SLO)$/sbxscan.obj \ - $(SLO)$/sbxdec.obj + $(SLO)$/sbxdec.obj \ + $(SLO)$/sbxform.obj \ + $(SLO)$/sbxint.obj \ + $(SLO)$/sbxlng.obj \ + $(SLO)$/sbxmstrm.obj \ + $(SLO)$/sbxobj.obj \ + $(SLO)$/sbxres.obj \ + $(SLO)$/sbxsng.obj \ + $(SLO)$/sbxuint.obj \ + $(SLO)$/sbxulng.obj \ + $(SLO)$/sbxvals.obj \ + $(SLO)$/sbxvar.obj -EXCEPTIONSFILES=$(SLO)$/sbxarray.obj +EXCEPTIONSFILES= \ + $(SLO)$/sbxarray.obj \ + $(SLO)$/sbxdate.obj \ + $(SLO)$/sbxdbl.obj \ + $(SLO)$/sbxexec.obj \ + $(SLO)$/sbxscan.obj \ + $(SLO)$/sbxstr.obj \ + $(SLO)$/sbxvalue.obj \ # --- Targets ------------------------------------------------------------- diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 67e7ce71aded..0028696fa85b 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 b1815228cd99..62c822af1ea7 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() { @@ -159,11 +160,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--; @@ -207,7 +208,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++ ) @@ -252,7 +253,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; @@ -270,7 +271,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; @@ -289,7 +290,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm ) rStrm.Seek( nOldPos ); if( !p->LoadCompleted() ) { - // Loeschen des Objekts + // Deleting of the object SbxBaseRef aRef( p ); p = NULL; } @@ -297,7 +298,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm ) else { rStrm.SetError( SVSTREAM_FILEFORMAT_ERROR ); - // Loeschen des Objekts + // Deleting of the object SbxBaseRef aRef( p ); p = NULL; } @@ -307,7 +308,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; @@ -460,3 +461,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 7b9b58b31b4e..35e36a94a557 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. @@ -245,3 +246,4 @@ void ImpPutBool( SbxValues* p, INT16 n ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx index e13c63967fc3..727d1174417d 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. @@ -200,7 +201,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: @@ -327,3 +328,4 @@ void ImpPutByte( SbxValues* p, BYTE n ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx index cc6c65d149a5..f516df8876f8 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. @@ -183,7 +184,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: @@ -252,7 +253,7 @@ start: 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: @@ -317,3 +318,4 @@ start: } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx index 7bd32900ecc9..e5518d79a2fd 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 16fec542cded..8155a98c1f07 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. @@ -38,7 +39,7 @@ extern SbxError ImpScan ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen, BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE ); -// mit erweiterter Auswertung (International, "TRUE"/"FALSE") +// with advanced evaluation (International, "TRUE"/"FALSE") extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ); // SBXINT.CXX @@ -149,3 +150,5 @@ 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 e27b11d5166c..d94586c50a12 100644 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.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. @@ -151,7 +152,7 @@ start: case SbxBYREF | SbxCURRENCY: nRes = *p->pLong64; 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: @@ -182,7 +183,7 @@ void ImpPutCurrency( SbxValues* p, const SbxINT64 &r ) start: switch( +p->eType ) { - // Hier sind Tests notwendig + // Here are tests necessary case SbxCHAR: aTmp.pChar = &p->nChar; goto direct; case SbxBYTE: @@ -201,7 +202,7 @@ 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; case SbxDATE: @@ -317,7 +318,7 @@ start: } } -// Hilfs-Funktionen zur Wandlung +// help functions for the conversion static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r ) { @@ -393,3 +394,4 @@ SbxUINT64 ImpDoubleToUINT64( double d ) return nRes; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index 3a0636e4e7fc..054373ac9113 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. @@ -102,13 +103,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(); @@ -205,7 +206,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: @@ -265,7 +266,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 @@ -412,3 +413,4 @@ start: } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index be55d3409131..f0fe163a7a50 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. @@ -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: @@ -176,7 +177,7 @@ start: aTmp.eType = SbxDataType( p->eType | SbxBYREF ); p = &aTmp; goto start; - // ab hier nicht mehr + // from here on no longer case SbxSALINT64: p->nInt64 = ImpDoubleToSalInt64( n ); break; case SbxSALUINT64: @@ -304,3 +305,4 @@ start: } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index 2191d91c8d82..8dcf1d44df61 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. @@ -557,7 +558,7 @@ 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: @@ -597,7 +598,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: @@ -622,7 +623,7 @@ start: aTmp.eType = SbxDataType( p->eType | SbxBYREF ); p = &aTmp; goto start; - // ab hier nicht mehr + // from here on no longer case SbxDECIMAL: case SbxBYREF | SbxDECIMAL: { @@ -795,3 +796,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 cd80bbad282e..fcd7edbe1bc7 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 e5a2bb3f590f..cc48256fbfbc 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. @@ -66,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; @@ -82,16 +83,16 @@ 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 { rSym = p; - // Dann darf es Buchstaben, Zahlen oder Underlines enthalten + // The it can contain alphabetic characters, numbers or underlines 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++; } @@ -100,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 ) @@ -111,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 ); } } @@ -137,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 ) @@ -152,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(); @@ -161,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; @@ -185,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 ) { @@ -199,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; @@ -261,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 ); @@ -281,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; @@ -290,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, @@ -311,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 ); } @@ -356,7 +357,7 @@ static SbxVariable* Element return refVar; } -// Hauptroutine +// Mainroutine SbxVariable* SbxObject::Execute( const XubString& rTxt ) { @@ -397,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 b53612f1e642..182b4e7db37c 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 47c38aecb1c2..e15ece1b6d82 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. @@ -194,7 +195,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: @@ -232,7 +233,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 +249,7 @@ start: aTmp.eType = SbxDataType( p->eType | SbxBYREF ); p = &aTmp; goto start; - // ab hier nicht mehr + // frome here no longer case SbxINTEGER: case SbxBOOL: p->nInteger = n; break; @@ -961,3 +962,4 @@ start: } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx index 1cf2d84061f9..47ae83cb7b21 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. @@ -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: @@ -198,7 +199,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: @@ -222,7 +223,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: @@ -339,3 +340,4 @@ start: } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxmstrm.cxx b/basic/source/sbx/sbxmstrm.cxx index 671c0bc5d1d9..e4ed782d75b2 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 b2b67fe3774f..d4681cd3574e 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.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. @@ -801,7 +802,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix, // Properties in einem String einsammeln 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); @@ -814,7 +815,7 @@ XubString SbxObject::GenerateSource( const XubString &rLinePrefix, if ( bLineFeed ) aSource.AppendAscii( "\n" ); else - bLineFeed = TRUE; + bLineFeed = true; aSource += rLinePrefix; aSource += '.'; @@ -1048,7 +1049,7 @@ SbxClassType SbxProperty::GetClass() const return SbxCLASS_PROPERTY; } -void SbxObject::GarbageCollection( ULONG nObjects ) +void SbxObject::GarbageCollection( ULONG /*nObjects*/ ) /* [Beschreibung] @@ -1061,85 +1062,6 @@ void SbxObject::GarbageCollection( ULONG nObjects ) */ { - (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 369349e72069..61080be5deb1 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 8ed3c7054278..135dcf80f7c9 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 739c86b13c84..9f4c9a6bd495 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. @@ -964,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 70ef1653666b..a6250bf1d570 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. @@ -162,7 +163,7 @@ 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; @@ -226,7 +227,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: @@ -357,3 +358,4 @@ start: } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx index 02f872874d5e..b4b73f79cc58 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. @@ -310,3 +311,5 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr) return aStrBuf.makeStringAndClear(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx index 5b75a24d6d26..a0d11deac1be 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. @@ -329,3 +330,4 @@ start: } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx index e0f6f3fa421d..81e3e9978a5a 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. @@ -319,3 +320,4 @@ start: } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxvals.cxx b/basic/source/sbx/sbxvals.cxx index e63a352879ed..c33d922864c5 100644 --- a/basic/source/sbx/sbxvals.cxx +++ b/basic/source/sbx/sbxvals.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. @@ -107,3 +108,5 @@ BigInt::BigInt( const SbxUINT64 &r ) *this *= a10000; *this += (USHORT)r.nLow; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index d8f047059ef0..d49aa0f495f2 100644 --- 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. @@ -174,12 +175,12 @@ SbxUINT64 &SbxUINT64::operator /= ( const SbxUINT64 &r ) b.UINT64( this ); return *this; } -/////////////////////////// Fehlerbehandlung ///////////////////////////// +/////////////////////////// Error processing ///////////////////////////// #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 ) @@ -204,7 +205,7 @@ int matherr( struct _exception* p ) #endif // _USED -///////////////////////////// Konstruktoren ////////////////////////////// +///////////////////////////// constructors ////////////////////////////// SbxValue::SbxValue() : SbxBase() { @@ -271,7 +272,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: @@ -323,16 +324,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 ); @@ -348,10 +349,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 ) @@ -418,19 +419,19 @@ 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 { return TheRealValue( TRUE ); } -// #55226 Zusaetzliche Info transportieren +// #55226 ship additional information SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const { SbxValue* p = (SbxValue*) this; @@ -439,19 +440,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 ) @@ -467,18 +468,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 ); @@ -487,7 +488,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; @@ -513,8 +514,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(); @@ -584,7 +585,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; @@ -685,7 +686,7 @@ GET( GetUInt64, SbxSALUINT64, sal_uInt64, uInt64 ) GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) -//////////////////////////// Daten schreiben ///////////////////////////// +//////////////////////////// Write data ///////////////////////////// BOOL SbxValue::Put( const SbxValues& rVal ) { @@ -699,11 +700,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() ) @@ -747,17 +748,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 ) @@ -798,36 +799,36 @@ BOOL SbxValue::Put( const SbxValues& rVal ) return bRes; } -// AB, 28.3.96: -// Methode, um bei speziellen Typen eine Vorbehandlung des Strings -// durchzufuehren. Insbesondere erforderlich fuer BASIC-IDE, damit -// die Ausgaben im Watch-Fenster mit PutStringExt zurueckgeschrieben -// werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs -// explizit mit "TRUE" oder "FALSE" angegeben werden. -// Implementierung in ImpConvStringExt (SBXSCAN.CXX) +// From 1996-03-28: +// Method to execute a pretreatment of the strings at special types. +// In particular necessary for BASIC-IDE, so that +// the output in the Watch-Window can be writen back with PutStringExt, +// if Float were declared with ',' as the decimal seperator or BOOl +// explicit with "TRUE" or "FALSE". +// Implementation in ImpConvStringExt (SBXSCAN.CXX) BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) { - // Kopieren, bei Unicode gleich konvertieren + // Copy; if it is Unicode convert it immediately ::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 ) || @@ -842,8 +843,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(); @@ -954,17 +955,17 @@ 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 ); @@ -982,7 +983,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(); @@ -1028,7 +1029,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() ) { @@ -1044,7 +1045,7 @@ BOOL SbxValue::SetType( SbxDataType t ) } else { - // Eventuelle Objekte freigeben + // De-allocate potential objects switch( aData.eType ) { case SbxSTRING: @@ -1067,7 +1068,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; } @@ -1084,7 +1085,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() ) { @@ -1093,19 +1094,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 ); @@ -1118,7 +1119,7 @@ BOOL SbxValue::Convert( SbxDataType eTo ) else return FALSE; } -////////////////////////////////// Rechnen ///////////////////////////////// +////////////////////////////////// Calculating ///////////////////////////////// BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { @@ -1133,21 +1134,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 + // 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; @@ -1156,20 +1157,20 @@ 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 ); - // #30576: Erstmal testen, ob Wandlung geklappt hat + // #30576: To begin with test, if the conversion worked if( aL.pOUString != NULL && aR.pOUString != NULL ) { *aL.pOUString += *aR.pOUString; } - // Nicht einmal Left OK? + // Not even Left OK? else if( aL.pOUString == NULL ) { aL.pOUString = new ::rtl::OUString(); @@ -1180,7 +1181,7 @@ 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 ); } else if( ( eOp >= SbxIDIV && eOp <= SbxNOT ) || eOp == SbxMOD ) @@ -1194,6 +1195,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) 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; } @@ -1280,7 +1283,12 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) break; case SbxNOT: if( aL.eType != SbxLONG && aL.eType != SbxULONG ) - aL.nLong64 = ~aL.nLong64; + { + if ( aL.eType != SbxBOOL ) + aL.nLong64 = ~aL.nLong64; + else + aL.nLong = ~aL.nLong; + } else aL.nLong = ~aL.nLong; break; @@ -1398,7 +1406,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) } else Lbl_OpIsDouble: - { // Andere Operatoren + { // other operators aL.eType = aR.eType = SbxDOUBLE; if( rOp.Get( aR ) ) { @@ -1429,7 +1437,7 @@ Lbl_OpIsDouble: SetError( SbxERR_NOTIMP ); } - // #45465 Date braucht bei + eine Spezial-Behandlung + // #45465 Date needs with "+" a special handling if( eOp == SbxPLUS && (GetType() == SbxDATE || rOp.GetType() == SbxDATE ) ) aL.eType = SbxDATE; } @@ -1452,7 +1460,7 @@ 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 { @@ -1470,11 +1478,11 @@ 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 ) @@ -1487,8 +1495,8 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const 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; @@ -1510,8 +1518,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; @@ -1567,7 +1575,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; @@ -1610,7 +1618,7 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const return bRes; } -///////////////////////////// Lesen/Schreiben //////////////////////////// +///////////////////////////// Reading/Writing //////////////////////////// BOOL SbxValue::LoadData( SvStream& r, USHORT ) { @@ -1627,7 +1635,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; @@ -1643,7 +1651,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; @@ -1672,7 +1680,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) if( aVal.Len() ) aData.pOUString = new ::rtl::OUString( aVal ); else - aData.pOUString = NULL; // JSM 22.09.1995 + aData.pOUString = NULL; // JSM 1995-09-22 break; } case SbxERROR: @@ -1711,7 +1719,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 @@ -1722,7 +1730,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 @@ -1762,7 +1770,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; @@ -1797,7 +1805,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 ) @@ -1851,3 +1859,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 58e3c1ae92c2..4d52381650c9 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. @@ -69,7 +70,7 @@ class SbxVariableImpl }; -///////////////////////////// Konstruktoren ////////////////////////////// +///////////////////////////// Constructors ////////////////////////////// SbxVariable::SbxVariable() : SbxValue() { @@ -149,31 +150,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 ); } @@ -201,7 +202,7 @@ void SbxVariable::SetParameters( SbxArray* p ) } -/////////////////////////// Name der Variablen /////////////////////////// +/////////////////////////// Name of the variables /////////////////////////// void SbxVariable::SetName( const XubString& rName ) { @@ -214,15 +215,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 ) { @@ -244,7 +245,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 ) @@ -260,7 +261,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 ) ); @@ -273,7 +274,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 ) ); @@ -287,7 +288,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 ) { @@ -300,7 +301,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 ) ); @@ -308,7 +309,7 @@ USHORT SbxVariable::MakeHashCode( const XubString& rName ) return n; } -////////////////////////////// Operatoren //////////////////////////////// +////////////////////////////// Operators //////////////////////////////// SbxVariable& SbxVariable::operator=( const SbxVariable& r ) { @@ -321,7 +322,7 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r ) return *this; } -//////////////////////////////// Konversion //////////////////////////////// +//////////////////////////////// Conversion //////////////////////////////// SbxDataType SbxVariable::GetType() const { @@ -343,17 +344,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 ) @@ -403,7 +404,7 @@ void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun:: } -////////////////////////////// Laden/Speichern ///////////////////////////// +////////////////////////////// Loading/Saving ///////////////////////////// BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) { @@ -427,7 +428,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; @@ -445,7 +446,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) rStrm >> aTmp.nLong; break; case SbxSINGLE: { - // Floats als ASCII + // Floats as ASCII rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); double d; SbxDataType t; @@ -460,7 +461,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) case SbxDATE: case SbxDOUBLE: { - // Floats als ASCII + // Floats as ASCII rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); SbxDataType t; if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK ) @@ -482,14 +483,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 ) @@ -497,7 +498,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 ); @@ -512,16 +513,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 ); @@ -536,12 +537,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 @@ -610,7 +611,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 ); } @@ -629,7 +630,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 && @@ -642,3 +643,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 004b61fbf198..449a0ee86584 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. @@ -132,7 +133,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() ); @@ -178,7 +179,7 @@ bool writeOasis2OOoLibraryElement( xml::sax::InputSource source; source.aInputStream = xInput; - source.sSystemId = OUString::createFromAscii( "virtual file" ); + source.sSystemId = OUString(RTL_CONSTASCII_USTRINGPARAM("virtual file")); xParser->parseStream( source ); @@ -322,7 +323,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement try { // start parsing - xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) ); + xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) ); xParser->parseStream( source ); } catch( Exception& ) @@ -336,7 +337,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 +353,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 +381,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 +429,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 +485,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 +511,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 +525,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 +661,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 408b0f3f8dd4..c38fc75c4041 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 2e9474c3b94d..06461e1ed756 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,12 +34,12 @@ #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> @@ -339,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" ); @@ -531,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 ) @@ -1074,10 +1075,10 @@ sal_Bool SfxLibraryContainer::init_Impl( mxSFI->move( aFolderUserBasic, aPrevFolder ); mxSFI->move( aFolderTmp, aFolderUserBasic ); - OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ); - OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ); - OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ); - OUString aInstSearchStr = OUString::createFromAscii( "$(INST)" ); + OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")); + OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")); + OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS")); + OUString aInstSearchStr(RTL_CONSTASCII_USTRINGPARAM("$(INST)")); Sequence< OUString > aNames = pPrevCont->getElementNames(); const OUString* pNames = aNames.getConstArray(); @@ -1225,9 +1226,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; @@ -1696,9 +1697,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; @@ -2181,9 +2179,9 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink maNameContainer.insertByName( Name, aElement ); maModifiable.setModified( sal_True ); - OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ); - OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ); - OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ); + OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")); + OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")); + OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS")); if( StorageURL.indexOf( aUserSearchStr ) != -1 ) { pNewLib->mbExtension = sal_True; @@ -2708,7 +2706,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 ); } @@ -3109,8 +3107,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" ) ); +static rtl::OUString aBasicLibMediaType(RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.basic-library")); +static rtl::OUString aDialogLibMediaType(RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.dialog-library")); ScriptExtensionIterator::ScriptExtensionIterator( void ) : m_eState( USER_EXTENSIONS ) @@ -3134,7 +3132,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 >() ); } } @@ -3179,7 +3177,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; } } @@ -3351,7 +3349,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript Reference< XExtensionManager > xManager = ExtensionManager::get( m_xContext ); m_aUserPackagesSeq = xManager->getDeployedExtensions - (rtl::OUString::createFromAscii("user"), + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) @@ -3374,7 +3372,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 ); } @@ -3405,7 +3403,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri Reference< XExtensionManager > xSharedManager = ExtensionManager::get( m_xContext ); m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions - (rtl::OUString::createFromAscii("shared"), + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) @@ -3427,7 +3425,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 ); } @@ -3458,7 +3456,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr Reference< XExtensionManager > xManager = ExtensionManager::get( m_xContext ); m_aBundledPackagesSeq = xManager->getDeployedExtensions - (rtl::OUString::createFromAscii("bundled"), + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")), Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) @@ -3480,7 +3478,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr { const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray(); Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage ]; - VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" ); + OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" ); m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage ); } @@ -3500,3 +3498,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 db9383a019b5..3c8d115b1912 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 459dac691896..2dd0b3dd7910 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 7a1a4fd2d1cb..5c4e1fc98309 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 3d81d4108bc4..7c4ac1fae2c9 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. @@ -64,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 { @@ -135,7 +137,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa return pImplLib->mbPasswordProtected; } - // Ctor for service SfxScriptLibraryContainer::SfxScriptLibraryContainer( void ) :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) @@ -1163,6 +1164,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() @@ -1324,3 +1336,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 629586f0441c..7340d0813954 100644 --- a/basic/util/makefile.mk +++ b/basic/util/makefile.mk @@ -57,13 +57,11 @@ SHL1STDLIBS= \ $(SVTOOLLIB) \ $(SVLLIB) \ $(VCLLIB) \ - $(VOSLIB) \ $(SALLIB) \ $(SALHELPERLIB) \ $(COMPHELPERLIB) \ $(UNOTOOLSLIB) \ $(SOTLIB) \ - $(VOSLIB) \ $(XMLSCRIPTLIB) .IF "$(SOLAR_JAVA)" != "TRUE" diff --git a/basic/workben/makefile.mk b/basic/workben/makefile.mk index 6ec2a9971b9e..42b65cbb0413 100644 --- a/basic/workben/makefile.mk +++ b/basic/workben/makefile.mk @@ -51,14 +51,14 @@ APP1STDLIBS= \ $(CPPULIB) \ $(SJLIB) \ $(SOTLIB) \ - $(VOSLIB) + #.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC" #APP1STDLIBS+=$(CPPULIB) #.ENDIF #.IF "$(GUI)"=="UNX" #APP1STDLIBS+= \ -# $(VOSLIB) \ +# \ # $(SALLIB) #.ENDIF diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx index 8f702f73b58c..979648fe7112 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. @@ -585,3 +586,5 @@ void __EXPORT TestApp::Main( int, char*[] ) TestApp aTestApp; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |