diff options
Diffstat (limited to 'basic/inc/basic')
35 files changed, 4966 insertions, 0 deletions
diff --git a/basic/inc/basic/basicmanagerrepository.hxx b/basic/inc/basic/basicmanagerrepository.hxx new file mode 100644 index 000000000000..e486c3880f41 --- /dev/null +++ b/basic/inc/basic/basicmanagerrepository.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef BASICMANAGERREPOSITORY_HXX +#define BASICMANAGERREPOSITORY_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/embed/XStorage.hpp> +/** === end UNO includes === **/ + +class BasicManager; + +//........................................................................ +namespace basic +{ +//........................................................................ + + //==================================================================== + //= BasicManagerRepository + //==================================================================== + /** specifies a callback for instances which are interested in BasicManagers + created by the BasicManagerRepository. + */ + class SAL_NO_VTABLE BasicManagerCreationListener + { + public: + /** is called when a BasicManager has been created + + @param _rxForDocument + denotes the document for which the BasicManager has been created. If this is <NULL/>, + then the BasicManager is the application-wide BasicManager. + + @param _pBasicManager + denotes the BasicManager which has been created. The listener might for instance + decide to add global variables to it, or otherwise initialize it. + */ + virtual void onBasicManagerCreated( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxForDocument, + BasicManager& _rBasicManager + ) = 0; + }; + + //==================================================================== + //= BasicManagerRepository + //==================================================================== + class BasicManagerRepository + { + public: + /** returns the BasicManager belonging to the given document + + If the BasicManager does not yet exist, it is created. In this case, if the application's + BasicManager does not yet exist, it is also created. This is necessary since + the application's BasicManager acts as parent for all document's BasicManagers. + + If you're interested in this case - the implicit creation of the application's BasicManager -, + then you need to register as BasicManagerCreationListener. + + @param _rxDocumentModel + denotes the document model whose BasicManager is to be retrieved. Must not be <NULL/>. + The document should support the XDocumentInfoSupplier interface, for retrieving + its title, which is needed in some error conditions. + Also it <em>must</em> support the XStorageBasedDocument interface, since we + must be able to retrieve the document's storage. If this interface is <em>not</em> + supported, creating a new BasicManager will certainly fail. + + @return + the BasicManager for this model. + + @attention + The returned BasicManager instances is owned by the repository. In particular, + you are not allowed to delete it. Instead, the given model is observed: As soon + as it's closed, the associated BasicManager is deleted. + */ + static BasicManager* getDocumentBasicManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocumentModel + ); + + /** returns the application-wide BasicManager + + @param _bCreate + determines whether the BasicManager should be created (<TRUE/>) if it + does not yet exist. + + @attention + If the BasicManager is newly created, then it is still owned by the repository. + In particular, you are not allowed to delete it. Instead, call resetApplicationBasicManager + to release the BasicManager. + */ + static BasicManager* getApplicationBasicManager( bool _bCreate ); + + /** resets the application-wide BasicManager to <NULL/> + */ + static void resetApplicationBasicManager(); + + /** registers a BasicManagerCreationListener instance which is notified whenever + the repository creates a BasicManager instance. + + Note that this listener is <em>not</em> called when somebody else + creates BasicManager instances. + + If the same listener is registered multiple times, it is also notified + multiple times, and needs to be revoked once for each registration. + */ + static void registerCreationListener( + BasicManagerCreationListener& _rListener + ); + + /** reveokes a BasicManagerCreationListener instance which has previously + been registered to be notified about created BasicManager instances. + */ + static void revokeCreationListener( + BasicManagerCreationListener& _rListener + ); + }; + +//........................................................................ +} // 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 new file mode 100644 index 000000000000..2d39eb79ca02 --- /dev/null +++ b/basic/inc/basic/basicrt.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BASICRT_HXX +#define _BASICRT_HXX + +#include <tools/string.hxx> +#include <basic/sbxdef.hxx> + +class SbiRuntime; +class SbErrorStackEntry; + +class BasicRuntime +{ + SbiRuntime* pRun; +public: + BasicRuntime( SbiRuntime* p ) : pRun ( p ){;} + const String GetSourceRevision(); + const String GetModuleName( SbxNameType nType ); + const String GetMethodName( SbxNameType nType ); + xub_StrLen GetLine(); + xub_StrLen GetCol1(); + xub_StrLen GetCol2(); + sal_Bool IsRun(); + sal_Bool IsValid() { return pRun != NULL; } + BasicRuntime GetNextRuntime(); +}; + +class BasicErrorStackEntry +{ + SbErrorStackEntry *pEntry; +public: + BasicErrorStackEntry( SbErrorStackEntry *p ) : pEntry ( p ){;} + const String GetSourceRevision(); + const String GetModuleName( SbxNameType nType ); + const String GetMethodName( SbxNameType nType ); + xub_StrLen GetLine(); + xub_StrLen GetCol1(); + xub_StrLen GetCol2(); +}; + +class BasicRuntimeAccess +{ +public: + static BasicRuntime GetRuntime(); + static bool HasRuntime(); + static sal_uInt16 GetStackEntryCount(); + static BasicErrorStackEntry GetStackEntry( sal_uInt16 nIndex ); + static sal_Bool HasStack(); + static void DeleteStack(); + + static sal_Bool IsRunInit(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx new file mode 100644 index 000000000000..8dc90817c936 --- /dev/null +++ b/basic/inc/basic/basmgr.hxx @@ -0,0 +1,269 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BASMGR_HXX +#define _BASMGR_HXX + +#include <tools/string.hxx> +#include <svl/brdcst.hxx> +#include <basic/sbstar.hxx> +#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> +#include <com/sun/star/script/XStarBasicAccess.hpp> + + +// Basic XML Import/Export +com::sun::star::uno::Reference< com::sun::star::script::XStarBasicAccess > + getStarBasicAccess( BasicManager* pMgr ); + + + +class SotStorage; + +#define BASERR_ID_STDLIBOPEN ERRCODE_BASMGR_STDLIBOPEN +#define BASERR_ID_STDLIBSAVE ERRCODE_BASMGR_STDLIBSAVE +#define BASERR_ID_LIBLOAD ERRCODE_BASMGR_LIBLOAD +#define BASERR_ID_LIBCREATE ERRCODE_BASMGR_LIBCREATE +#define BASERR_ID_LIBSAVE ERRCODE_BASMGR_LIBSAVE +#define BASERR_ID_LIBDEL ERRCODE_BASMGR_LIBDEL +#define BASERR_ID_MGROPEN ERRCODE_BASMGR_MGROPEN +#define BASERR_ID_MGRSAVE ERRCODE_BASMGR_MGRSAVE +#define BASERR_ID_REMOVELIB ERRCODE_BASMGR_REMOVELIB +#define BASERR_ID_UNLOADLIB ERRCODE_BASMGR_UNLOADLIB + +#define BASERR_REASON_OPENSTORAGE 0x0001 +#define BASERR_REASON_OPENLIBSTORAGE 0x0002 +#define BASERR_REASON_OPENMGRSTREAM 0x0004 +#define BASERR_REASON_OPENLIBSTREAM 0x0008 +#define BASERR_REASON_LIBNOTFOUND 0x0010 +#define BASERR_REASON_STORAGENOTFOUND 0x0020 +#define BASERR_REASON_BASICLOADERROR 0x0040 +#define BASERR_REASON_NOSTORAGENAME 0x0080 + +#define BASERR_REASON_STDLIB 0x0100 + +class BasicError +{ +private: + sal_uIntPtr nErrorId; + sal_uInt16 nReason; + String aErrStr; + +public: + BasicError(); + BasicError( const BasicError& rErr ); + BasicError( sal_uIntPtr nId, sal_uInt16 nR, const String& rErrStr ); + + sal_uIntPtr GetErrorId() const { return nErrorId; } + sal_uInt16 GetReason() const { return nReason; } + String GetErrorStr() { return aErrStr; } + + void SetErrorId( sal_uIntPtr n ) { nErrorId = n; } + void SetReason( sal_uInt16 n ) { nReason = n; } + void SetErrorStr( const String& rStr) { aErrStr = rStr; } +}; + + + +class BasicLibs; +class ErrorManager; +class BasicLibInfo; +class BasicErrorManager; +namespace basic { class BasicManagerCleaner; } + +// Library password handling for 5.0 documents +class OldBasicPassword +{ +public: + virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword ) = 0; + virtual String getLibraryPassword( const String& rLibraryName ) = 0; + virtual void clearLibraryPassword( const String& rLibraryName ) = 0; + virtual sal_Bool hasLibraryPassword( const String& rLibraryName ) = 0; +}; + +struct LibraryContainerInfo +{ + ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxScriptCont; + ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxDialogCont; + OldBasicPassword* mpOldBasicPassword; + + LibraryContainerInfo() + :mpOldBasicPassword( NULL ) + { + } + + LibraryContainerInfo + ( + com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > xScriptCont, + com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > xDialogCont, + OldBasicPassword* pOldBasicPassword + ) + : mxScriptCont( xScriptCont ) + , mxDialogCont( xDialogCont ) + , mpOldBasicPassword( pOldBasicPassword ) + {} +}; + +struct BasicManagerImpl; + + +#define LIB_NOTFOUND 0xFFFF + +class BasicManager : public SfxBroadcaster +{ + friend class LibraryContainer_Impl; + friend class StarBasicAccess_Impl; + friend class BasMgrContainerListenerImpl; + friend class ::basic::BasicManagerCleaner; + +private: + BasicLibs* pLibs; + BasicErrorManager* pErrorMgr; + + String aName; + String maStorageName; + sal_Bool bBasMgrModified; + sal_Bool mbDocMgr; + + BasicManagerImpl* mpImpl; + + void Init(); + +protected: + sal_Bool ImpLoadLibary( BasicLibInfo* pLibInfo ) const; + sal_Bool ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly = sal_False ) const; + void ImpCreateStdLib( StarBASIC* pParentFromStdLib ); + void ImpMgrNotLoaded( const String& rStorageName ); + BasicLibInfo* CreateLibInfo(); + void LoadBasicManager( SotStorage& rStorage, const String& rBaseURL, sal_Bool bLoadBasics = sal_True ); + void LoadOldBasicManager( SotStorage& rStorage ); + sal_Bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const; + sal_Bool ImplEncryptStream( SvStream& rStream ) const; + BasicLibInfo* FindLibInfo( StarBASIC* pBasic ) const; + void CheckModules( StarBASIC* pBasic, sal_Bool bReference ) const; + void SetFlagToAllLibs( short nFlag, sal_Bool bSet ) const; + BasicManager(); // This is used only to customize the paths for 'Save as'. + ~BasicManager(); + +public: + TYPEINFO(); + BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBASIC* pParentFromStdLib = NULL, String* pLibPath = NULL, sal_Bool bDocMgr = sal_False ); + BasicManager( StarBASIC* pStdLib, String* pLibPath = NULL, sal_Bool bDocMgr = sal_False ); + + /** deletes the given BasicManager instance + + This method is necessary since normally, BasicManager instances are owned by the BasicManagerRepository, + and expected to be deleted by the repository only. However, there exists quite some legacy code, + which needs to explicitly delete a BasicManager itself. This code must not use the (protected) + destructor, but LegacyDeleteBasicManager. + */ + static void LegacyDeleteBasicManager( BasicManager*& _rpManager ); + + void SetStorageName( const String& rName ) { maStorageName = rName; } + String GetStorageName() const { return maStorageName; } + void SetName( const String& rName ) { aName = rName; } + String GetName() const { return aName; } + + + sal_uInt16 GetLibCount() const; + StarBASIC* GetLib( sal_uInt16 nLib ) const; + StarBASIC* GetLib( const String& rName ) const; + sal_uInt16 GetLibId( const String& rName ) const; + + String GetLibName( sal_uInt16 nLib ); + + /** announces the library containers which belong to this BasicManager + + The method will automatically add two global constants, BasicLibraries and DialogLibraries, + to the BasicManager. + */ + void SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ); + + const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >& + GetDialogLibraryContainer() const; + const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >& + GetScriptLibraryContainer() const; + + sal_Bool LoadLib( sal_uInt16 nLib ); + sal_Bool RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage ); + + // Modify-Flag will be reset only during save. + sal_Bool IsModified() const; + sal_Bool IsBasicModified() const; + + sal_Bool HasErrors(); + void ClearErrors(); + BasicError* GetFirstError(); + BasicError* GetNextError(); + + /** sets a global constant in the basic library, referring to some UNO object, to a new value. + + If a constant with this name already existed before, its value is changed, and the old constant is + returned. If it does not yet exist, it is newly created, and inserted into the basic library. + */ + ::com::sun::star::uno::Any + SetGlobalUNOConstant( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rValue ); + + /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */ + bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); + /** determines whether there are password-protected modules whose size exceedes the + legacy module size + @param _out_rModuleNames + 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& ); + /// determines whether the Basic Manager has a given macro, given by fully qualified name + bool HasMacro( String const& i_fullyQualifiedName ) const; + /// executes a given macro + ErrCode ExecuteMacro( String const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue ); + /// executes a given macro + ErrCode ExecuteMacro( String const& i_fullyQualifiedName, String const& i_commaSeparatedArgs, SbxValue* i_retValue ); + +private: + sal_Bool IsReference( sal_uInt16 nLib ); + + sal_Bool SetLibName( sal_uInt16 nLib, const String& rName ); + + StarBASIC* GetStdLib() const; + StarBASIC* AddLib( SotStorage& rStorage, const String& rLibName, sal_Bool bReference ); + sal_Bool RemoveLib( sal_uInt16 nLib ); + sal_Bool HasLib( const String& rName ) const; + + StarBASIC* CreateLibForLibContainer( const String& rLibName, + const com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >& + xScriptCont ); + // For XML import/export: + StarBASIC* CreateLib( const String& rLibName ); + StarBASIC* CreateLib( const String& rLibName, const String& Password, + const String& LinkTargetURL ); +}; + +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 new file mode 100644 index 000000000000..b11607201bb5 --- /dev/null +++ b/basic/inc/basic/basrdll.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _BASRDLL_HXX +#define _BASRDLL_HXX + +class ResMgr; + +#include <vcl/accel.hxx> + +class BasicDLL +{ +private: + ResMgr* pSttResMgr; + ResMgr* pBasResMgr; + + sal_Bool bDebugMode; + sal_Bool bBreakEnabled; + +public: + BasicDLL(); + ~BasicDLL(); + + ResMgr* GetSttResMgr() const { return pSttResMgr; } + ResMgr* GetBasResMgr() const { return pBasResMgr; } + + static void BasicBreak(); + + static void EnableBreak( sal_Bool bEnable ); + static void SetDebugMode( sal_Bool bDebugMode ); +}; + +#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 new file mode 100644 index 000000000000..9feb0edbef98 --- /dev/null +++ b/basic/inc/basic/dispdefs.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BASIC_DISPDEFS_HXX +#define _BASIC_DISPDEFS_HXX + +#define DH_MODE_DATA_VALID 0x0001 // ModeData (for compatibility with old Office) + +#define DH_MODE_KURZNAME 0x0002 // View short name instead of UniqueID (if possible) +#define DH_MODE_LANGNAME 0x0004 // Always view long name +#define DH_MODE_ALLWIN 0x0008 // View all windows +#define DH_MODE_SEND_DATA 0x0010 // Send data to Testtool + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/modsizeexceeded.hxx b/basic/inc/basic/modsizeexceeded.hxx new file mode 100644 index 000000000000..414b7aff72e0 --- /dev/null +++ b/basic/inc/basic/modsizeexceeded.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _BASIC_MODSIZEEXCEEDED_HXX +#define _BASIC_MODSIZEEXCEEDED_HXX + +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <cppuhelper/implbase1.hxx> + +class ModuleSizeExceeded : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > +{ + // C++ interface + public: + ModuleSizeExceeded( const com::sun::star::uno::Sequence< ::rtl::OUString>& sModules ); + + sal_Bool isAbort() const; + sal_Bool isApprove() const; + + // UNO interface + public: + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException ) { return m_lContinuations; } + com::sun::star::uno::Any SAL_CALL getRequest() throw( com::sun::star::uno::RuntimeException ) + { + return m_aRequest; + } + + // member + private: + rtl::OUString m_sMods; + com::sun::star::uno::Any m_aRequest; + com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > m_lContinuations; + com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > m_xAbort; + com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation> m_xApprove; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/mybasic.hxx b/basic/inc/basic/mybasic.hxx new file mode 100644 index 000000000000..3a2ab068d4c4 --- /dev/null +++ b/basic/inc/basic/mybasic.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MYBASIC_HXX +#define _MYBASIC_HXX + +#include <basic/sbstar.hxx> +#include <vector> + +class BasicApp; +class AppBasEd; +class ErrorEntry; + +#define SBXID_MYBASIC 0x594D // MyBasic: MY +#define SBXCR_TEST 0x54534554 // TEST + +//----------------------------------------------------------------------------- +class BasicError { + AppBasEd* pWin; + sal_uInt16 nLine, nCol1, nCol2; + String aText; +public: + BasicError( AppBasEd*, sal_uInt16, const String&, sal_uInt16, sal_uInt16, sal_uInt16 ); + void Show(); +}; + +//----------------------------------------------------------------------------- +class MyBasic : public StarBASIC +{ + SbError nError; + virtual sal_Bool ErrorHdl(); + virtual sal_uInt16 BreakHdl(); + +protected: + ::std::vector< BasicError* > aErrors; + size_t CurrentError; + Link GenLogHdl(); + Link GenWinInfoHdl(); + Link GenModuleWinExistsHdl(); + Link GenWriteStringHdl(); + + virtual void StartListeningTT( SfxBroadcaster &rBroadcaster ); + + String GenRealString( const String &aResString ); + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_TEST,SBXID_MYBASIC,1); + TYPEINFO(); + MyBasic(); + virtual ~MyBasic(); + virtual sal_Bool Compile( SbModule* ); + void Reset(); + SbError GetErrors() { return nError; } + size_t GetCurrentError() { return CurrentError; } + BasicError* FirstError(); + BasicError* NextError(); + BasicError* PrevError(); + + // Do not use #ifdefs here because this header file is both used for testtool and basic + SbxObject *pTestObject; // for Testool; otherwise NULL + + virtual void LoadIniFile(); + + // Determines the extended symbol type for syntax highlighting + virtual SbTextType GetSymbolType( const String &Symbol, sal_Bool bWasTTControl ); + virtual const String GetSpechialErrorText(); + virtual void ReportRuntimeError( AppBasEd *pEditWin ); + virtual void DebugFindNoErrors( sal_Bool bDebugFindNoErrors ); + + static void SetCompileModule( SbModule *pMod ); + static SbModule *GetCompileModule(); +}; + +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 new file mode 100644 index 000000000000..b88391b412ca --- /dev/null +++ b/basic/inc/basic/process.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PROCESS_HXX +#define _PROCESS_HXX + +#include <tools/string.hxx> +#include <osl/process.h> + +#include <map> + +typedef std::map< String, String > Environment; +typedef Environment::value_type EnvironmentVariable; + +class Process +{ + // Internal members and methods + sal_uInt32 m_nArgumentCount; + rtl_uString **m_pArgumentList; + sal_uInt32 m_nEnvCount; + rtl_uString **m_pEnvList; + rtl::OUString m_aProcessName; + oslProcess m_pProcess; + sal_Bool ImplIsRunning(); + long ImplGetExitCode(); + sal_Bool bWasGPF; + sal_Bool bHasBeenStarted; + +public: + Process(); + ~Process(); + // Methoden + void SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv = NULL ); + sal_Bool Start(); + sal_uIntPtr GetExitCode(); + sal_Bool IsRunning(); + sal_Bool WasGPF(); + + sal_Bool Terminate(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbdef.hxx b/basic/inc/basic/sbdef.hxx new file mode 100644 index 000000000000..85218a34965f --- /dev/null +++ b/basic/inc/basic/sbdef.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBDEF_HXX +#define _SB_SBDEF_HXX + +#include <basic/sbxdef.hxx> +#include <svl/svarray.hxx> + +#define _BASIC_TEXTPORTIONS + +// Type of a text token (syntax highlighting) +enum SbTextType +{ + SB_KEYWORD = 1, // Keywords + SB_SYMBOL, // Symbols + SB_STRING, // Strings + SB_NUMBER, // Numbers + SB_PUNCTUATION, // Brackets, points, etc. + SB_COMMENT, // Comments + SB_DUMMY = 255 // workaround for #i31479 +}; + +// Active language +enum SbLanguageMode +{ + SB_LANG_GLOBAL, // As in SbiGlobals struct + SB_LANG_BASIC, // StarBasic (Default) + SB_LANG_VBSCRIPT, // Visual-Basic-Script + SB_LANG_JAVASCRIPT // JavaScript +}; + +#ifdef _BASIC_TEXTPORTIONS +struct SbTextPortion +{ // Syntax Highlighting: a text portion + xub_StrLen nLine; // Line number + xub_StrLen nStart, nEnd; // 1st and last column + SbTextType eType; // Type of the portion +}; + +SV_DECL_VARARR(SbTextPortions, SbTextPortion,16,16) +#else +class SbTextPortions; +#endif + +// Returns type name for Basic type, array flag is ignored +// implementation: basic/source/runtime/methods.cxx +String getBasicTypeName( SbxDataType eType ); + +// Returns type name for Basic objects, especially +// important for SbUnoObj instances +// implementation: basic/source/classes/sbunoobj.cxx +class SbxObject; +String getBasicObjectTypeName( SbxObject* pObj ); + +// Allows Basic IDE to set watch mode to suppress errors +// implementation: basic/source/runtime/runtime.cxx +void setBasicWatchMode( bool bOn ); + +// Debug Flags: +#define SbDEBUG_BREAK 0x0001 // Break-Callback +#define SbDEBUG_STEPINTO 0x0002 // Single Step-Callback +#define SbDEBUG_STEPOVER 0x0004 // Additional flag Step Over +#define SbDEBUG_CONTINUE 0x0008 // Do not change flags +#define SbDEBUG_STEPOUT 0x0010 // Leave Sub + +#define SBXID_BASIC 0x6273 // sb: StarBASIC +#define SBXID_BASICMOD 0x6d62 // bm: StarBASIC Module +#define SBXID_BASICPROP 0x7262 // pr: StarBASIC Property +#define SBXID_BASICMETHOD 0x6d65 // me: StarBASIC Method +#define SBXID_JSCRIPTMOD 0x6a62 // jm: JavaScript Module +#define SBXID_JSCRIPTMETH 0x6a64 // jm: JavaScript Module + +#define SBX_HINT_BASICSTART SFX_HINT_USER04 +#define SBX_HINT_BASICSTOP SFX_HINT_USER05 + +enum PropertyMode +{ + PROPERTY_MODE_NONE, + PROPERTY_MODE_GET, + PROPERTY_MODE_LET, + PROPERTY_MODE_SET +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sberrors.hxx b/basic/inc/basic/sberrors.hxx new file mode 100644 index 000000000000..f2e40ac2e05c --- /dev/null +++ b/basic/inc/basic/sberrors.hxx @@ -0,0 +1,565 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBERRORS_HXX +#define _SB_SBERRORS_HXX + +#include <basic/sbxdef.hxx> + +#ifndef __RSC +typedef sal_uIntPtr SbError; +#endif + +// Mapping to SbxError +#define ERRCODE_BASIC_SYNTAX ERRCODE_SBX_SYNTAX // unspecified syntax error +#define ERRCODE_BASIC_BAD_ARGUMENT ERRCODE_SBX_NOTIMP // Invalid procedure call +#define ERRCODE_BASIC_MATH_OVERFLOW ERRCODE_SBX_OVERFLOW // Overflow +#define ERRCODE_BASIC_OUT_OF_RANGE ERRCODE_SBX_BOUNDS // Subscript out of range +#define ERRCODE_BASIC_ZERODIV ERRCODE_SBX_ZERODIV // Division by zero +#define ERRCODE_BASIC_CONVERSION ERRCODE_SBX_CONVERSION // Type mismatch +#define ERRCODE_BASIC_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER // Invalid Parameter +#define ERRCODE_BASIC_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED // Sub or Function not defined +#define ERRCODE_BASIC_INTERNAL_ERROR ERRCODE_SBX_ERROR // internal error +#define ERRCODE_BASIC_NO_OBJECT ERRCODE_SBX_NO_OBJECT // Object variable not set +#define ERRCODE_BASIC_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD // Can't load module +#define ERRCODE_BASIC_BAD_INDEX ERRCODE_SBX_BAD_INDEX // Invalid object index +#define ERRCODE_BASIC_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT // No active view or document +#define ERRCODE_BASIC_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE // Bad property value +#define ERRCODE_BASIC_PROP_READONLY ERRCODE_SBX_PROP_READONLY // Property is read only +#define ERRCODE_BASIC_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY // Property is write only +#define ERRCODE_BASIC_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT // Invalid object reference +#define ERRCODE_BASIC_NO_METHOD ERRCODE_SBX_NO_METHOD // Property or method not found +#define ERRCODE_BASIC_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT // Invalid usee of object +#define ERRCODE_BASIC_NO_OLE ERRCODE_SBX_NO_OLE // Class does not support OLE +#define ERRCODE_BASIC_BAD_METHOD ERRCODE_SBX_BAD_METHOD // Object doesn't support method +#define ERRCODE_BASIC_OLE_ERROR ERRCODE_SBX_OLE_ERROR // OLE Automation error +#define ERRCODE_BASIC_BAD_ACTION ERRCODE_SBX_BAD_ACTION // Object doesn't support this action +#define ERRCODE_BASIC_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS // Object doesn't support named args +#define ERRCODE_BASIC_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE // Object doesn't support current locale setting +#define ERRCODE_BASIC_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND // Named argument not found +#define ERRCODE_BASIC_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL // Argument not optional +#define ERRCODE_BASIC_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS // Wrong number of arguments +#define ERRCODE_BASIC_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL // Object not a collection + +// Append Basic specific error messages to ERRCODE_AREA_SBX +#define ERRCODE_BASIC_NO_GOSUB ((LAST_SBX_ERROR_ID+1UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Return without Gosub +#define ERRCODE_BASIC_REDO_FROM_START ((LAST_SBX_ERROR_ID+2UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Redo form start (SB internal) +#define ERRCODE_BASIC_NO_MEMORY ((LAST_SBX_ERROR_ID+3UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Out of memory +#define ERRCODE_BASIC_ALREADY_DIM ((LAST_SBX_ERROR_ID+4UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Array already dimensioned +#define ERRCODE_BASIC_DUPLICATE_DEF ((LAST_SBX_ERROR_ID+5UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Duplicate definition +#define ERRCODE_BASIC_VAR_UNDEFINED ((LAST_SBX_ERROR_ID+6UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Variable undefined (SB) +#define ERRCODE_BASIC_USER_ABORT ((LAST_SBX_ERROR_ID+7UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // User interrupt occurred +#define ERRCODE_BASIC_BAD_RESUME ((LAST_SBX_ERROR_ID+8UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Resume without error +#define ERRCODE_BASIC_STACK_OVERFLOW ((LAST_SBX_ERROR_ID+9UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Out of stack space +#define ERRCODE_BASIC_BAD_DLL_LOAD ((LAST_SBX_ERROR_ID+10UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Error in loading DLL +#define ERRCODE_BASIC_BAD_DLL_CALL ((LAST_SBX_ERROR_ID+11UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Bad DLL calling convention +#define ERRCODE_BASIC_BAD_CHANNEL ((LAST_SBX_ERROR_ID+12UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Bad file name or number +#define ERRCODE_BASIC_FILE_NOT_FOUND ((LAST_SBX_ERROR_ID+13UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // File not found +#define ERRCODE_BASIC_BAD_FILE_MODE ((LAST_SBX_ERROR_ID+14UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Bad file mode +#define ERRCODE_BASIC_FILE_ALREADY_OPEN ((LAST_SBX_ERROR_ID+15UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // File already open +#define ERRCODE_BASIC_IO_ERROR ((LAST_SBX_ERROR_ID+16UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Device I/O error +#define ERRCODE_BASIC_FILE_EXISTS ((LAST_SBX_ERROR_ID+17UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // File already exists +#define ERRCODE_BASIC_BAD_RECORD_LENGTH ((LAST_SBX_ERROR_ID+18UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // bad record length +#define ERRCODE_BASIC_DISK_FULL ((LAST_SBX_ERROR_ID+19UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // disk full +#define ERRCODE_BASIC_READ_PAST_EOF ((LAST_SBX_ERROR_ID+20UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Input past end of file +#define ERRCODE_BASIC_BAD_RECORD_NUMBER ((LAST_SBX_ERROR_ID+21UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Bad record number +#define ERRCODE_BASIC_TOO_MANY_FILES ((LAST_SBX_ERROR_ID+22UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Too many files +#define ERRCODE_BASIC_NO_DEVICE ((LAST_SBX_ERROR_ID+23UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Device not available +#define ERRCODE_BASIC_ACCESS_DENIED ((LAST_SBX_ERROR_ID+24UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Permission denied +#define ERRCODE_BASIC_NOT_READY ((LAST_SBX_ERROR_ID+25UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Disk not ready +#define ERRCODE_BASIC_NOT_IMPLEMENTED ((LAST_SBX_ERROR_ID+26UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Feature not implemented +#define ERRCODE_BASIC_DIFFERENT_DRIVE ((LAST_SBX_ERROR_ID+27UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // No rename with different drive +#define ERRCODE_BASIC_ACCESS_ERROR ((LAST_SBX_ERROR_ID+28UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Path/File access error +#define ERRCODE_BASIC_PATH_NOT_FOUND ((LAST_SBX_ERROR_ID+29UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Path not found +#define ERRCODE_BASIC_BAD_PATTERN ((LAST_SBX_ERROR_ID+30UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Invalid pattern string +#define ERRCODE_BASIC_IS_NULL ((LAST_SBX_ERROR_ID+31UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Invalid use of Null + +// DDE messages from 250-299 +#define ERRCODE_BASIC_DDE_ERROR ((LAST_SBX_ERROR_ID+32UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_WAITINGACK ((LAST_SBX_ERROR_ID+33UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_OUTOFCHANNELS ((LAST_SBX_ERROR_ID+34UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_NO_RESPONSE ((LAST_SBX_ERROR_ID+35UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_MULT_RESPONSES ((LAST_SBX_ERROR_ID+36UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED ((LAST_SBX_ERROR_ID+37UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_NOTPROCESSED ((LAST_SBX_ERROR_ID+38UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_TIMEOUT ((LAST_SBX_ERROR_ID+39UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_USER_INTERRUPT ((LAST_SBX_ERROR_ID+40UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_BUSY ((LAST_SBX_ERROR_ID+41UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_NO_DATA ((LAST_SBX_ERROR_ID+42UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT ((LAST_SBX_ERROR_ID+43UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_PARTNER_QUIT ((LAST_SBX_ERROR_ID+44UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_CONV_CLOSED ((LAST_SBX_ERROR_ID+45UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_NO_CHANNEL ((LAST_SBX_ERROR_ID+46UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_INVALID_LINK ((LAST_SBX_ERROR_ID+47UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW ((LAST_SBX_ERROR_ID+48UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST ((LAST_SBX_ERROR_ID+49UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC ((LAST_SBX_ERROR_ID+50UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND ((LAST_SBX_ERROR_ID+51UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) + +#define ERRCODE_BASIC_NEEDS_OBJECT ((LAST_SBX_ERROR_ID+52UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Object required +#define ERRCODE_BASIC_BAD_ORDINAL ((LAST_SBX_ERROR_ID+53UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Invalid ordinal +#define ERRCODE_BASIC_DLLPROC_NOT_FOUND ((LAST_SBX_ERROR_ID+54UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Specified DLL function not found +#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT ((LAST_SBX_ERROR_ID+55UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Invalid clipboard format + +// Debugger messages from 700-799 + +#define ERRCODE_BASIC_PROPERTY_NOT_FOUND ((LAST_SBX_ERROR_ID+56UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Class not have property +#define ERRCODE_BASIC_METHOD_NOT_FOUND ((LAST_SBX_ERROR_ID+57UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Class does not have method +#define ERRCODE_BASIC_ARG_MISSING ((LAST_SBX_ERROR_ID+58UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Missing required argument +#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS ((LAST_SBX_ERROR_ID+59UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Bad number of arguments +#define ERRCODE_BASIC_METHOD_FAILED ((LAST_SBX_ERROR_ID+60UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Method failed +#define ERRCODE_BASIC_SETPROP_FAILED ((LAST_SBX_ERROR_ID+61UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Unable to set property +#define ERRCODE_BASIC_GETPROP_FAILED ((LAST_SBX_ERROR_ID+62UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) // Unable to get property + +// Compiler Errors (do not occure at runtime) +// These IDs can shift at any time + +#define ERRCODE_BASIC_UNEXPECTED ((LAST_SBX_ERROR_ID+63UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Unexpected symbol: xx +// #define ERRCODE_BASIC_COMPILER_BGN ERRCODE_BASIC_UNEXPECTED +#define ERRCODE_BASIC_EXPECTED ((LAST_SBX_ERROR_ID+64UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Expected: xx +#define ERRCODE_BASIC_SYMBOL_EXPECTED ((LAST_SBX_ERROR_ID+65UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Symbol expected +#define ERRCODE_BASIC_VAR_EXPECTED ((LAST_SBX_ERROR_ID+66UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Variable expected +#define ERRCODE_BASIC_LABEL_EXPECTED ((LAST_SBX_ERROR_ID+67UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Label expected +#define ERRCODE_BASIC_LVALUE_EXPECTED ((LAST_SBX_ERROR_ID+68UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Lvalue expected +#define ERRCODE_BASIC_VAR_DEFINED ((LAST_SBX_ERROR_ID+69UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Variable xxx already defined +#define ERRCODE_BASIC_PROC_DEFINED ((LAST_SBX_ERROR_ID+70UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Procedure xx already defined +#define ERRCODE_BASIC_LABEL_DEFINED ((LAST_SBX_ERROR_ID+71UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Label xxx already defined +#define ERRCODE_BASIC_UNDEF_VAR ((LAST_SBX_ERROR_ID+72UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Variable xx undefined +#define ERRCODE_BASIC_UNDEF_ARRAY ((LAST_SBX_ERROR_ID+73UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Array or function xx undefined +#define ERRCODE_BASIC_UNDEF_PROC ((LAST_SBX_ERROR_ID+74UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Procedure xxx undefined +#define ERRCODE_BASIC_UNDEF_LABEL ((LAST_SBX_ERROR_ID+75UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Label xxx undefined +#define ERRCODE_BASIC_UNDEF_TYPE ((LAST_SBX_ERROR_ID+76UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Unknown user defined type xxx +#define ERRCODE_BASIC_BAD_EXIT ((LAST_SBX_ERROR_ID+77UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Exit XXX expected +#define ERRCODE_BASIC_BAD_BLOCK ((LAST_SBX_ERROR_ID+78UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Unterminated statement block: missing XX +#define ERRCODE_BASIC_BAD_BRACKETS ((LAST_SBX_ERROR_ID+79UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Parentheses do not match +#define ERRCODE_BASIC_BAD_DECLARATION ((LAST_SBX_ERROR_ID+80UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Symbol xx defined differently +#define ERRCODE_BASIC_BAD_PARAMETERS ((LAST_SBX_ERROR_ID+81UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Parameters do not match +#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER ((LAST_SBX_ERROR_ID+82UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Bad character in number +#define ERRCODE_BASIC_MUST_HAVE_DIMS ((LAST_SBX_ERROR_ID+83UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Array needs dimensioning +#define ERRCODE_BASIC_NO_IF ((LAST_SBX_ERROR_ID+84UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Else/Endif without If +#define ERRCODE_BASIC_NOT_IN_SUBR ((LAST_SBX_ERROR_ID+85UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // xxx not allowed within a sub +#define ERRCODE_BASIC_NOT_IN_MAIN ((LAST_SBX_ERROR_ID+86UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // xxx not allowed outside a sub +#define ERRCODE_BASIC_WRONG_DIMS ((LAST_SBX_ERROR_ID+87UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Dimensions do not match +#define ERRCODE_BASIC_BAD_OPTION ((LAST_SBX_ERROR_ID+88UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Unknown option: xxx +#define ERRCODE_BASIC_CONSTANT_REDECLARED ((LAST_SBX_ERROR_ID+89UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Constant xx redeclared +#define ERRCODE_BASIC_PROG_TOO_LARGE ((LAST_SBX_ERROR_ID+90UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Program is too large +#define ERRCODE_BASIC_NO_STRINGS_ARRAYS ((LAST_SBX_ERROR_ID+91UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) + +#define ERRCODE_BASIC_EXCEPTION ((LAST_SBX_ERROR_ID+92UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_RUNTIME) + +#define ERRCODE_BASMGR_STDLIBOPEN (LAST_SBX_ERROR_ID+93UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_STDLIBSAVE (LAST_SBX_ERROR_ID+94UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_LIBLOAD (LAST_SBX_ERROR_ID+95UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_LIBCREATE (LAST_SBX_ERROR_ID+96UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_LIBSAVE (LAST_SBX_ERROR_ID+97UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_LIBDEL (LAST_SBX_ERROR_ID+98UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_MGROPEN (LAST_SBX_ERROR_ID+99UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_MGRSAVE (LAST_SBX_ERROR_ID+100UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_REMOVELIB (LAST_SBX_ERROR_ID+101UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_UNLOADLIB (LAST_SBX_ERROR_ID+102UL) | ERRCODE_AREA_SBX + +#define ERRCODE_BASIC_ARRAY_FIX ((LAST_SBX_ERROR_ID+104UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // This array is fixed +#define ERRCODE_BASIC_STRING_OVERFLOW ((LAST_SBX_ERROR_ID+105UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Out of string space +#define ERRCODE_BASIC_EXPR_TOO_COMPLEX ((LAST_SBX_ERROR_ID+106UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Expression too complex +#define ERRCODE_BASIC_OPER_NOT_PERFORM ((LAST_SBX_ERROR_ID+107UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Can't perform requested operation +#define ERRCODE_BASIC_TOO_MANY_DLL ((LAST_SBX_ERROR_ID+108UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // Too many dll application clients +#define ERRCODE_BASIC_LOOP_NOT_INIT ((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \ + ERRCODE_CLASS_COMPILER) // For loop not initialized + +#define ERRCODE_BASIC_COMPAT ((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) + +// Map old codes to new codes +#define SbERR_SYNTAX ERRCODE_BASIC_SYNTAX +#define SbERR_NO_GOSUB ERRCODE_BASIC_NO_GOSUB +#define SbERR_REDO_FROM_START ERRCODE_BASIC_REDO_FROM_START +#define SbERR_BAD_ARGUMENT ERRCODE_BASIC_BAD_ARGUMENT +#define SbERR_MATH_OVERFLOW ERRCODE_BASIC_MATH_OVERFLOW +#define SbERR_NO_MEMORY ERRCODE_BASIC_NO_MEMORY +#define SbERR_ALREADY_DIM ERRCODE_BASIC_ALREADY_DIM +#define SbERR_OUT_OF_RANGE ERRCODE_BASIC_OUT_OF_RANGE +#define SbERR_DUPLICATE_DEF ERRCODE_BASIC_DUPLICATE_DEF +#define SbERR_ZERODIV ERRCODE_BASIC_ZERODIV +#define SbERR_VAR_UNDEFINED ERRCODE_BASIC_VAR_UNDEFINED +#define SbERR_CONVERSION ERRCODE_BASIC_CONVERSION +#define SbERR_BAD_PARAMETER ERRCODE_BASIC_BAD_PARAMETER +#define SbERR_USER_ABORT ERRCODE_BASIC_USER_ABORT +#define SbERR_BAD_RESUME ERRCODE_BASIC_BAD_RESUME +#define SbERR_STACK_OVERFLOW ERRCODE_BASIC_STACK_OVERFLOW +#define SbERR_PROC_UNDEFINED ERRCODE_BASIC_PROC_UNDEFINED +#define SbERR_BAD_DLL_LOAD ERRCODE_BASIC_BAD_DLL_LOAD +#define SbERR_BAD_DLL_CALL ERRCODE_BASIC_BAD_DLL_CALL +#define SbERR_INTERNAL_ERROR ERRCODE_BASIC_INTERNAL_ERROR +#define SbERR_BAD_CHANNEL ERRCODE_BASIC_BAD_CHANNEL +#define SbERR_FILE_NOT_FOUND ERRCODE_BASIC_FILE_NOT_FOUND +#define SbERR_BAD_FILE_MODE ERRCODE_BASIC_BAD_FILE_MODE +#define SbERR_FILE_ALREADY_OPEN ERRCODE_BASIC_FILE_ALREADY_OPEN +#define SbERR_IO_ERROR ERRCODE_BASIC_IO_ERROR +#define SbERR_FILE_EXISTS ERRCODE_BASIC_FILE_EXISTS +#define SbERR_BAD_RECORD_LENGTH ERRCODE_BASIC_BAD_RECORD_LENGTH +#define SbERR_DISK_FULL ERRCODE_BASIC_DISK_FULL +#define SbERR_READ_PAST_EOF ERRCODE_BASIC_READ_PAST_EOF +#define SbERR_BAD_RECORD_NUMBER ERRCODE_BASIC_BAD_RECORD_NUMBER +#define SbERR_TOO_MANY_FILES ERRCODE_BASIC_TOO_MANY_FILES +#define SbERR_NO_DEVICE ERRCODE_BASIC_NO_DEVICE +#define SbERR_ACCESS_DENIED ERRCODE_BASIC_ACCESS_DENIED +#define SbERR_NOT_READY ERRCODE_BASIC_NOT_READY +#define SbERR_NOT_IMPLEMENTED ERRCODE_BASIC_NOT_IMPLEMENTED +#define SbERR_DIFFERENT_DRIVE ERRCODE_BASIC_DIFFERENT_DRIVE +#define SbERR_ACCESS_ERROR ERRCODE_BASIC_ACCESS_ERROR +#define SbERR_PATH_NOT_FOUND ERRCODE_BASIC_PATH_NOT_FOUND +#define SbERR_NO_OBJECT ERRCODE_BASIC_NO_OBJECT +#define SbERR_BAD_PATTERN ERRCODE_BASIC_BAD_PATTERN +#define SBERR_IS_NULL ERRCODE_BASIC_IS_NULL +#define SbERR_DDE_ERROR ERRCODE_BASIC_DDE_ERROR +#define SbERR_DDE_WAITINGACK ERRCODE_BASIC_DDE_WAITINGACK +#define SbERR_DDE_OUTOFCHANNELS ERRCODE_BASIC_DDE_OUTOFCHANNELS +#define SbERR_DDE_NO_RESPONSE ERRCODE_BASIC_DDE_NO_RESPONSE +#define SbERR_DDE_MULT_RESPONSES ERRCODE_BASIC_DDE_MULT_RESPONSES +#define SbERR_DDE_CHANNEL_LOCKED ERRCODE_BASIC_DDE_CHANNEL_LOCKED +#define SbERR_DDE_NOTPROCESSED ERRCODE_BASIC_DDE_NOTPROCESSED +#define SbERR_DDE_TIMEOUT ERRCODE_BASIC_DDE_TIMEOUT +#define SbERR_DDE_USER_INTERRUPT ERRCODE_BASIC_DDE_USER_INTERRUPT +#define SbERR_DDE_BUSY ERRCODE_BASIC_DDE_BUSY +#define SbERR_DDE_NO_DATA ERRCODE_BASIC_DDE_NO_DATA +#define SbERR_DDE_WRONG_DATA_FORMAT ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT +#define SbERR_DDE_PARTNER_QUIT ERRCODE_BASIC_DDE_PARTNER_QUIT +#define SbERR_DDE_CONV_CLOSED ERRCODE_BASIC_DDE_CONV_CLOSED +#define SbERR_DDE_NO_CHANNEL ERRCODE_BASIC_DDE_NO_CHANNEL +#define SbERR_DDE_INVALID_LINK ERRCODE_BASIC_DDE_INVALID_LINK +#define SbERR_DDE_QUEUE_OVERFLOW ERRCODE_BASIC_DDE_QUEUE_OVERFLOW +#define SbERR_DDE_LINK_ALREADY_EST ERRCODE_BASIC_DDE_LINK_ALREADY_EST +#define SbERR_DDE_LINK_INV_TOPIC ERRCODE_BASIC_DDE_LINK_INV_TOPIC +#define SbERR_DDE_DLL_NOT_FOUND ERRCODE_BASIC_DDE_DLL_NOT_FOUND +#define SbERR_CANNOT_LOAD ERRCODE_BASIC_CANNOT_LOAD +#define SbERR_BAD_INDEX ERRCODE_BASIC_BAD_INDEX +#define SbERR_NO_ACTIVE_OBJECT ERRCODE_BASIC_NO_ACTIVE_OBJECT +#define SbERR_BAD_PROP_VALUE ERRCODE_BASIC_BAD_PROP_VALUE +#define SbERR_PROP_READONLY ERRCODE_BASIC_PROP_READONLY +#define SbERR_PROP_WRITEONLY ERRCODE_BASIC_PROP_WRITEONLY +#define SbERR_INVALID_OBJECT ERRCODE_BASIC_INVALID_OBJECT +#define SbERR_NO_METHOD ERRCODE_BASIC_NO_METHOD +#define SbERR_NEEDS_OBJECT ERRCODE_BASIC_NEEDS_OBJECT +#define SbERR_INVALID_USAGE_OBJECT ERRCODE_BASIC_INVALID_USAGE_OBJECT +#define SbERR_NO_OLE ERRCODE_BASIC_NO_OLE +#define SbERR_BAD_METHOD ERRCODE_BASIC_BAD_METHOD +#define SbERR_OLE_ERROR ERRCODE_BASIC_OLE_ERROR +#define SbERR_BAD_ACTION ERRCODE_BASIC_BAD_ACTION +#define SbERR_NO_NAMED_ARGS ERRCODE_BASIC_NO_NAMED_ARGS +#define SbERR_BAD_LOCALE ERRCODE_BASIC_BAD_LOCALE +#define SbERR_NAMED_NOT_FOUND ERRCODE_BASIC_NAMED_NOT_FOUND +#define SbERR_NOT_OPTIONAL ERRCODE_BASIC_NOT_OPTIONAL +#define SbERR_WRONG_ARGS ERRCODE_BASIC_WRONG_ARGS +#define SbERR_NOT_A_COLL ERRCODE_BASIC_NOT_A_COLL +#define SbERR_BAD_ORDINAL ERRCODE_BASIC_BAD_ORDINAL +#define SbERR_DLLPROC_NOT_FOUND ERRCODE_BASIC_DLLPROC_NOT_FOUND +#define SbERR_BAD_CLIPBD_FORMAT ERRCODE_BASIC_BAD_CLIPBD_FORMAT +#define SbERR_PROPERTY_NOT_FOUND ERRCODE_BASIC_PROPERTY_NOT_FOUND +#define SbERR_METHOD_NOT_FOUND ERRCODE_BASIC_METHOD_NOT_FOUND +#define SbERR_ARG_MISSING ERRCODE_BASIC_ARG_MISSING +#define SbERR_BAD_NUMBER_OF_ARGS ERRCODE_BASIC_BAD_NUMBER_OF_ARGS +#define SbERR_METHOD_FAILED ERRCODE_BASIC_METHOD_FAILED +#define SbERR_SETPROP_FAILED ERRCODE_BASIC_SETPROP_FAILED +#define SbERR_GETPROP_FAILED ERRCODE_BASIC_GETPROP_FAILED +// #define SbERR_COMPILER_BGN ERRCODE_BASIC_COMPILER_BGN +#define SbERR_UNEXPECTED ERRCODE_BASIC_UNEXPECTED +#define SbERR_EXPECTED ERRCODE_BASIC_EXPECTED +#define SbERR_SYMBOL_EXPECTED ERRCODE_BASIC_SYMBOL_EXPECTED +#define SbERR_VAR_EXPECTED ERRCODE_BASIC_VAR_EXPECTED +#define SbERR_LABEL_EXPECTED ERRCODE_BASIC_LABEL_EXPECTED +#define SbERR_LVALUE_EXPECTED ERRCODE_BASIC_LVALUE_EXPECTED +#define SbERR_VAR_DEFINED ERRCODE_BASIC_VAR_DEFINED +#define SbERR_PROC_DEFINED ERRCODE_BASIC_PROC_DEFINED +#define SbERR_LABEL_DEFINED ERRCODE_BASIC_LABEL_DEFINED +#define SbERR_UNDEF_VAR ERRCODE_BASIC_UNDEF_VAR +#define SbERR_UNDEF_ARRAY ERRCODE_BASIC_UNDEF_ARRAY +#define SbERR_UNDEF_PROC ERRCODE_BASIC_UNDEF_PROC +#define SbERR_UNDEF_LABEL ERRCODE_BASIC_UNDEF_LABEL +#define SbERR_UNDEF_TYPE ERRCODE_BASIC_UNDEF_TYPE +#define SbERR_BAD_EXIT ERRCODE_BASIC_BAD_EXIT +#define SbERR_BAD_BLOCK ERRCODE_BASIC_BAD_BLOCK +#define SbERR_BAD_BRACKETS ERRCODE_BASIC_BAD_BRACKETS +#define SbERR_BAD_DECLARATION ERRCODE_BASIC_BAD_DECLARATION +#define SbERR_BAD_PARAMETERS ERRCODE_BASIC_BAD_PARAMETERS +#define SbERR_BAD_CHAR_IN_NUMBER ERRCODE_BASIC_BAD_CHAR_IN_NUMBER +#define SbERR_MUST_HAVE_DIMS ERRCODE_BASIC_MUST_HAVE_DIMS +#define SbERR_NO_IF ERRCODE_BASIC_NO_IF +#define SbERR_NOT_IN_SUBR ERRCODE_BASIC_NOT_IN_SUBR +#define SbERR_NOT_IN_MAIN ERRCODE_BASIC_NOT_IN_MAIN +#define SbERR_WRONG_DIMS ERRCODE_BASIC_WRONG_DIMS +#define SbERR_BAD_OPTION ERRCODE_BASIC_BAD_OPTION +#define SbERR_CONSTANT_REDECLARED ERRCODE_BASIC_CONSTANT_REDECLARED +#define SbERR_PROG_TOO_LARGE ERRCODE_BASIC_PROG_TOO_LARGE +#define SbERR_NO_STRINGS_ARRAYS ERRCODE_BASIC_NO_STRINGS_ARRAYS +#define SbERR_BASIC_EXCEPTION ERRCODE_BASIC_EXCEPTION +#define SbERR_BASIC_COMPAT ERRCODE_BASIC_COMPAT +#define SbERR_BASIC_ARRAY_FIX ERRCODE_BASIC_ARRAY_FIX +#define SbERR_BASIC_STRING_OVERFLOW ERRCODE_BASIC_STRING_OVERFLOW +#define SbERR_BASIC_EXPR_TOO_COMPLEX ERRCODE_BASIC_EXPR_TOO_COMPLEX +#define SbERR_BASIC_OPER_NOT_PERFORM ERRCODE_BASIC_OPER_NOT_PERFORM +#define SbERR_BASIC_TOO_MANY_DLL ERRCODE_BASIC_TOO_MANY_DLL +#define SbERR_BASIC_LOOP_NOT_INIT ERRCODE_BASIC_LOOP_NOT_INIT +// #define SbERR_COMPILER_END ERRCODE_BASIC_COMPILER_END + +/* ALT +#define SbERR_SYNTAX 2 // unspecified syntax error +#define SbERR_NO_GOSUB 3 // Return without Gosub +#define SbERR_REDO_FROM_START 4 // Redo form start (SB internal) +#define SbERR_BAD_ARGUMENT 5 // Invalid procedure call +#define SbERR_MATH_OVERFLOW 6 // Overflow +#define SbERR_NO_MEMORY 7 // Out of memory +#define SbERR_ALREADY_DIM 8 // Array already dimensioned +#define SbERR_OUT_OF_RANGE 9 // Subscript out of range +#define SbERR_DUPLICATE_DEF 10 // Duplicate definition +#define SbERR_ZERODIV 11 // Division by zero +#define SbERR_VAR_UNDEFINED 12 // Variable undefined (SB) +#define SbERR_CONVERSION 13 // Type mismatch +#define SbERR_BAD_PARAMETER 14 // Invalid Parameter +#define SbERR_USER_ABORT 18 // User interrupt occurred +#define SbERR_BAD_RESUME 20 // Resume without error +#define SbERR_STACK_OVERFLOW 28 // Out of stack space +#define SbERR_PROC_UNDEFINED 35 // Sub or Function not defined +#define SbERR_BAD_DLL_LOAD 48 // Error in loading DLL +#define SbERR_BAD_DLL_CALL 49 // Bad DLL calling convention +#define SbERR_INTERNAL_ERROR 51 // internal error +#define SbERR_BAD_CHANNEL 52 // Bad file name or number +#define SbERR_FILE_NOT_FOUND 53 // File not found +#define SbERR_BAD_FILE_MODE 54 // Bad file mode +#define SbERR_FILE_ALREADY_OPEN 55 // File already open +#define SbERR_IO_ERROR 57 // Device I/O error +#define SbERR_FILE_EXISTS 58 // File already exists +#define SbERR_BAD_RECORD_LENGTH 59 // bad record length +#define SbERR_DISK_FULL 61 // disk full +#define SbERR_READ_PAST_EOF 62 // Input past end of file +#define SbERR_BAD_RECORD_NUMBER 63 // Bad record number +#define SbERR_TOO_MANY_FILES 67 // Too many files +#define SbERR_NO_DEVICE 68 // Device not available +#define SbERR_ACCESS_DENIED 70 // Permission denied +#define SbERR_NOT_READY 71 // Disk not ready +#define SbERR_NOT_IMPLEMENTED 73 // Feature not implemented +#define SbERR_DIFFERENT_DRIVE 74 // No rename with different drive +#define SbERR_ACCESS_ERROR 75 // Path/File access error +#define SbERR_PATH_NOT_FOUND 76 // Path not found +#define SbERR_NO_OBJECT 91 // Object variable not set +#define SbERR_BAD_PATTERN 93 // Invalid pattern string +#define SBERR_IS_NULL 94 // Invalid use of Null + +// DDE messages from 250-299 +#define SbERR_DDE_ERROR 250 +#define SbERR_DDE_WAITINGACK 280 +#define SbERR_DDE_OUTOFCHANNELS 281 +#define SbERR_DDE_NO_RESPONSE 282 +#define SbERR_DDE_MULT_RESPONSES 283 +#define SbERR_DDE_CHANNEL_LOCKED 284 +#define SbERR_DDE_NOTPROCESSED 285 +#define SbERR_DDE_TIMEOUT 286 +#define SbERR_DDE_USER_INTERRUPT 287 +#define SbERR_DDE_BUSY 288 +#define SbERR_DDE_NO_DATA 289 +#define SbERR_DDE_WRONG_DATA_FORMAT 290 +#define SbERR_DDE_PARTNER_QUIT 291 +#define SbERR_DDE_CONV_CLOSED 292 +#define SbERR_DDE_NO_CHANNEL 293 +#define SbERR_DDE_INVALID_LINK 294 +#define SbERR_DDE_QUEUE_OVERFLOW 295 +#define SbERR_DDE_LINK_ALREADY_EST 296 +#define SbERR_DDE_LINK_INV_TOPIC 297 +#define SbERR_DDE_DLL_NOT_FOUND 298 + +#define SbERR_CANNOT_LOAD 323 // Can't load module +#define SbERR_BAD_INDEX 341 // Invalid object index +#define SbERR_NO_ACTIVE_OBJECT 366 // No active view or document +#define SbERR_BAD_PROP_VALUE 380 // Bad property value +#define SbERR_PROP_READONLY 382 // Property is read only +#define SbERR_PROP_WRITEONLY 394 // Property is write only +#define SbERR_INVALID_OBJECT 420 // Invalid object reference +#define SbERR_NO_METHOD 423 // Property or method not found +#define SbERR_NEEDS_OBJECT 424 // Object required +#define SbERR_INVALID_USAGE_OBJECT 425 // Invalid usee of object +#define SbERR_NO_OLE 430 // Class does not support OLE +#define SbERR_BAD_METHOD 438 // Object doesn't support method +#define SbERR_OLE_ERROR 440 // OLE Automation error +#define SbERR_BAD_ACTION 445 // Object doesn't support this action +#define SbERR_NO_NAMED_ARGS 446 // Object doesn't support named args +#define SbERR_BAD_LOCALE 447 // Object doesn't support current locale setting +#define SbERR_NAMED_NOT_FOUND 448 // Named argument not found +#define SbERR_NOT_OPTIONAL 449 // Argument not optional +#define SbERR_WRONG_ARGS 450 // Wrong number of arguments +#define SbERR_NOT_A_COLL 451 // Object not a collection +#define SbERR_BAD_ORDINAL 452 // Invalid ordinal +#define SbERR_DLLPROC_NOT_FOUND 453 // Specified DLL function not found +#define SbERR_BAD_CLIPBD_FORMAT 460 // Invalid clipboard format + +// Debugger messages from 700-799 + +#define SbERR_PROPERTY_NOT_FOUND 1000 // Class not have property +#define SbERR_METHOD_NOT_FOUND 1001 // Class does not have method +#define SbERR_ARG_MISSING 1002 // Missing required argument +#define SbERR_BAD_NUMBER_OF_ARGS 1003 // Bad number of arguments +#define SbERR_METHOD_FAILED 1004 // Method failed +#define SbERR_SETPROP_FAILED 1005 // Unable to set property +#define SbERR_GETPROP_FAILED 1006 // Unable to get property + +// Compiler Errors (do not happen at runtime) +// These IDs can shift at any time + +#define SbERR_COMPILER_BGN 950 +#define SbERR_UNEXPECTED 951 // Unexpected symbol: xx +#define SbERR_EXPECTED 952 // Expected: xx +#define SbERR_SYMBOL_EXPECTED 953 // Symbol expected +#define SbERR_VAR_EXPECTED 954 // Variable expected +#define SbERR_LABEL_EXPECTED 955 // Label expected +#define SbERR_LVALUE_EXPECTED 956 // Lvalue expected +#define SbERR_VAR_DEFINED 957 // Variable xxx already defined +#define SbERR_PROC_DEFINED 958 // Procedure xx already defined +#define SbERR_LABEL_DEFINED 959 // Label xxx already defined +#define SbERR_UNDEF_VAR 960 // Variable xx undefined +#define SbERR_UNDEF_ARRAY 961 // Array or function xx undefined +#define SbERR_UNDEF_PROC 962 // Procedure xxx undefined +#define SbERR_UNDEF_LABEL 963 // Label xxx undefined +#define SbERR_UNDEF_TYPE 964 // Unknown user defined type xxx +#define SbERR_BAD_EXIT 965 // Exit XXX expexted +#define SbERR_BAD_BLOCK 966 // Unterminated statement block: missing XX +#define SbERR_BAD_BRACKETS 967 // Parentheses do not match +#define SbERR_BAD_DECLARATION 968 // Symbol xx defined differently +#define SbERR_BAD_PARAMETERS 969 // Parameters do not match +#define SbERR_BAD_CHAR_IN_NUMBER 970 // Bad character in number +#define SbERR_MUST_HAVE_DIMS 971 // Array needs dimensioning +#define SbERR_NO_IF 972 // Else/Endif without If +#define SbERR_NOT_IN_SUBR 973 // xxx not allowed within a sub +#define SbERR_NOT_IN_MAIN 974 // xxx not allowed outside a sub +#define SbERR_WRONG_DIMS 975 // Dimensions do not match +#define SbERR_BAD_OPTION 976 // Unknown option: xxx +#define SbERR_CONSTANT_REDECLARED 977 // Constant xx redeclared +#define SbERR_PROG_TOO_LARGE 978 // Program is too large +#define SbERR_NO_STRINGS_ARRAYS 979 +#define SbERR_COMPILER_END 299 +*/ + +// Grid messages from 30000-30999 +// 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 new file mode 100644 index 000000000000..4c8deafef29c --- /dev/null +++ b/basic/inc/basic/sbmeth.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBMETH_HXX +#define _SB_SBMETH_HXX + +#include <tools/errcode.hxx> +#include <basic/sbxmeth.hxx> +#include <basic/sbdef.hxx> + +class SbModule; +class SbMethodImpl; + +class SbMethod : public SbxMethod +{ + friend class SbiRuntime; + friend class SbiFactory; + friend class SbModule; + friend class SbClassModuleObject; + friend class SbiCodeGen; + friend class SbJScriptMethod; + friend class SbIfaceMapperMethod; + + SbMethodImpl* mpSbMethodImpl; // Impl data + SbxVariable* mCaller; // caller + SbModule* pMod; + sal_uInt16 nDebugFlags; + sal_uInt16 nLine1, nLine2; + sal_uInt32 nStart; + sal_Bool bInvalid; + SbxArrayRef refStatics; + SbMethod( const String&, SbxDataType, SbModule* ); + SbMethod( const SbMethod& ); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + virtual ~SbMethod(); + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2); + TYPEINFO(); + virtual SbxInfo* GetInfo(); + SbxArray* GetLocals(); + SbxArray* GetStatics(); + void ClearStatics(); + SbModule* GetModule() { return pMod; } + sal_uInt32 GetId() const { return nStart; } + sal_uInt16 GetDebugFlags() { return nDebugFlags; } + void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; } + void GetLineRange( sal_uInt16&, sal_uInt16& ); + + // Interface to execute a method from the applications + virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL ); + virtual void Broadcast( sal_uIntPtr nHintId ); +}; + +#ifndef __SB_SBMETHODREF_HXX +#define __SB_SBMETHODREF_HXX +SV_DECL_IMPL_REF(SbMethod) +#endif + +class SbIfaceMapperMethod : public SbMethod +{ + friend class SbiRuntime; + + SbMethodRef mxImplMeth; + +public: + TYPEINFO(); + SbIfaceMapperMethod( const String& rName, SbMethod* pImplMeth ) + : SbMethod( rName, pImplMeth->GetType(), NULL ) + , mxImplMeth( pImplMeth ) + {} + virtual ~SbIfaceMapperMethod(); + SbMethod* getImplMethod( void ) + { return mxImplMeth; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx new file mode 100644 index 000000000000..cba5714b9c36 --- /dev/null +++ b/basic/inc/basic/sbmod.hxx @@ -0,0 +1,200 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBMOD_HXX +#define _SB_SBMOD_HXX + +#include <com/sun/star/script/XInvocation.hpp> +#include <basic/sbdef.hxx> +#include <basic/sbxobj.hxx> +#include <basic/sbxdef.hxx> +#include <rtl/ustring.hxx> +#include <vector> + +#include <deque> + +class SbMethod; +class SbProperty; +class SbiRuntime; +typedef std::deque< sal_uInt16 > SbiBreakpoints; +class SbiImage; +class SbProcedureProperty; +class SbIfaceMapperMethod; +class SbClassModuleObject; + +class ModuleInitDependencyMap; +struct ClassModuleRunInitItem; +struct SbClassData; +class SbModuleImpl; + +class SbModule : public SbxObject +{ + friend class TestToolObj; // allows module initialisation at runtime + friend class SbiCodeGen; + friend class SbMethod; + friend class SbiRuntime; + friend class StarBASIC; + friend class SbClassModuleObject; + + SbModuleImpl* mpSbModuleImpl; // Impl data + std::vector< String > mModuleVariableNames; + SbModule(); + SbModule(const SbModule&); + + void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic ); + +protected: + com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper; + ::rtl::OUString aOUSource; + String aComment; + SbiImage* pImage; // the Image + SbiBreakpoints* pBreaks; // Breakpoints + SbClassData* pClassData; + sal_Bool mbVBACompat; + sal_Int32 mnType; + SbxObjectRef pDocObject; // an impl object ( used by Document Modules ) + bool bIsProxyModule; + + static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem ); + void StartDefinitions(); + SbMethod* GetMethod( const String&, SbxDataType ); + SbProperty* GetProperty( const String&, SbxDataType ); + SbProcedureProperty* GetProcedureProperty( const String&, SbxDataType ); + SbIfaceMapperMethod* GetIfaceMapperMethod( const String&, SbMethod* ); + void EndDefinitions( sal_Bool=sal_False ); + sal_uInt16 Run( SbMethod* ); + void RunInit(); + void ClearPrivateVars(); + void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic ); + void GlobalRunInit( sal_Bool bBasicStart ); // for all modules + void GlobalRunDeInit( void ); + const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const; + const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&, + sal_Bool bFollowJumps, const SbiImage* pImg=NULL ) const; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + virtual sal_Bool LoadCompleted(); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual ~SbModule(); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2); + TYPEINFO(); + SbModule( const String&, sal_Bool bCompat = sal_False ); + virtual void SetParent( SbxObject* ); + virtual void Clear(); + + virtual SbxVariable* Find( const String&, SbxClassType ); + + virtual const String& GetSource() const; + const ::rtl::OUString& GetSource32() const; + const String& GetComment() const { return aComment; } + virtual void SetSource( const String& r ); + void SetSource32( const ::rtl::OUString& r ); + void SetComment( const String& r ); + + virtual sal_Bool Compile(); + sal_Bool Disassemble( String& rText ); + virtual sal_Bool IsCompiled() const; + const SbxObject* FindType( String aTypeName ) const; + + virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const; + virtual size_t GetBPCount() const; + virtual sal_uInt16 GetBP( size_t n ) const; + virtual sal_Bool IsBP( sal_uInt16 nLine ) const; + virtual sal_Bool SetBP( sal_uInt16 nLine ); + virtual sal_Bool ClearBP( sal_uInt16 nLine ); + virtual void ClearAllBP(); + + // Lines of Subs + virtual SbMethod* GetFunctionForLine( sal_uInt16 ); + + // Store only image, no source (needed for new password protection) + sal_Bool StoreBinaryData( SvStream& ); + sal_Bool StoreBinaryData( SvStream&, sal_uInt16 nVer ); + sal_Bool LoadBinaryData( SvStream&, sal_uInt16 nVer ); + sal_Bool LoadBinaryData( SvStream& ); + sal_Bool ExceedsLegacyModuleSize(); + void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const; + bool HasExeCode(); + sal_Bool IsVBACompat() const; + void SetVBACompat( sal_Bool bCompat ); + sal_Int32 GetModuleType() { return mnType; } + void SetModuleType( sal_Int32 nType ) { mnType = nType; } + bool isProxyModule() { return bIsProxyModule; } + void AddVarName( const String& aName ); + void RemoveVars(); + ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); + bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); +}; + +#ifndef __SB_SBMODULEREF_HXX +#define __SB_SBMODULEREF_HXX + +SV_DECL_IMPL_REF(SbModule) + +#endif + +class SbClassModuleImpl; + +// Object class for instances of class modules +class SbClassModuleObject : public SbModule +{ + SbClassModuleImpl* mpSbClassModuleImpl; + + SbModule* mpClassModule; + bool mbInitializeEventDone; + +public: + TYPEINFO(); + SbClassModuleObject( SbModule* pClassModule ); + ~SbClassModuleObject(); + + // Overridden to support NameAccess etc. + virtual SbxVariable* Find( const String&, SbxClassType ); + + virtual void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); + + SbModule* getClassModule( void ) + { return mpClassModule; } + + void triggerInitializeEvent( void ); + void triggerTerminateEvent( void ); +}; + +#ifndef __SB_SBCLASSMODULEREF_HXX +#define __SB_SBCLASSMODULEREF_HXX + +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 new file mode 100644 index 000000000000..af602191cdd5 --- /dev/null +++ b/basic/inc/basic/sbobjmod.hxx @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _SB_OBJMOD_HXX +#define _SB_OBJMOD_HXX + +#include <rtl/ref.hxx> +#include <basic/sbmod.hxx> +#include <basic/sbstar.hxx> +#include <com/sun/star/script/ModuleInfo.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/frame/XModel.hpp> + +namespace css = ::com::sun::star; + +// Basic-Module for excel object. + +class SbObjModule : public SbModule +{ + SbObjModule( const SbObjModule& ); + SbObjModule(); + +protected: + virtual ~SbObjModule(); + +public: + TYPEINFO(); + SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible ); + virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); + + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + + using SbxValue::GetObject; + SbxVariable* GetObject(); + void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ; +}; + +class FormObjEventListenerImpl; + +class SbUserFormModule : public SbObjModule +{ + com::sun::star::script::ModuleInfo m_mInfo; + ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener; + css::uno::Reference<css::awt::XDialog> m_xDialog; + css::uno::Reference<css::frame::XModel> m_xModel; + String sFormName; + bool mbInit; + SbUserFormModule( const SbUserFormModule& ); + SbUserFormModule(); + +//protected: + virtual void InitObject(); +public: + TYPEINFO(); + SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); + virtual ~SbUserFormModule(); + virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); + void ResetApiObj( bool bTriggerTerminateEvent = true ); + void Unload(); + void Load(); + void triggerMethod( const String& ); + void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& ); + void triggerActivateEvent(); + void triggerDeactivateEvent(); + void triggerInitializeEvent(); + void triggerTerminateEvent(); + void triggerLayoutEvent(); + void triggerResizeEvent(); + + bool getInitState( void ) + { return mbInit; } + void setInitState( bool bInit ) + { mbInit = bInit; } + + class SbUserFormModuleInstance* CreateInstance(); +}; + +class SbUserFormModuleInstance : public SbUserFormModule +{ + SbUserFormModule* m_pParentModule; + +public: + SbUserFormModuleInstance( SbUserFormModule* pParentModule, const String& rName, + const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); + + virtual sal_Bool IsClass( const String& ) const; + virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); +}; + + +#ifndef __SB_SBOBJMODULEREF_HXX +#define __SB_SBOBJMODULEREF_HXX + +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 new file mode 100644 index 000000000000..730ee6fa0aa7 --- /dev/null +++ b/basic/inc/basic/sbprop.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBPROPERTY_HXX +#define _SB_SBPROPERTY_HXX + +#include <basic/sbxprop.hxx> +#include <basic/sbdef.hxx> + +class SbModule; + +class SbProperty : public SbxProperty +{ + friend class SbiFactory; + friend class SbModule; + friend class SbProcedureProperty; + SbModule* pMod; + sal_Bool bInvalid; + SbProperty( const String&, SbxDataType, SbModule* ); + virtual ~SbProperty(); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICPROP,1); + TYPEINFO(); + SbModule* GetModule() { return pMod; } +}; + +#ifndef __SB_SBPROPERTYREF_HXX +#define __SB_SBPROPERTYREF_HXX +SV_DECL_IMPL_REF(SbProperty) +#endif + +class SbProcedureProperty : public SbxProperty +{ + bool mbSet; // Flag for set command + + virtual ~SbProcedureProperty(); + +public: + SbProcedureProperty( const String& r, SbxDataType t ) + : SbxProperty( r, t ) // , pMod( p ) + , mbSet( false ) + {} + TYPEINFO(); + + bool isSet( void ) + { return mbSet; } + void setSet( bool bSet ) + { mbSet = bSet; } +}; + +#ifndef __SB_SBPROCEDUREPROPERTYREF_HXX +#define __SB_SBPROCEDUREPROPERTYREF_HXX +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 new file mode 100644 index 000000000000..73d80a4345b7 --- /dev/null +++ b/basic/inc/basic/sbstar.hxx @@ -0,0 +1,227 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBSTAR_HXX +#define _SB_SBSTAR_HXX + +#include <basic/sbx.hxx> +#include <basic/sbxobj.hxx> +#include <rtl/ustring.hxx> +#include <osl/mutex.hxx> + +#include <basic/sbdef.hxx> +#include <basic/sberrors.hxx> +#include <com/sun/star/script/ModuleInfo.hpp> +#include <com/sun/star/frame/XModel.hpp> + +class SbModule; // completed module +class SbiInstance; // runtime instance +class SbiRuntime; // currently running procedure +class SbiImage; // compiled image +class BasicLibInfo; // info block for basic manager +class SbTextPortions; +class SbMethod; +class BasicManager; +class DocBasicItem; + +class StarBASICImpl; + +class StarBASIC : public SbxObject +{ + friend class SbiScanner; + friend class SbiExpression; // Access to RTL + friend class SbiInstance; + friend class SbiRuntime; + friend class DocBasicItem; + + StarBASICImpl* mpStarBASICImpl; + + SbxArrayRef pModules; // List of all modules + SbxObjectRef pRtl; // Runtime Library + SbxArrayRef xUnoListeners; // Listener handled by CreateUnoListener + + // Handler-Support: + Link aErrorHdl; // Error handler + Link aBreakHdl; // Breakpoint handler + sal_Bool bNoRtl; // if sal_True: do not search RTL + sal_Bool bBreak; // if sal_True: Break, otherwise Step + sal_Bool bDocBasic; + sal_Bool bVBAEnabled; + BasicLibInfo* pLibInfo; // Info block for basic manager + SbLanguageMode eLanguageMode; // LanguageMode of the basic object + sal_Bool bQuit; + + SbxObjectRef pVBAGlobals; + SbxObject* getVBAGlobals( ); + + void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic ); + +protected: + sal_Bool CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); +private: + sal_Bool RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen ); + sal_Bool RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen ); + sal_uInt16 BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + sal_uInt16 StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + +protected: + + virtual sal_Bool ErrorHdl(); + virtual sal_uInt16 BreakHdl(); + virtual ~StarBASIC(); + +public: + + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1); + TYPEINFO(); + + StarBASIC( StarBASIC* pParent = NULL, sal_Bool bIsDocBasic = sal_False ); + + // #51727 SetModified overridden so that the Modfied-State is + // not delivered to Parent. + virtual void SetModified( sal_Bool ); + + void* operator new( size_t ); + void operator delete( void* ); + + virtual void Insert( SbxVariable* ); + using SbxObject::Remove; + virtual void Remove( SbxVariable* ); + virtual void Clear(); + + BasicLibInfo* GetLibInfo() { return pLibInfo; } + void SetLibInfo( BasicLibInfo* p ) { pLibInfo = p; } + + // Compiler-Interface + SbModule* MakeModule( const String& rName, const String& rSrc ); + SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc ); + SbModule* MakeModule32( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc ); + sal_Bool Compile( SbModule* ); + sal_Bool Disassemble( SbModule*, String& rText ); + static void Stop(); + static void Error( SbError ); + static void Error( SbError, const String& rMsg ); + static void FatalError( SbError ); + static void FatalError( SbError, const String& rMsg ); + static sal_Bool IsRunning(); + static SbError GetErrBasic(); + // #66536 make additional message accessible by RTL function Error + static String GetErrorMsg(); + static xub_StrLen GetErl(); + // Highlighting + void Highlight( const String& rSrc, SbTextPortions& rList ); + + virtual SbxVariable* Find( const String&, SbxClassType ); + virtual sal_Bool Call( const String&, SbxArray* = NULL ); + + SbxArray* GetModules() { return pModules; } + SbxObject* GetRtl() { return pRtl; } + SbModule* FindModule( const String& ); + // Run init code of all modules (including the inserted Doc-Basics) + void InitAllModules( StarBASIC* pBasicNotToInit = NULL ); + void DeInitAllModules( void ); + void ClearAllModuleVars( void ); + void ActivateObject( const String*, sal_Bool ); + sal_Bool LoadOldModules( SvStream& ); + + // #43011 For TestTool; deletes global vars + void ClearGlobalVars( void ); + + // Calls for error and break handler + static sal_uInt16 GetLine(); + static sal_uInt16 GetCol1(); + static sal_uInt16 GetCol2(); + static void SetErrorData( SbError nCode, sal_uInt16 nLine, + sal_uInt16 nCol1, sal_uInt16 nCol2 ); + + // Specific to error handler + static void MakeErrorText( SbError, const String& aMsg ); + static const String& GetErrorText(); + static SbError GetErrorCode(); + static sal_Bool IsCompilerError(); + static sal_uInt16 GetVBErrorCode( SbError nError ); + static SbError GetSfxFromVBError( sal_uInt16 nError ); + static void SetGlobalLanguageMode( SbLanguageMode eLangMode ); + static SbLanguageMode GetGlobalLanguageMode(); + // Local settings + void SetLanguageMode( SbLanguageMode eLangMode ) + { eLanguageMode = eLangMode; } + SbLanguageMode GetLanguageMode(); + + // Specific for break handler + sal_Bool IsBreak() const { return bBreak; } + + static Link GetGlobalErrorHdl(); + static void SetGlobalErrorHdl( const Link& rNewHdl ); + Link GetErrorHdl() const { return aErrorHdl; } + void SetErrorHdl( const Link& r ) { aErrorHdl = r; } + + static Link GetGlobalBreakHdl(); + static void SetGlobalBreakHdl( const Link& rNewHdl ); + Link GetBreakHdl() const { return aBreakHdl; } + void SetBreakHdl( const Link& r ) { aBreakHdl = r; } + + SbxArrayRef getUnoListeners( void ); + + static SbxBase* FindSBXInCurrentScope( const String& rName ); + static SbxVariable* FindVarInCurrentScopy + ( const String& rName, sal_uInt16& rStatus ); + static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 ); + static SbModule* GetActiveModule(); + void SetVBAEnabled( sal_Bool bEnabled ); + sal_Bool isVBAEnabled(); + + // #60175 sal_True: SFX-Resource is not displayed on basic errors + static void StaticSuppressSfxResource( sal_Bool bSuppress ); + + // #91147 sal_True: Reschedule is enabled (default>, sal_False: No reschedule + static void StaticEnableReschedule( sal_Bool bReschedule ); + + SbxObjectRef getRTL( void ) { return pRtl; } + sal_Bool IsDocBasic() { return bDocBasic; } + SbxVariable* VBAFind( const String& rName, SbxClassType t ); + bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut ); + void QuitAndExitApplication(); + sal_Bool IsQuitApplication() { return bQuit; }; + + static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModelFromBasic( SbxObject* pBasic ); +}; + +#ifndef __SB_SBSTARBASICREF_HXX +#define __SB_SBSTARBASICREF_HXX + +SV_DECL_IMPL_REF(StarBASIC) + +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbstdobj.hxx b/basic/inc/basic/sbstdobj.hxx new file mode 100644 index 000000000000..8120e6d25631 --- /dev/null +++ b/basic/inc/basic/sbstdobj.hxx @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBSTDOBJ1_HXX +#define _SBSTDOBJ1_HXX + +#include <basic/sbxobj.hxx> +#include <vcl/graph.hxx> +#include <basic/sbxfac.hxx> +class StarBASIC; +class SbStdFactory; + +//-------------------- +// class SbStdFactory +//-------------------- +class SbStdFactory : public SbxFactory +{ +public: + SbStdFactory(); + + virtual SbxObject* CreateObject( const String& rClassName ); +}; + +//-------------------- +// class SbStdPicture +//-------------------- +class SbStdPicture : public SbxObject +{ +protected: + Graphic aGraphic; + + ~SbStdPicture(); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + + void PropType( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropWidth( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropHeight( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + +public: + TYPEINFO(); + + SbStdPicture(); + virtual SbxVariable* Find( const String&, SbxClassType ); + + Graphic GetGraphic() const { return aGraphic; } + void SetGraphic( const Graphic& rGrf ) { aGraphic = rGrf; } +}; + +//----------------- +// class SbStdFont +//----------------- +class SbStdFont : public SbxObject +{ +protected: + sal_Bool bBold; + sal_Bool bItalic; + sal_Bool bStrikeThrough; + sal_Bool bUnderline; + sal_uInt16 nSize; + String aName; + + ~SbStdFont(); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + + void PropBold( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropItalic( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropStrikeThrough( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropUnderline( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropSize( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + void PropName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); + +public: + TYPEINFO(); + + SbStdFont(); + virtual SbxVariable* Find( const String&, SbxClassType ); + + void SetBold( sal_Bool bB ) { bBold = bB; } + sal_Bool IsBold() const { return bBold; } + void SetItalic( sal_Bool bI ) { bItalic = bI; } + sal_Bool IsItalic() const { return bItalic; } + void SetStrikeThrough( sal_Bool bS ) { bStrikeThrough = bS; } + sal_Bool IsStrikeThrough() const { return bStrikeThrough; } + void SetUnderline( sal_Bool bU ) { bUnderline = bU; } + sal_Bool IsUnderline() const { return bUnderline; } + void SetSize( sal_uInt16 nS ) { nSize = nS; } + sal_uInt16 GetSize() const { return nSize; } + void SetFontName( const String& rName ) { aName = rName; } + String GetFontName() const { return aName; } +}; + +//---------------------- +// class SbStdClipboard +//---------------------- +class SbStdClipboard : public SbxObject +{ +protected: + + ~SbStdClipboard(); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + + void MethClear( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + void MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite ); + +public: + TYPEINFO(); + + SbStdClipboard(); + virtual SbxVariable* Find( const String&, SbxClassType ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbuno.hxx b/basic/inc/basic/sbuno.hxx new file mode 100644 index 000000000000..0539246e071b --- /dev/null +++ b/basic/inc/basic/sbuno.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SB_SBUNO_HXX +#define _SB_SBUNO_HXX + +#include <basic/sbxobj.hxx> + +namespace com { namespace sun { namespace star { namespace uno { class Any; }}}} + +// Returns a SbxObject that wrapps an Uno Interface +// Implementation in basic/source/classes/sbunoobj.cxx +SbxObjectRef GetSbUnoObject( const String& aName, const com::sun::star::uno::Any& aUnoObj_ ); + +// Force creation of all properties for debugging +void createAllObjectProperties( SbxObject* pObj ); +void SetSbUnoObjectDfltPropName( SbxObject* pObj ); + +::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); + +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 new file mode 100644 index 000000000000..ea8cc1e4f24e --- /dev/null +++ b/basic/inc/basic/sbx.hxx @@ -0,0 +1,361 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBXCLASS_HXX +#define _SBXCLASS_HXX + +#include "tools/ref.hxx" +#include "svl/svarray.hxx" +#include "svl/smplhint.hxx" +#include "svl/lstner.hxx" + +#include <basic/sbxdef.hxx> +#include <basic/sbxform.hxx> +#include <basic/sbxobj.hxx> +#include <basic/sbxprop.hxx> +#include <basic/sbxmeth.hxx> + +class String; +class UniString; +class SvStream; +class SbxBase; +class SbxVariable; +class SbxProperty; +class SbxMethod; +class SbxObject; +class SbxArray; +class SbxDimArray; +class SbxFactory; + +class SfxBroadcaster; +class SvDispatch; + + + +#ifndef __SBX_SBXPARAMINFO +#define __SBX_SBXPARAMINFO + +// Parameter information +struct SbxParamInfo +{ + const String aName; // Name of the parameter + SbxBaseRef aTypeRef; // Object, if object type + SbxDataType eType; // Data type + sal_uInt16 nFlags; // Flag-Bits + sal_uInt32 nUserData; // IDs etc. + SbxParamInfo( const String& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL ) + : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {} + ~SbxParamInfo() {} +}; + +SV_DECL_PTRARR_DEL(SbxParams,SbxParamInfo*,4,4) + +#endif + +#ifndef __SBX_SBXINFO +#define __SBX_SBXINFO + +class SbxInfo : public SvRefBase +{ + friend class SbxVariable; + friend class SbMethod; + + String aComment; + String aHelpFile; + sal_uInt32 nHelpId; + SbxParams aParams; + +protected: + sal_Bool LoadData( SvStream&, sal_uInt16 ); + sal_Bool StoreData( SvStream& ) const; + virtual ~SbxInfo(); +public: + SbxInfo(); + SbxInfo( const String&, sal_uInt32 ); + + void AddParam( const String&, SbxDataType, sal_uInt16=SBX_READ ); + void AddParam( const SbxParamInfo& ); + const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1! + const String& GetComment() const { return aComment; } + const String& GetHelpFile() const { return aHelpFile; } + sal_uInt32 GetHelpId() const { return nHelpId; } + + void SetComment( const String& r ) { aComment = r; } + void SetHelpFile( const String& r ) { aHelpFile = r; } + void SetHelpId( sal_uInt32 nId ) { nHelpId = nId; } +}; + +#endif + +#ifndef __SBX_SBXHINT_HXX +#define __SBX_SBXHINT_HXX + +class SbxHint : public SfxSimpleHint +{ + SbxVariable* pVar; +public: + TYPEINFO(); + SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {} + SbxVariable* GetVar() const { return pVar; } +}; + +#endif + +#ifndef __SBX_SBXALIAS_HXX +#define __SBX_SBXALIAS_HXX + +// SbxAlias is an alias for a var or object +class SbxAlias : public SbxVariable, public SfxListener +{ + SbxVariableRef xAlias; + virtual ~SbxAlias(); + virtual void Broadcast( sal_uIntPtr ); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SbxAlias( const String& rName, SbxVariable* pOriginal ); + SbxAlias( const SbxAlias& ); + SbxAlias& operator=( const SbxAlias& ); +}; + +#endif + +#ifndef __SBX_SBXARRAY +#define __SBX_SBXARRAY + +// SbxArray is an unidimensional, dynamic Array +// The variables convert from SbxVariablen. Put()/Insert() into the +// declared datatype, if they are not SbxVARIANT. + +class SbxVarRefs; +class SbxVariableRef; + +class SbxArrayImpl; + +class SbxArray : public SbxBase +{ +// #100883 Method to set method directly to parameter array + friend class SbMethod; + friend class SbClassModuleObject; + friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ); + void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx ); + + SbxArrayImpl* mpSbxArrayImpl; // Impl data + SbxVarRefs* pData; // The variables + +protected: + SbxDataType eType; // Data type of the array + virtual ~SbxArray(); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1); + TYPEINFO(); + SbxArray( SbxDataType=SbxVARIANT ); + SbxArray( const SbxArray& ); + SbxArray& operator=( const SbxArray& ); + virtual void Clear(); + sal_uInt16 Count() const; + virtual SbxDataType GetType() const; + virtual SbxClassType GetClass() const; + SbxVariableRef& GetRef( sal_uInt16 ); + SbxVariable* Get( sal_uInt16 ); + void Put( SbxVariable*, sal_uInt16 ); + void Insert( SbxVariable*, sal_uInt16 ); + void Remove( sal_uInt16 ); + void Remove( SbxVariable* ); + void Merge( SbxArray* ); + const String& GetAlias( sal_uInt16 ); + void PutAlias( const String&, sal_uInt16 ); + SbxVariable* FindUserData( sal_uInt32 nUserData ); + virtual SbxVariable* Find( const String&, SbxClassType ); + + // Additional methods for 32-bit indices + sal_uInt32 Count32() const; + SbxVariableRef& GetRef32( sal_uInt32 ); + SbxVariable* Get32( sal_uInt32 ); + void Put32( SbxVariable*, sal_uInt32 ); + void Insert32( SbxVariable*, sal_uInt32 ); + void Remove32( sal_uInt32 ); +}; + +#endif + +#ifndef __SBX_SBXDIMARRAY_HXX +#define __SBX_SBXDIMARRAY_HXX + +// SbxDimArray is an array that can dimensioned using BASIC conventions. +struct SbxDim; + +class SbxDimArrayImpl; + +class SbxDimArray : public SbxArray +{ + SbxDimArrayImpl* mpSbxDimArrayImpl; // Impl data + + SbxDim* pFirst, *pLast; // Links to Dimension table + short nDim; // Number of dimensions + void AddDimImpl32( sal_Int32, sal_Int32, sal_Bool bAllowSize0 ); + bool mbHasFixedSize; +protected: + sal_uInt16 Offset( const short* ); + sal_uInt32 Offset32( const sal_Int32* ); + sal_uInt16 Offset( SbxArray* ); + sal_uInt32 Offset32( SbxArray* ); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + virtual ~SbxDimArray(); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1); + TYPEINFO(); + SbxDimArray( SbxDataType=SbxVARIANT ); + SbxDimArray( const SbxDimArray& ); + SbxDimArray& operator=( const SbxDimArray& ); + virtual void Clear(); + using SbxArray::GetRef; + SbxVariableRef& GetRef( const short* ); + using SbxArray::Get; + SbxVariable* Get( const short* ); + using SbxArray::Put; + void Put( SbxVariable*, const short* ); + SbxVariableRef& GetRef( SbxArray* ); + SbxVariable* Get( SbxArray* ); + void Put( SbxVariable*, SbxArray* ); + + short GetDims() const { return nDim; } + void AddDim( short, short ); + void unoAddDim( short, short ); + sal_Bool GetDim( short, short&, short& ) const; + + using SbxArray::GetRef32; + SbxVariableRef& GetRef32( const sal_Int32* ); + using SbxArray::Get32; + SbxVariable* Get32( const sal_Int32* ); + using SbxArray::Put32; + void Put32( SbxVariable*, const sal_Int32* ); + void AddDim32( sal_Int32, sal_Int32 ); + void unoAddDim32( sal_Int32, sal_Int32 ); + sal_Bool GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const; + bool hasFixedSize() { return mbHasFixedSize; }; + void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; }; +}; + +#endif + +#ifndef __SBX_SBXCOLLECTION_HXX +#define __SBX_SBXCOLLECTION_HXX + +class SbxCollection : public SbxObject +{ + void Initialize(); +protected: + virtual ~SbxCollection(); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + // Overridable methods (why not pure virtual?): + virtual void CollAdd( SbxArray* pPar ); + virtual void CollItem( SbxArray* pPar ); + virtual void CollRemove( SbxArray* pPar ); + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1); + TYPEINFO(); + SbxCollection( const String& rClassname ); + SbxCollection( const SbxCollection& ); + SbxCollection& operator=( const SbxCollection& ); + virtual SbxVariable* FindUserData( sal_uInt32 nUserData ); + virtual SbxVariable* Find( const String&, SbxClassType ); + virtual void Clear(); +}; + +#endif + +#ifndef __SBX_SBXSTDCOLLECTION_HXX +#define __SBX_SBXSTDCOLLECTION_HXX + +class SbxStdCollection : public SbxCollection +{ +protected: + String aElemClass; + sal_Bool bAddRemoveOk; + virtual ~SbxStdCollection(); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + virtual void CollAdd( SbxArray* pPar ); + virtual void CollRemove( SbxArray* pPar ); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1); + TYPEINFO(); + SbxStdCollection + ( const String& rClassname, const String& rElemClass, sal_Bool=sal_True ); + SbxStdCollection( const SbxStdCollection& ); + SbxStdCollection& operator=( const SbxStdCollection& ); + virtual void Insert( SbxVariable* ); + const String& GetElementClass() const { return aElemClass; } +}; + +#endif + +#ifndef __SBX_SBXREFS_HXX +#define __SBX_SBXREFS_HXX + +SV_IMPL_REF(SbxBase) + +SV_IMPL_REF(SbxVariable) + +#ifndef SBX_ARRAY_DECL_DEFINED +#define SBX_ARRAY_DECL_DEFINED +SV_DECL_REF(SbxArray) +#endif +#ifndef SBX_ARRAY_IMPL_DEFINED +#define SBX_ARRAY_IMPL_DEFINED +SV_IMPL_REF(SbxArray) +#endif + +#ifndef SBX_INFO_DECL_DEFINED +#define SBX_INFO_DECL_DEFINED +SV_DECL_REF(SbxInfo) +#endif +#ifndef SBX_INFO_IMPL_DEFINED +#define SBX_INFO_IMPL_DEFINED +SV_IMPL_REF(SbxInfo) +#endif + +#ifndef SBX_DIMARRAY_DECL_DEFINED +#define SBX_DIMARRAY_DECL_DEFINED +SV_DECL_REF(SbxDimArray) +#endif +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 new file mode 100644 index 000000000000..057b4e0a261b --- /dev/null +++ b/basic/inc/basic/sbxbase.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBXBASE_HXX +#define _SBXBASE_HXX + +#include <i18npool/lang.h> +#include "svl/svarray.hxx" +#include <basic/sbxdef.hxx> + +class SbxFactory; +class SbxVariable; +class SbxBasicFormater; + +SV_DECL_PTRARR_DEL(SbxFacs,SbxFactory*,5,5) + +// AppData-Struktur for SBX: +struct SbxAppData +{ + SbxError eSbxError; // Error code + SbxFacs aFacs; // Factories + SbxBasicFormater *pBasicFormater; // Pointer to Format()-Command helper class + + LanguageType eBasicFormaterLangType; + // It might be useful to store this class 'global' because some string reosurces are saved here + + SbxAppData() : eSbxError( SbxERR_OK ), aFacs(), pBasicFormater( NULL ) {} + ~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 new file mode 100644 index 000000000000..f16bcde9449d --- /dev/null +++ b/basic/inc/basic/sbxcore.hxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBXCORE_HXX +#define _SBXCORE_HXX + +#include <tools/rtti.hxx> +#include <tools/ref.hxx> +#include <tools/debug.hxx> + +#include <basic/sbxdef.hxx> + +class SvStream; +class String; +class UniString; + +// The following Macro defines four (five) necessary methods within a +// SBX object. LoadPrivateData() and StorePrivateData() must be implemented. +// They are necessary for loading/storing the data of derived classes. +// Load() and Store() must not be overridden. + +// This version of the Macros does not define Load/StorePrivateData()-methods +#define SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer ) \ + virtual sal_uInt32 GetCreator() const { return nCre; } \ + virtual sal_uInt16 GetVersion() const { return nVer; } \ + virtual sal_uInt16 GetSbxId() const { return nSbxId; } + +#define SBX_DECL_PERSIST_NODATA_() \ + virtual sal_uInt32 GetCreator() const; \ + virtual sal_uInt16 GetVersion() const; \ + virtual sal_uInt16 GetSbxId() const; + +// This version of the macro defines Load/StorePrivateData()-methods +#define SBX_DECL_PERSIST( nCre, nSbxId, nVer ) \ + virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 ); \ + virtual sal_Bool StorePrivateData( SvStream& ) const; \ + SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer ) + +#define SBX_DECL_PERSIST_() \ + virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 ); \ + virtual sal_Bool StorePrivateData( SvStream& ) const; \ + SBX_DECL_PERSIST_NODATA_() + +#define SBX_IMPL_PERSIST( C, nCre, nSbxId, nVer ) \ + sal_uInt32 C::GetCreator() const { return nCre; } \ + sal_uInt16 C::GetVersion() const { return nVer; } \ + sal_uInt16 C::GetSbxId() const { return nSbxId; } + +class SbxBase; +class SbxFactory; +class SbxObject; + +DBG_NAMEEX(SbxBase) + +class SbxBaseImpl; + +class SbxBase : virtual public SvRefBase +{ + SbxBaseImpl* mpSbxBaseImpl; // Impl data + + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; +protected: + sal_uInt16 nFlags; // Flag-Bits + + SbxBase(); + SbxBase( const SbxBase& ); + SbxBase& operator=( const SbxBase& ); + virtual ~SbxBase(); + SBX_DECL_PERSIST(0,0,0); +public: + TYPEINFO(); + inline void SetFlags( sal_uInt16 n ); + inline sal_uInt16 GetFlags() const; + inline void SetFlag( sal_uInt16 n ); + inline void ResetFlag( sal_uInt16 n ); + inline sal_Bool IsSet( sal_uInt16 n ) const; + inline sal_Bool IsReset( sal_uInt16 n ) const; + inline sal_Bool CanRead() const; + inline sal_Bool CanWrite() const; + inline sal_Bool IsModified() const; + inline sal_Bool IsConst() const; + inline sal_Bool IsHidden() const; + inline sal_Bool IsVisible() const; + + virtual sal_Bool IsFixed() const; + virtual void SetModified( sal_Bool ); + + virtual SbxDataType GetType() const; + virtual SbxClassType GetClass() const; + + virtual void Clear(); + + static SbxBase* Load( SvStream& ); + static void Skip( SvStream& ); + sal_Bool Store( SvStream& ); + virtual sal_Bool LoadCompleted(); + virtual sal_Bool StoreCompleted(); + + static SbxError GetError(); + static void SetError( SbxError ); + static sal_Bool IsError(); + static void ResetError(); + + // Set the factory for Load/Store/Create + static void AddFactory( SbxFactory* ); + static void RemoveFactory( SbxFactory* ); + + static SbxBase* Create( sal_uInt16, sal_uInt32=SBXCR_SBX ); + static SbxObject* CreateObject( const String& ); + // Sbx solution as replacement for SfxBroadcaster::Enable() + static void StaticEnableBroadcasting( sal_Bool bEnable ); + static sal_Bool StaticIsEnabledBroadcasting( void ); +}; + +#ifndef SBX_BASE_DECL_DEFINED +#define SBX_BASE_DECL_DEFINED +SV_DECL_REF(SbxBase) +#endif + +inline void SbxBase::SetFlags( sal_uInt16 n ) +{ DBG_CHKTHIS( SbxBase, 0 ); nFlags = n; } + +inline sal_uInt16 SbxBase::GetFlags() const +{ DBG_CHKTHIS( SbxBase, 0 ); return nFlags; } + +inline void SbxBase::SetFlag( sal_uInt16 n ) +{ DBG_CHKTHIS( SbxBase, 0 ); nFlags |= n; } + +inline void SbxBase::ResetFlag( sal_uInt16 n ) +{ DBG_CHKTHIS( SbxBase, 0 ); nFlags &= ~n; } + +inline sal_Bool SbxBase::IsSet( sal_uInt16 n ) const +{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) != 0 ); } + +inline sal_Bool SbxBase::IsReset( sal_uInt16 n ) const +{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) == 0 ); } + +inline sal_Bool SbxBase::CanRead() const +{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_READ ); } + +inline sal_Bool SbxBase::CanWrite() const +{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_WRITE ); } + +inline sal_Bool SbxBase::IsModified() const +{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_MODIFIED ); } + +inline sal_Bool SbxBase::IsConst() const +{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_CONST ); } + +inline sal_Bool SbxBase::IsHidden() const +{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_HIDDEN ); } + +inline sal_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 new file mode 100644 index 000000000000..cc05e3dc1ff3 --- /dev/null +++ b/basic/inc/basic/sbxdef.hxx @@ -0,0 +1,336 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _SBXDEF_HXX +#define _SBXDEF_HXX + + +#ifndef __RSC +#include <tools/solar.h> +#include "tools/errcode.hxx" + +#ifndef _SBX_CLASS_TYPE +#define _SBX_CLASS_TYPE + +enum SbxClassType { // SBX-class-IDs (order is important!) + SbxCLASS_DONTCARE = 1, // don't care (search, not 0 due to StarBASIC) + SbxCLASS_ARRAY, // Array of SbxVariables + SbxCLASS_VALUE, // simple value + SbxCLASS_VARIABLE, // Variable (from here there is Broadcaster) + SbxCLASS_METHOD, // Method (Function or Sub) + SbxCLASS_PROPERTY, // Property + SbxCLASS_OBJECT // Object +}; + +#endif + +#ifndef _SBX_DATA_TYPE +#define _SBX_DATA_TYPE + +enum SbxDataType { + SbxEMPTY = 0, // * Uninitialized + SbxNULL = 1, // * Contains no valid data + SbxINTEGER = 2, // * Integer (sal_Int16) + SbxLONG = 3, // * Long integer (sal_Int32) + SbxSINGLE = 4, // * Single-precision floating point number (float) + SbxDOUBLE = 5, // * Double-precision floating point number (double) + SbxCURRENCY = 6, // Currency (sal_Int64) + SbxDATE = 7, // * Date (double) + SbxSTRING = 8, // * String (StarView) + SbxOBJECT = 9, // * SbxBase object pointer + SbxERROR = 10, // * Error (sal_uInt16) + SbxBOOL = 11, // * Boolean (0 or -1) + + SbxVARIANT = 12, // * Display for variant datatype + SbxDATAOBJECT = 13, // * Common data object w/o ref count + + SbxCHAR = 16, // * signed char + SbxBYTE = 17, // * unsigned char + SbxUSHORT = 18, // * unsigned short (sal_uInt16) + SbxULONG = 19, // * unsigned long (sal_uInt32) + +//deprecated: // old 64bit types kept for backward compatibility in file I/O + SbxLONG64 = 20, // moved to SbxSALINT64 as 64bit int + SbxULONG64 = 21, // moved to SbxSALUINT64 as 64bit int + + SbxINT = 22, // * signed machine-dependent int + SbxUINT = 23, // * unsigned machine-dependent int + + SbxVOID = 24, // * no value (= SbxEMPTY) + SbxHRESULT = 25, // HRESULT + SbxPOINTER = 26, // generic pointer + SbxDIMARRAY = 27, // dimensioned array + SbxCARRAY = 28, // C style array + SbxUSERDEF = 29, // user defined + SbxLPSTR = 30, // * null terminated string + + SbxLPWSTR = 31, // wide null terminated string + SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting< + + SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919) + SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919) + SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper + SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper + SbxDECIMAL = 37, // for UNO/automation Decimal + + SbxVECTOR = 0x1000, // simple counted array + SbxARRAY = 0x2000, // array + SbxBYREF = 0x4000, // access by reference + + SbxSV1 = 128, // first defined data type for StarView + SbxMEMORYSTREAM, // SvMemoryStream + SbxSTORAGE, // SvStorage + + SbxUSER1 = 256, // first user defined data type + SbxUSERn = 2047 // last user defined data type +}; + +const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; +const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000; +const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible +#endif + +#ifndef _SBX_OPERATOR +#define _SBX_OPERATOR + +enum SbxOperator { + // Arithmetical: + SbxEXP, // this ^ var + SbxMUL, // this * var + SbxDIV, // this / var + SbxMOD, // this MOD var (max INT32!) + SbxPLUS, // this + var + SbxMINUS, // this - var + SbxNEG, // -this (var is ignored) + SbxIDIV, // this / var (both operands max. sal_Int32!) + // Boolean operators (max sal_Int32!): + // Boolean operators (TODO deprecate this limit: max INT32!) + SbxAND, // this & var + SbxOR, // this | var + SbxXOR, // this ^ var + SbxEQV, // ~this ^ var + SbxIMP, // ~this | var + SbxNOT, // ~this (var is ignored) + + // String concatenation: + SbxCAT, // this & var (VBA: this + var) + + // Comparisons: + SbxEQ, // this = var + SbxNE, // this <> var + SbxLT, // this < var + SbxGT, // this > var + SbxLE, // this <= var + SbxGE // this >= var +}; + +#endif + +#ifndef _SBX_NAME_TYPE +#define _SBX_NAME_TYPE + +enum SbxNameType { // Type of the questioned name of a variable + SbxNAME_NONE, // plain name + SbxNAME_SHORT, // Name(A,B) + SbxNAME_SHORT_TYPES, // Name%(A%,B$) + SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer +}; + +#endif + +// from 1996/3/20: New error messages +typedef sal_uIntPtr SbxError; // Preserve old type + +#endif + + +// New error codes per define +#define ERRCODE_SBX_OK ERRCODE_NONE // processed + +#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER) +#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) +#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow +#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index +#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero +#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type +#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter +#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def +#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error +#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object +#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail +#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index +#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active +#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value +#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only +#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only +#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference +#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt +#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage +#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object +#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported +#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error +#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported +#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments +#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported +#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument +#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional +#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments +#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements +#define LAST_SBX_ERROR_ID 29UL + +#ifndef __RSC + +// Map old codes to new ones +#define SbxERR_OK ERRCODE_SBX_OK +#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX +#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP +#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW +#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS +#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV +#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION +#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER +#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED +#define SbxERR_ERROR ERRCODE_SBX_ERROR +#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT +#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD +#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX +#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT +#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE +#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY +#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY +#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT +#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD +#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT +#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE +#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD +#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR +#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION +#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS +#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE +#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND +#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL +#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS +#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL + + +// Flag-Bits: +#define SBX_READ 0x0001 // Read permission +#define SBX_WRITE 0x0002 // Write permission +#define SBX_READWRITE 0x0003 // Read/Write permission +#define SBX_DONTSTORE 0x0004 // Don't store object +#define SBX_MODIFIED 0x0008 // Object was changed +#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable) +#define SBX_CONST 0x0020 // Definition of const value +#define SBX_OPTIONAL 0x0040 // Parameter is optional +#define SBX_HIDDEN 0x0080 // Element is invisible +#define SBX_INVISIBLE 0x0100 // Element is not found by Find() +#define SBX_EXTSEARCH 0x0200 // Object is searched completely +#define SBX_EXTFOUND 0x0400 // Variable was found through extended search +#define SBX_GBLSEARCH 0x0800 // Global search via Parents +#define SBX_RESERVED 0x1000 // reserved +#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED +#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put +#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call) +#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed +#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN +#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one + // is used for objects, the other for variables only + +// Broadcaster-IDs: +#define SBX_HINT_DYING SFX_HINT_DYING +#define SBX_HINT_DATAWANTED SFX_HINT_USER00 +#define SBX_HINT_DATACHANGED SFX_HINT_DATACHANGED +#define SBX_HINT_CONVERTED SFX_HINT_USER01 +#define SBX_HINT_INFOWANTED SFX_HINT_USER02 +#define SBX_HINT_OBJECTCHANGED SFX_HINT_USER03 + +// List of all creators for Load/Store + +#define SBXCR_SBX 0x20584253 // SBX(blank) + +// List of predefined SBX-IDs. New SBX-IDs must be precisly defined so that +// they are unique within the Stream and appropriate Factory. + +#define SBXID_VALUE 0x4E4E // NN: SbxValue +#define SBXID_VARIABLE 0x4156 // VA: SbxVariable +#define SBXID_ARRAY 0x5241 // AR: SbxArray +#define SBXID_DIMARRAY 0x4944 // DI: SbxDimArray +#define SBXID_OBJECT 0x424F // OB: SbxObject +#define SBXID_COLLECTION 0x4F43 // CO: SbxCollection +#define SBXID_FIXCOLLECTION 0x4346 // FC: SbxStdCollection +#define SBXID_METHOD 0x454D // ME: SbxMethod +#define SBXID_PROPERTY 0x5250 // PR: SbxProperty + +// StarBASIC restricts the base data type to different intervals. +// These intervals are fixed to create 'portability and independent +// of the implementation. Only type double is greedy and takes +// what it gets. + +#define SbxMAXCHAR ((sal_Unicode)65535) +#define SbxMINCHAR (0) +#define SbxMAXBYTE ( 255) +#define SbxMAXINT ( 32767) +#define SbxMININT (-32768) +#define SbxMAXUINT ((sal_uInt16) 65535) +#define SbxMAXLNG ( 2147483647) +#define SbxMINLNG ((sal_Int32)(-2147483647-1)) +#define SbxMAXULNG ((sal_uInt32) 0xffffffff) + +#define SbxMAXSALUINT64 SAL_MAX_UINT64 +#define SbxMAXSALINT64 SAL_MAX_INT64 +#define SbxMINSALINT64 SAL_MIN_INT64 + + // Currency stored as SbxSALINT64 == sal_Int64 + // value range limits are ~(2^63 - 1)/10000 + // fixed precision has 4 digits right of decimal pt +#define CURRENCY_FACTOR (10000) +#define CURRENCY_FACTOR_SQUARE (100000000) + +// TODO effective MAX/MINCURR limits: +// true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double +#define SbxMAXCURR ( 922337203685477.5807) +#define SbxMINCURR (-922337203685477.5808) + +#define SbxMAXSNG ( 3.402823e+38) +#define SbxMINSNG (-3.402823e+38) +#define SbxMAXSNG2 ( 1.175494351e-38) +#define SbxMINSNG2 (-1.175494351e-38) + +// Max valid offset index of a Sbx-Array (due to 64K limit) +#define SBX_MAXINDEX 0x3FF0 +#define SBX_MAXINDEX32 SbxMAXLNG + +// The numeric values of sal_True and FALSE +enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 }; + +#endif //ifndef __RSC + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbxfac.hxx b/basic/inc/basic/sbxfac.hxx new file mode 100644 index 000000000000..8597458c5ec2 --- /dev/null +++ b/basic/inc/basic/sbxfac.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __SBX_SBX_FACTORY_HXX +#define __SBX_SBX_FACTORY_HXX + +#include <basic/sbxdef.hxx> + +class SbxBase; +class SbxObject; +class String; +class UniString; + +class SbxFactory +{ + sal_Bool bHandleLast; // sal_True: Factory is asked at last because of its expensiveness +public: + SbxFactory( sal_Bool bLast=sal_False ) { bHandleLast = bLast; } + sal_Bool IsHandleLast( void ) { return bHandleLast; } + virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); + virtual SbxObject* CreateObject( const String& ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbxform.hxx b/basic/inc/basic/sbxform.hxx new file mode 100644 index 000000000000..27d372d8ccf1 --- /dev/null +++ b/basic/inc/basic/sbxform.hxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBXFORM_HXX +#define _SBXFORM_HXX + +//==================================================================== +// Implementation class for Basic command: Format$( d,formatStr ) +//==================================================================== +/* + Grammar of format string (a try): + ----------------------------------------------- + + format_string := {\special_char} general_format | scientific_format {\special_char} {;format_string} + general_format := {#[,]}{0[,]}[.{0}{#}] + scientific_format := {0}[.{0}{#}](e | E)(+ | -){#}{0} + + percent_char := '%' + special_char := \char | + | - | ( | ) | $ | space_char + char := all_ascii_chars + space_char := ' ' + + {} repeated multiple times (incl. zero times) + [] exactly one or zero times + () parenthesis, e.g. (e | E) means e or E times + + Additional predefined formats for the format string: + "General Number" + "Currency" + "Fixed" + "Standard" + "Percent" + "Scientific" + "Yes/No" + "True/False" + "On/Off" + + Note: invalid format string are ignored just as in VisualBasic, the output is + probably 'undefined'. ASCII letters are outputted directly. + + Constraints in VisualBasic: + - the exponent (scientific syntax) has a maximum of three digits! + + Constraints of new implementation: + - the '+' sign is not allowed as wildcard in the mantissa + + TODO: + - Date formatting + Wildcards are: 'h', 'm', 's', 'y' + predefined String-Constants/Commands: + "AMPM", "Long Date", "Long Time" +*/ + +/* + There are two possibilities to get the number of digits of a number: + + a) use sprintf() + b) use log10() and pow() digit +*/ +#define _with_sprintf // use a) + +#include <tools/string.hxx> + +class SbxBasicFormater { + public: + // Constructor takes signs for decimal point, thousand separation sign + // and necessary resource strings. + SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep, + String _sOnStrg, + String _sOffStrg, + String _sYesStrg, + String _sNoStrg, + String _sTrueStrg, + String _sFalseStrg, + String _sCurrencyStrg, + String _sCurrencyFormatStrg ); + + /* Basic command: Format$( number,format-string ) + + Parameter: + dNumber : number to be formated + sFormatStrg : the Format-String, e.g. ###0.0### + + Return value: + String containing the formatted output + */ + String BasicFormat( double dNumber, String sFormatStrg ); + String BasicFormatNull( String sFormatStrg ); + + static sal_Bool isBasicFormat( String sFormatStrg ); + + private: + inline void ShiftString( String& sStrg, sal_uInt16 nStartPos ); + inline void StrAppendChar( String& sStrg, sal_Unicode ch ); + void AppendDigit( String& sStrg, short nDigit ); + void LeftShiftDecimalPoint( String& sStrg ); + void StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOverflow ); + void StrRoundDigit( String& sStrg, short nPos ); + void ParseBack( String& sStrg, const String& sFormatStrg, + short nFormatPos ); +#ifdef _with_sprintf + // Methods for string conversion with sprintf(): + void InitScan( double _dNum ); + void InitExp( double _dNewExp ); + short GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit ); + short GetDigitAtPosExpScan( double dNewExponent, short nPos, + sal_Bool& bFoundFirstDigit ); + short GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit ); +#else + // Methods for direct 'calculation' with log10() and pow(): + short GetDigitAtPos( double dNumber, short nPos, double& dNextNumber, + sal_Bool& bFoundFirstDigit ); + short RoundDigit( double dNumber ); +#endif + String GetPosFormatString( const String& sFormatStrg, sal_Bool & bFound ); + String GetNegFormatString( const String& sFormatStrg, sal_Bool & bFound ); + String Get0FormatString( const String& sFormatStrg, sal_Bool & bFound ); + String GetNullFormatString( const String& sFormatStrg, sal_Bool & bFound ); + short AnalyseFormatString( const String& sFormatStrg, + short& nNoOfDigitsLeft, short& nNoOfDigitsRight, + short& nNoOfOptionalDigitsLeft, + short& nNoOfExponentDigits, + short& nNoOfOptionalExponentDigits, + sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific, + sal_Bool& bGenerateThousandSeparator, + short& nMultipleThousandSeparators ); + void ScanFormatString( double dNumber, const String& sFormatStrg, + String& sReturnStrg, sal_Bool bCreateSign ); + + //*** Data *** + sal_Unicode cDecPoint; // sign for the decimal point + sal_Unicode cThousandSep; // sign for thousand delimiter + // Text for output: + String sOnStrg; + String sOffStrg; + String sYesStrg; + String sNoStrg; + String sTrueStrg; + String sFalseStrg; + String sCurrencyStrg; + String sCurrencyFormatStrg; + + //*** temporary data for scan loop *** + //----------------------------------------------- + // String containing the number in scientific format + String sSciNumStrg; + // String containing the exponent of the number + String sNumExpStrg; + double dNum; // the number that is scanned + short nNumExp; // the exponent of the number + short nExpExp; // the number of digits in the exponent +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/sbxmeth.hxx b/basic/inc/basic/sbxmeth.hxx new file mode 100644 index 000000000000..31b07fdca18d --- /dev/null +++ b/basic/inc/basic/sbxmeth.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __SBX_SBXMETHOD_HXX +#define __SBX_SBXMETHOD_HXX + +#include <basic/sbxvar.hxx> + +class SbxMethodImpl; + +class SbxMethod : public SbxVariable +{ + SbxMethodImpl* mpSbxMethodImpl; // Impl data + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_METHOD,1); + TYPEINFO(); + SbxMethod( const String& r, SbxDataType t ) + : SbxVariable( t ) { SetName( r ); } + SbxMethod( const SbxMethod& r ) : SvRefBase( r ), SbxVariable( r ) {} + SbxMethod& operator=( const SbxMethod& r ) + { SbxVariable::operator=( r ); return *this; } + sal_Bool Run( SbxValues* pValues = NULL ); + virtual SbxClassType GetClass() const; +}; + +#ifndef __SBX_SBXMETHODREF_HXX +#define __SBX_SBXMETHODREF_HXX + +#ifndef SBX_METHOD_DECL_DEFINED +#define SBX_METHOD_DECL_DEFINED +SV_DECL_REF(SbxMethod) +#endif +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 new file mode 100644 index 000000000000..d3197bff883d --- /dev/null +++ b/basic/inc/basic/sbxmstrm.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBXMSTRM_HXX +#define _SBXMSTRM_HXX 1 + +#include <tools/stream.hxx> +#include <basic/sbxdef.hxx> +#include <basic/sbxcore.hxx> + +SV_DECL_REF(SbxMemoryStream) + +class SbxMemoryStream : public SbxBase, public SvMemoryStream +{ + public: + SbxMemoryStream(sal_uIntPtr nInitSize_=512, sal_uIntPtr nResize_=64) : + SvMemoryStream(nInitSize_,nResize_) {} + ~SbxMemoryStream(); + + virtual SbxDataType GetType() const; +}; + +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 new file mode 100644 index 000000000000..ab2b46422209 --- /dev/null +++ b/basic/inc/basic/sbxobj.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBX_SBXOBJECT_HXX +#define _SBX_SBXOBJECT_HXX + +#include <svl/lstner.hxx> +#include <basic/sbxvar.hxx> + + +class SbxProperty; +class SvDispatch; + +class SbxObjectImpl; + +class SbxObject : public SbxVariable, public SfxListener +{ + SbxObjectImpl* mpSbxObjectImpl; // Impl data + + SbxArray* FindVar( SbxVariable*, sal_uInt16& ); + // AB 23.3.1997, special method for VCPtrRemove (see below) + SbxArray* VCPtrFindVar( SbxVariable*, sal_uInt16& ); +protected: + SbxArrayRef pMethods; // Methods + SbxArrayRef pProps; // Properties + SbxArrayRef pObjs; // Objects + SbxProperty* pDfltProp; // Default-Property + String aClassName; // Classname + String aDfltPropName; + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; + virtual ~SbxObject(); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_OBJECT,1); + TYPEINFO(); + SbxObject( const String& rClassname ); + SbxObject( const SbxObject& ); + SbxObject& operator=( const SbxObject& ); + virtual SbxDataType GetType() const; + virtual SbxClassType GetClass() const; + virtual void Clear(); + + virtual sal_Bool IsClass( const String& ) const; + const String& GetClassName() const { return aClassName; } + void SetClassName( const String &rNew ) { aClassName = rNew; } + // Default-Property + SbxProperty* GetDfltProperty(); + void SetDfltProperty( const String& r ); + void SetDfltProperty( SbxProperty* ); + // Search for an element + virtual SbxVariable* FindUserData( sal_uInt32 nUserData ); + virtual SbxVariable* Find( const String&, SbxClassType ); + SbxVariable* FindQualified( const String&, SbxClassType ); + // Quick-Call-Interface for Methods + virtual sal_Bool Call( const String&, SbxArray* = NULL ); + // Execution of DDE-Commands + SbxVariable* Execute( const String& ); + // Manage elements + virtual sal_Bool GetAll( SbxClassType ) { return sal_True; } + SbxVariable* Make( const String&, SbxClassType, SbxDataType ); + virtual SbxObject* MakeObject( const String&, const String& ); + virtual void Insert( SbxVariable* ); + // AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and + // without Broadcasts, only used in SO2/auto.cxx + void QuickInsert( SbxVariable* ); + // AB 23.3.1997, Special-Method, allow corresponding controls + void VCPtrInsert( SbxVariable* ); + virtual void Remove( const String&, SbxClassType ); + virtual void Remove( SbxVariable* ); + // AB 23.3.1997, deletion per pointer for controls (duplicate names!) + void VCPtrRemove( SbxVariable* ); + void SetPos( SbxVariable*, sal_uInt16 ); + + // Macro-Recording + virtual String GenerateSource( const String &rLinePrefix, + const SbxObject *pRelativeTo ); + // Direct access on arrays + SbxArray* GetMethods() { return pMethods; } + SbxArray* GetProperties() { return pProps; } + SbxArray* GetObjects() { return pObjs; } + // Hooks + virtual SvDispatch* GetSvDispatch(); + // Debugging + void Dump( SvStream&, sal_Bool bDumpAll=sal_False ); + + static void GarbageCollection( sal_uIntPtr nObjects = 0 /* ::= all */ ); +}; + +#ifndef __SBX_SBXOBJECTREF_HXX + +#ifndef SBX_OBJECT_DECL_DEFINED +#define SBX_OBJECT_DECL_DEFINED +SV_DECL_REF(SbxObject) +#endif +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 new file mode 100644 index 000000000000..25c875df9222 --- /dev/null +++ b/basic/inc/basic/sbxprop.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __SBX_SBXPROPERTY_HXX +#define __SBX_SBXPROPERTY_HXX + +#include <basic/sbxvar.hxx> + +class SbxPropertyImpl; + +class SbxProperty : public SbxVariable +{ + SbxPropertyImpl* mpSbxPropertyImpl; // Impl data + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_PROPERTY,1); + TYPEINFO(); + SbxProperty( const String& r, SbxDataType t ) + : SbxVariable( t ) { SetName( r ); } + SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {} + SbxProperty& operator=( const SbxProperty& r ) + { SbxVariable::operator=( r ); return *this; } + virtual SbxClassType GetClass() const; +}; + +#ifndef __SBX_SBXPROPERTYREF_HXX +#define __SBX_SBXPROPERTYREF_HXX + +#ifndef SBX_PROPERTY_DECL_DEFINED +#define SBX_PROPERTY_DECL_DEFINED +SV_DECL_REF(SbxProperty) +#endif +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 new file mode 100644 index 000000000000..7f0e5d878225 --- /dev/null +++ b/basic/inc/basic/sbxvar.hxx @@ -0,0 +1,398 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SBXVAR_HXX +#define _SBXVAR_HXX + +#include <rtl/ustring.hxx> +#include <tools/string.hxx> +#include <com/sun/star/bridge/oleautomation/Decimal.hpp> +#include <basic/sbxcore.hxx> + +#ifndef __SBX_SBXVALUES_HXX +#define __SBX_SBXVALUES_HXX + +class SbxDecimal; + +struct SbxValues +{ + union { + sal_uInt8 nByte; + sal_uInt16 nUShort; + sal_Unicode nChar; + sal_Int16 nInteger; + sal_uInt32 nULong; + sal_Int32 nLong; + unsigned int nUInt; + int nInt; + sal_uInt64 uInt64; + sal_Int64 nInt64; + + float nSingle; + double nDouble; + + rtl::OUString* pOUString; + SbxDecimal* pDecimal; + + SbxBase* pObj; + + sal_uInt8* pByte; + sal_uInt16* pUShort; + sal_Unicode* pChar; + sal_Int16* pInteger; + sal_uInt32* pULong; + sal_Int32* pLong; + unsigned int* pUInt; + int* pInt; + sal_uInt64* puInt64; + sal_Int64* pnInt64; + + float* pSingle; + double* pDouble; + + void* pData; + }; + SbxDataType eType; + + SbxValues(): pData( NULL ), eType(SbxEMPTY) {} + SbxValues( SbxDataType e ): eType(e) {} + SbxValues( char _nChar ): nChar( _nChar ), eType(SbxCHAR) {} + SbxValues( sal_uInt8 _nByte ): nByte( _nByte ), eType(SbxBYTE) {} + SbxValues( short _nInteger ): nInteger( _nInteger ), eType(SbxINTEGER ) {} + SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {} + SbxValues( sal_uInt16 _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {} + SbxValues( sal_uIntPtr _nULong ): nULong( _nULong ), eType(SbxULONG) {} + SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {} + SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {} + SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {} + SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {} + SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {} + SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {} + SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {} + SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {} + +}; + +#endif + +#ifndef __SBX_SBXVALUE +#define __SBX_SBXVALUE + +struct SbxValues; + +class SbxValueImpl; + +class SbxValue : public SbxBase +{ + SbxValueImpl* mpSbxValueImplImpl; // Impl data + + // #55226 Transport additional infos + SbxValue* TheRealValue( sal_Bool bObjInObjError ) const; + SbxValue* TheRealValue() const; +protected: + SbxValues aData; // Data + ::rtl::OUString aPic; // Picture-String + String aToolString; // tool string copy + + virtual void Broadcast( sal_uIntPtr ); // Broadcast-Call + virtual ~SbxValue(); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VALUE,1); + TYPEINFO(); + SbxValue(); + SbxValue( SbxDataType, void* = NULL ); + SbxValue( const SbxValue& ); + SbxValue& operator=( const SbxValue& ); + virtual void Clear(); + virtual sal_Bool IsFixed() const; + + sal_Bool IsInteger() const { return sal_Bool( GetType() == SbxINTEGER ); } + sal_Bool IsLong() const { return sal_Bool( GetType() == SbxLONG ); } + sal_Bool IsSingle() const { return sal_Bool( GetType() == SbxSINGLE ); } + sal_Bool IsDouble() const { return sal_Bool( GetType() == SbxDOUBLE ); } + sal_Bool IsString() const { return sal_Bool( GetType() == SbxSTRING ); } + sal_Bool IsDate() const { return sal_Bool( GetType() == SbxDATE ); } + sal_Bool IsCurrency()const { return sal_Bool( GetType() == SbxCURRENCY ); } + sal_Bool IsObject() const { return sal_Bool( GetType() == SbxOBJECT ); } + sal_Bool IsDataObject()const{return sal_Bool( GetType() == SbxDATAOBJECT);} + sal_Bool IsBool() const { return sal_Bool( GetType() == SbxBOOL ); } + sal_Bool IsErr() const { return sal_Bool( GetType() == SbxERROR ); } + sal_Bool IsEmpty() const { return sal_Bool( GetType() == SbxEMPTY ); } + sal_Bool IsNull() const { return sal_Bool( GetType() == SbxNULL ); } + sal_Bool IsChar() const { return sal_Bool( GetType() == SbxCHAR ); } + sal_Bool IsByte() const { return sal_Bool( GetType() == SbxBYTE ); } + sal_Bool IsUShort() const { return sal_Bool( GetType() == SbxUSHORT ); } + sal_Bool IsULong() const { return sal_Bool( GetType() == SbxULONG ); } + sal_Bool IsInt() const { return sal_Bool( GetType() == SbxINT ); } + sal_Bool IsUInt() const { return sal_Bool( GetType() == SbxUINT ); } + sal_Bool IspChar() const { return sal_Bool( GetType() == SbxLPSTR ); } + sal_Bool IsNumeric() const; + sal_Bool IsNumericRTL() const; // #41692 Interface for Basic + sal_Bool ImpIsNumeric( sal_Bool bOnlyIntntl ) const; // Implementation + + virtual SbxClassType GetClass() const; + virtual SbxDataType GetType() const; + SbxDataType GetFullType() const; + sal_Bool SetType( SbxDataType ); + + virtual sal_Bool Get( SbxValues& ) const; + sal_Bool GetNoBroadcast( SbxValues& ); + const SbxValues& GetValues_Impl() const { return aData; } + virtual sal_Bool Put( const SbxValues& ); + + inline SbxValues * data() { return &aData; } + + sal_Unicode GetChar() const; + sal_Int16 GetInteger() const; + sal_Int32 GetLong() const; + sal_Int64 GetInt64() const; + sal_uInt64 GetUInt64() const; + + sal_Int64 GetCurrency() const; + SbxDecimal* GetDecimal() const; + + float GetSingle() const; + double GetDouble() const; + double GetDate() const; + + sal_Bool GetBool() const; + sal_uInt16 GetErr() const; + const String& GetString() const; + const String& GetCoreString() const; + rtl::OUString GetOUString() const; + + SbxBase* GetObject() const; + sal_Bool HasObject() const; + void* GetData() const; + sal_uInt8 GetByte() const; + sal_uInt16 GetUShort() const; + sal_uInt32 GetULong() const; + int GetInt() const; + + sal_Bool PutInteger( sal_Int16 ); + sal_Bool PutLong( sal_Int32 ); + sal_Bool PutSingle( float ); + sal_Bool PutDouble( double ); + sal_Bool PutDate( double ); + sal_Bool PutBool( sal_Bool ); + sal_Bool PutErr( sal_uInt16 ); + sal_Bool PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "sal_True"/"sal_False") + sal_Bool PutInt64( sal_Int64 ); + sal_Bool PutUInt64( sal_uInt64 ); + sal_Bool PutString( const ::rtl::OUString& ); + sal_Bool PutString( const sal_Unicode* ); // Type = SbxSTRING + sal_Bool PutpChar( const sal_Unicode* ); // Type = SbxLPSTR + sal_Bool PutChar( sal_Unicode ); + sal_Bool PutByte( sal_uInt8 ); + sal_Bool PutUShort( sal_uInt16 ); + sal_Bool PutULong( sal_uInt32 ); + sal_Bool PutInt( int ); + sal_Bool PutEmpty(); + sal_Bool PutNull(); + + // Special methods + sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + sal_Bool PutDecimal( SbxDecimal* pDecimal ); + sal_Bool PutCurrency( const sal_Int64& ); + // Interface for CDbl in Basic + static SbxError ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool bSingle = sal_False ); + + sal_Bool PutObject( SbxBase* ); + sal_Bool PutData( void* ); + + virtual sal_Bool Convert( SbxDataType ); + virtual sal_Bool Compute( SbxOperator, const SbxValue& ); + virtual sal_Bool Compare( SbxOperator, const SbxValue& ) const; + sal_Bool Scan( const String&, sal_uInt16* = NULL ); + void Format( String&, const String* = NULL ) const; + + // The following operators are definied for easier handling. + // TODO: Ensure error conditions (overflow, conversions) + // are taken into consideration in Compute and Compare + + inline int operator ==( const SbxValue& ) const; + inline int operator !=( const SbxValue& ) const; + inline int operator <( const SbxValue& ) const; + inline int operator >( const SbxValue& ) const; + inline int operator <=( const SbxValue& ) const; + inline int operator >=( const SbxValue& ) const; + + inline SbxValue& operator *=( const SbxValue& ); + inline SbxValue& operator /=( const SbxValue& ); + inline SbxValue& operator %=( const SbxValue& ); + inline SbxValue& operator +=( const SbxValue& ); + inline SbxValue& operator -=( const SbxValue& ); + inline SbxValue& operator &=( const SbxValue& ); + inline SbxValue& operator |=( const SbxValue& ); + inline SbxValue& operator ^=( const SbxValue& ); +}; + +inline int SbxValue::operator==( const SbxValue& r ) const +{ return Compare( SbxEQ, r ); } + +inline int SbxValue::operator!=( const SbxValue& r ) const +{ return Compare( SbxNE, r ); } + +inline int SbxValue::operator<( const SbxValue& r ) const +{ return Compare( SbxLT, r ); } + +inline int SbxValue::operator>( const SbxValue& r ) const +{ return Compare( SbxGT, r ); } + +inline int SbxValue::operator<=( const SbxValue& r ) const +{ return Compare( SbxLE, r ); } + +inline int SbxValue::operator>=( const SbxValue& r ) const +{ return Compare( SbxGE, r ); } + +inline SbxValue& SbxValue::operator*=( const SbxValue& r ) +{ Compute( SbxMUL, r ); return *this; } + +inline SbxValue& SbxValue::operator/=( const SbxValue& r ) +{ Compute( SbxDIV, r ); return *this; } + +inline SbxValue& SbxValue::operator%=( const SbxValue& r ) +{ Compute( SbxMOD, r ); return *this; } + +inline SbxValue& SbxValue::operator+=( const SbxValue& r ) +{ Compute( SbxPLUS, r ); return *this; } + +inline SbxValue& SbxValue::operator-=( const SbxValue& r ) +{ Compute( SbxMINUS, r ); return *this; } + +inline SbxValue& SbxValue::operator&=( const SbxValue& r ) +{ Compute( SbxAND, r ); return *this; } + +inline SbxValue& SbxValue::operator|=( const SbxValue& r ) +{ Compute( SbxOR, r ); return *this; } + +inline SbxValue& SbxValue::operator^=( const SbxValue& r ) +{ Compute( SbxXOR, r ); return *this; } + +#endif + +#ifndef __SBX_SBXVARIABLE_HXX +#define __SBX_SBXVARIABLE_HXX + +class SbxArray; +class SbxInfo; + +#ifndef SBX_ARRAY_DECL_DEFINED +#define SBX_ARRAY_DECL_DEFINED +SV_DECL_REF(SbxArray) +#endif + +#ifndef SBX_INFO_DECL_DEFINED +#define SBX_INFO_DECL_DEFINED +SV_DECL_REF(SbxInfo) +#endif + +class SfxBroadcaster; + +class SbxVariableImpl; +class StarBASIC; + +class SbxVariable : public SbxValue +{ + friend class SbMethod; + + SbxVariableImpl* mpSbxVariableImpl; // Impl data + SfxBroadcaster* pCst; // Broadcaster, if needed + String maName; // Name, if available + SbxArrayRef mpPar; // Parameter-Array, if set + sal_uInt16 nHash; // Hash-ID for search + + SbxVariableImpl* getImpl( void ); + +protected: + SbxInfoRef pInfo; // Probably called information + sal_uIntPtr nUserData; // User data for Call() + SbxObject* pParent; // Currently attached object + virtual ~SbxVariable(); + virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); + virtual sal_Bool StoreData( SvStream& ) const; +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VARIABLE,2); + TYPEINFO(); + SbxVariable(); + SbxVariable( SbxDataType, void* = NULL ); + SbxVariable( const SbxVariable& ); + SbxVariable& operator=( const SbxVariable& ); + + void Dump( SvStream&, sal_Bool bDumpAll=sal_False ); + + virtual void SetName( const String& ); + virtual const String& GetName( SbxNameType = SbxNAME_NONE ) const; + sal_uInt16 GetHashCode() const { return nHash; } + + virtual void SetModified( sal_Bool ); + + sal_uIntPtr GetUserData() const { return nUserData; } + void SetUserData( sal_uIntPtr n ) { nUserData = n; } + + virtual SbxDataType GetType() const; + virtual SbxClassType GetClass() const; + + // Parameter-Interface + virtual SbxInfo* GetInfo(); + void SetInfo( SbxInfo* p ); + void SetParameters( SbxArray* p ); + SbxArray* GetParameters() const { return mpPar; } + + // Sfx-Broadcasting-Support: + // Due to data reduction and better DLL-hierarchie currently via casting + SfxBroadcaster& GetBroadcaster(); + sal_Bool IsBroadcaster() const { return sal_Bool( pCst != NULL ); } + virtual void Broadcast( sal_uIntPtr nHintId ); + + inline const SbxObject* GetParent() const { return pParent; } + inline SbxObject* GetParent() { return pParent; } + virtual void SetParent( SbxObject* ); + + const String& GetDeclareClassName( void ); + void SetDeclareClassName( const String& ); + void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener, + StarBASIC* pParentBasic ); + void ClearComListener( void ); + + static sal_uInt16 MakeHashCode( const String& rName ); +}; + +#ifndef SBX_VARIABLE_DECL_DEFINED +#define SBX_VARIABLE_DECL_DEFINED +SV_DECL_REF(SbxVariable) +#endif + +#endif + +#endif // _SBXVAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/svtmsg.hrc b/basic/inc/basic/svtmsg.hrc new file mode 100755 index 000000000000..ff215d3fc9cb --- /dev/null +++ b/basic/inc/basic/svtmsg.hrc @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "basic/ttglobal.hrc" + + +// Here are the messages of /basic/source/app included + +/////////////////////////////// +// Error message that go to the Resultfile. +// ********************* +// *** !!ATTENTION!! *** +// ********************* +// Theses numbers MUST NOT change ever! +// Because they are stored in the Resultfiles and if you showed them again +// the appropriate new or no Strings are viewed. +/////////////////////////////// + +#define S_GPF_ABORT ( SVT_START + 0 ) +#define S_APP_SHUTDOWN ( SVT_START + 1 ) +#define S_SID_EXECUTE_FAILED_NO_DISPATCHER ( SVT_START + 2 ) +#define S_SID_EXECUTE_FAILED ( SVT_START + 3 ) +#define S_UNO_PROPERTY_NITIALIZE_FAILED ( SVT_START + 4 ) +#define S_RESETAPPLICATION_FAILED_COMPLEX ( SVT_START + 5 ) +#define S_RESETAPPLICATION_FAILED_UNKNOWN ( SVT_START + 6 ) +#define S_NO_ACTIVE_WINDOW ( SVT_START + 7 ) +#define S_NO_DIALOG_IN_GETACTIVE ( SVT_START + 8 ) +#define S_NO_POPUP ( SVT_START + 9 ) +#define S_NO_SUBMENU ( SVT_START + 10 ) +#define S_CONTROLTYPE_NOT_SUPPORTED ( SVT_START + 11 ) +#define S_SELECTION_BY_ATTRIBUTE_ONLY_DIRECTORIES ( SVT_START + 12 ) +#define S_NO_MORE_FILES ( SVT_START + 13 ) +#define S_UNKNOWN_METHOD ( SVT_START + 14 ) +#define S_INVALID_PARAMETERS ( SVT_START + 15 ) +#define S_POINTER_OUTSIDE_APPWIN ( SVT_START + 16 ) +#define S_UNKNOWN_COMMAND ( SVT_START + 17 ) +#define S_WIN_NOT_FOUND ( SVT_START + 18 ) +#define S_WIN_INVISIBLE ( SVT_START + 19 ) +#define S_WIN_DISABLED ( SVT_START + 20 ) +#define S_NUMBER_TOO_BIG ( SVT_START + 21 ) +#define S_NUMBER_TOO_SMALL ( SVT_START + 22 ) +#define S_WINDOW_DISAPPEARED ( SVT_START + 23 ) +#define S_ERROR_SAVING_IMAGE ( SVT_START + 24 ) +#define S_INVALID_POSITION ( SVT_START + 25 ) +#define S_SPLITWIN_NOT_FOUND ( SVT_START + 26 ) +#define S_INTERNAL_ERROR ( SVT_START + 27 ) +#define S_NO_STATUSBAR ( SVT_START + 28 ) +#define S_ITEMS_INVISIBLE ( SVT_START + 29 ) +#define S_TABPAGE_NOT_FOUND ( SVT_START + 30 ) +#define S_TRISTATE_NOT_ALLOWED ( SVT_START + 31 ) +#define S_ERROR_IN_SET_TEXT ( SVT_START + 32 ) +#define S_ATTEMPT_TO_WRITE_READONLY ( SVT_START + 33 ) +#define S_NO_SELECT_FALSE ( SVT_START + 34 ) +#define S_ENTRY_NOT_FOUND ( SVT_START + 35 ) +#define S_METHOD_FAILED ( SVT_START + 36 ) +#define S_HELPID_ON_TOOLBOX_NOT_FOUND ( SVT_START + 37 ) +#define S_BUTTON_DISABLED_ON_TOOLBOX ( SVT_START + 38 ) +#define S_BUTTON_HIDDEN_ON_TOOLBOX ( SVT_START + 39 ) +#define S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX ( SVT_START + 40 ) +#define S_TEAROFF_FAILED ( SVT_START + 41 ) +#define S_NO_SELECTED_ENTRY_DEPRECATED ( SVT_START + 42 ) // Has to stay in for old res files +#define S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED ( SVT_START + 43 ) +#define S_ALLOWED_ONLY_IN_FLOATING_MODE ( SVT_START + 44 ) +#define S_ALLOWED_ONLY_IN_DOCKING_MODE ( SVT_START + 45 ) +#define S_SIZE_NOT_CHANGEABLE ( SVT_START + 46 ) +#define S_NO_OK_BUTTON ( SVT_START + 47 ) +#define S_NO_CANCEL_BUTTON ( SVT_START + 48 ) +#define S_NO_YES_BUTTON ( SVT_START + 49 ) +#define S_NO_NO_BUTTON ( SVT_START + 50 ) +#define S_NO_RETRY_BUTTON ( SVT_START + 51 ) +#define S_NO_HELP_BUTTON ( SVT_START + 52 ) +#define S_NO_DEFAULT_BUTTON ( SVT_START + 53 ) +#define S_BUTTON_ID_NOT_THERE ( SVT_START + 54 ) +#define S_BUTTONID_REQUIRED ( SVT_START + 55 ) +#define S_UNKNOWN_TYPE ( SVT_START + 56 ) +#define S_UNPACKING_STORAGE_FAILED ( SVT_START + 57 ) +#define S_NO_LIST_BOX_BUTTON ( SVT_START + 58 ) +#define S_UNO_URL_EXECUTE_FAILED_NO_DISPATCHER ( SVT_START + 59 ) +#define S_UNO_URL_EXECUTE_FAILED_NO_FRAME ( SVT_START + 60 ) +#define S_NO_MENU ( SVT_START + 61 ) +#define S_NO_SELECTED_ENTRY ( SVT_START + 62 ) +#define S_UNO_URL_EXECUTE_FAILED_DISABLED ( SVT_START + 63 ) +#define S_NO_SCROLLBAR ( SVT_START + 64 ) +#define S_NO_SAX_PARSER ( SVT_START + 65 ) +#define S_CANNOT_CREATE_DIRECTORY ( SVT_START + 66 ) +#define S_DIRECTORY_NOT_EMPTY ( SVT_START + 67 ) +#define S_DEPRECATED ( SVT_START + 68 ) +#define S_SIZE_BELOW_MINIMUM ( SVT_START + 69 ) +#define S_CANNOT_FIND_FLOATING_WIN ( SVT_START + 70 ) +#define S_NO_LIST_BOX_STRING ( SVT_START + 71 ) +#define S_SLOT_IN_EXECUTE ( SVT_START + 72 ) +#define S_MENU_NOT_CLOSING ( SVT_START + 73 ) diff --git a/basic/inc/basic/testtool.hrc b/basic/inc/basic/testtool.hrc new file mode 100755 index 000000000000..075b462944c9 --- /dev/null +++ b/basic/inc/basic/testtool.hrc @@ -0,0 +1,36 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define S_INVALID_KEYCODE 257 +#define S_MANDATORY_FILE 258 +#define S_READING_LONGNAMES 259 +#define S_READING_SLOT_IDS 260 +#define S_READING_CONTROLS 261 +#define S_READING_BASIC_MODULE 262 +#define S_STARTING_APPLICATION 263 + + + diff --git a/basic/inc/basic/testtool.hxx b/basic/inc/basic/testtool.hxx new file mode 100644 index 000000000000..b7de4a88b007 --- /dev/null +++ b/basic/inc/basic/testtool.hxx @@ -0,0 +1,162 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BASIC_TESTTOOL_HXX_ +#define _BASIC_TESTTOOL_HXX_ + +#include <svl/smplhint.hxx> +#include <tools/string.hxx> + +#define TESTTOOL_DEFAULT_PORT 12479 +#define UNO_DEFAULT_PORT 12480 +#define DEFAULT_HOST "localhost" + +#define TT_SIGNATURE_FOR_UNICODE_TEXTFILES "'encoding UTF-8 Do not remove or change this line!" + +#define ASSERTION_STACK_PREFIX "Backtrace:" + +// Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors +// this routine became necessary +sal_Bool IsTTSignatureForUnicodeTextfile( String aLine ); + +#define ADD_ERROR_QUIET(nNr, aStr) \ +{ \ + ErrorEntry *pErr; \ + if ( BasicRuntimeAccess::HasRuntime() ) \ + { \ + BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); \ + xub_StrLen aErrLn = StarBASIC::GetErl(); \ + if ( 0 == aErrLn ) \ + aErrLn = aRun.GetLine(); \ + pErr = new ErrorEntry(nNr, aStr, \ + aErrLn, aRun.GetCol1(), aRun.GetCol2()); \ + } \ + else \ + { \ + pErr = new ErrorEntry(nNr, aStr); \ + } \ + P_FEHLERLISTE->C40_INSERT(ErrorEntry, pErr, P_FEHLERLISTE->Count());\ +} +// ??? Irgendwann noch was mit der UID anfangen !! +#define ADD_ERROR(nNr, aStr) { \ + if ( !SbxBase::IsError() ) \ + SbxBase::SetError( nNr ); \ + ADD_ERROR_QUIET(nNr, aStr); \ +} + +#define POP_ERROR() P_FEHLERLISTE->DeleteAndDestroy(0) +#define GET_ERROR() P_FEHLERLISTE->GetObject(0) +#define IS_ERROR() ( P_FEHLERLISTE->Count() > 0 ) + +// Transmission of error logs +enum TTLogType { LOG_RUN, LOG_TEST_CASE, LOG_ERROR, LOG_CALL_STACK, LOG_MESSAGE, LOG_WARNING, LOG_ASSERTION, LOG_QA_ERROR, LOG_ASSERTION_STACK }; + +struct TTDebugData +{ +public: + TTLogType aLogType; + String aMsg; + String aFilename; + xub_StrLen nLine; + xub_StrLen nCol1; + xub_StrLen nCol2; +}; + +struct TTLogMsg +{ +public: + String aLogFileName; + TTDebugData aDebugData; +}; + +// For transmission of window information from the Testapp +struct WinInfoRec +{ +public: + String aUId; + String aKurzname; + String aSlotname; + String aLangname; + sal_uInt16 nRType; + String aRName; + sal_Bool bIsReset; +}; + +// Defines for syntax Highlighting +#define TT_KEYWORD ((SbTextType)100) // Including locally executed commands like 'use' ... +#define TT_REMOTECMD ((SbTextType)101) // Remotely executed commands like 'nodebug' +#define TT_LOCALCMD ((SbTextType)102) // Locally executed commands like 'use' +#define TT_CONTROL ((SbTextType)103) // Possibly available control loaded by 'use' +#define TT_SLOT ((SbTextType)104) // Available Slots loaded by 'use' +#define TT_METHOD ((SbTextType)105) // Possibly allowed Method for controls +#define TT_NOMETHOD ((SbTextType)106) // No Possibly allowed Method for controls + +#define FILELIST1 ((SbTextType)111) // Symbols in file 1 +#define FILELIST2 ((SbTextType)112) // Symbols in file 2 +#define FILELIST3 ((SbTextType)113) // Symbols in file 3 +#define FILELIST4 ((SbTextType)114) // Symbols in file 4 + +/// defines for hints from TestToolObj to the Application +#define SBX_HINT_LANGUAGE_EXTENSION_LOADED SFX_HINT_USER06 +#define SBX_HINT_EXECUTION_STATUS_INFORMATION SFX_HINT_USER07 + +#define TT_EXECUTION_ENTERWAIT 0x01 +#define TT_EXECUTION_LEAVEWAIT 0x02 +#define TT_EXECUTION_SHOW_ACTION 0x03 +#define TT_EXECUTION_HIDE_ACTION 0x04 + +class TTExecutionStatusHint : public SfxSimpleHint +{ +private: + sal_uInt16 mnType; + String maExecutionStatus; + String maAdditionalExecutionStatus; + +public: + TYPEINFO(); + TTExecutionStatusHint( sal_uInt16 nType, sal_Char *pExecutionStatus, const sal_Char *pAdditionalExecutionStatus = "" ) + : SfxSimpleHint(SBX_HINT_EXECUTION_STATUS_INFORMATION) + , mnType( nType ) + , maExecutionStatus( pExecutionStatus, RTL_TEXTENCODING_ASCII_US ) + , maAdditionalExecutionStatus( pAdditionalExecutionStatus, RTL_TEXTENCODING_ASCII_US ) + {;} + + TTExecutionStatusHint( sal_uInt16 nType, const String &aExecutionStatus = String(), const String &aAdditionalExecutionStatus = String() ) + : SfxSimpleHint(SBX_HINT_EXECUTION_STATUS_INFORMATION) + , mnType( nType ) + , maExecutionStatus( aExecutionStatus ) + , maAdditionalExecutionStatus( aAdditionalExecutionStatus ) + {;} + + const String& GetExecutionStatus() const { return maExecutionStatus; } + const String& GetAdditionalExecutionStatus() const { return maAdditionalExecutionStatus; } + sal_uInt16 GetType(){ return mnType; } +}; + +#endif // _BASIC_TESTTOOL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/ttglobal.hrc b/basic/inc/basic/ttglobal.hrc new file mode 100755 index 000000000000..0248a06c7247 --- /dev/null +++ b/basic/inc/basic/ttglobal.hrc @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TTGLOBAL_HXX +#define _TTGLOBAL_HXX + +/////////////////////////////// +// Error message that go to the Resultfile. +// ********************* +// *** !!ATTENTION!! *** +// ********************* +// Theses numbers MUST NOT change ever! +// Because they are stored in the Resultfiles and if you showed them again +// the appropriate new or no Strings are viewed. +/////////////////////////////// + +// Start of Ressources for the Testtool (own file) +// > 256 and > 9100 (Biggest res in TT itself) +#define TT_START 20000 // Messages from /basic/source/testtool +#define BAS_START 21000 // Messages from /basic/source/app +#define SVT_START 22000 // Messages from /svtools/source/plugapp + + +#endif + diff --git a/basic/inc/basic/ttmsg.hrc b/basic/inc/basic/ttmsg.hrc new file mode 100755 index 000000000000..26f250bc6a6a --- /dev/null +++ b/basic/inc/basic/ttmsg.hrc @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "basic/ttglobal.hrc" + + +// Here are the messages of directory /basic/source/testtool included + +/////////////////////////////// +// Error message that go to the Resultfile. +// ********************* +// *** !!ATTENTION!! *** +// ********************* +// Theses numbers MUST NOT change ever! +// Because they are stored in the Resultfiles and if you showed them again +// the appropriate new or no Strings are viewed. +/////////////////////////////// + +#define S_NAME_NOT_THERE ( TT_START + 0 ) +#define S_DOUBLE_NAME ( TT_START + 1 ) +#define S_READING_FILE ( TT_START + 2 ) +#define S_CANNOT_OPEN_FILE ( TT_START + 3 ) +#define S_INVALID_LINE ( TT_START + 4 ) +#define S_SHORTNAME_UNKNOWN ( TT_START + 5 ) +#define S_LONGNAME_UNKNOWN ( TT_START + 6 ) +#define S_FIRST_SHORTNAME_REQ_ASTRX ( TT_START + 7 ) +#define S_TIMOUT_WAITING ( TT_START + 8 ) +#define S_APPLICATION_RESTARTED ( TT_START + 9 ) +#define S_APPLICATION_START_FAILED ( TT_START + 10 ) +#define S_TIMOUT_SENDING ( TT_START + 11 ) +#define S_NO_CONNECTION ( TT_START + 12 ) +#define S_NO_FILES_FOUND ( TT_START + 13 ) // Not used anymore. needed only for old *.res files +#define S_ERRORS_DETECTED ( TT_START + 14 ) +#define S_NO_ERRORS_DETECTED ( TT_START + 15 ) +#define S_WARNINGS_DETECTED ( TT_START + 16 ) +#define S_NO_WARNINGS_DETECTED ( TT_START + 17 ) +#define S_UNKNOWN_SLOT_CONTROL ( TT_START + 18 ) +#define S_RETURN_SEQUENCE_MISSMATCH ( TT_START + 19 ) +#define S_RETURNED_VALUE_ID_MISSMATCH ( TT_START + 20 ) +#define S_RETURNED_VALUE_NO_RECEIVER ( TT_START + 21 ) +#define S_UNKNOWN_METHOD ( TT_START + 22 ) +#define S_INCLUDE_FILE_WARNINGS_DETECTED ( TT_START + 23 ) +#define S_NO_INCLUDE_FILE_WARNINGS_DETECTED ( TT_START + 24 ) + +// Strings + + +/* +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +*/ diff --git a/basic/inc/basic/ttstrhlp.hxx b/basic/inc/basic/ttstrhlp.hxx new file mode 100644 index 000000000000..adf9068fbdf7 --- /dev/null +++ b/basic/inc/basic/ttstrhlp.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BASIC_TTSTRHLP_HXX +#define _BASIC_TTSTRHLP_HXX + +#include <tools/string.hxx> + +#define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) ) +#define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) ) +#define Str2Id( Str ) rtl::OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US ) +#define Id2Str( Id ) String( rtl::OStringToOUString( Id, RTL_TEXTENCODING_ASCII_US ) ) + +#define StartKenn CUniString("%") +#define EndKenn CUniString("%") +#define UIdKenn ( StartKenn.AppendAscii("UId") ) +#define MethodKenn ( StartKenn.AppendAscii("Method") ) +#define TypeKenn ( StartKenn.AppendAscii("RType") ) +#define SlotKenn ( StartKenn.AppendAscii("SlotId") ) +#define RcKenn ( StartKenn.AppendAscii("RCommand") ) +#define TabKenn ( StartKenn.AppendAscii("Tab") ) +#define MakeStringParam(Type,aText) ( Type.AppendAscii("=").Append( aText ).Append( EndKenn ) ) +#define MakeStringNumber(Type,nNumber) MakeStringParam (Type, UniString::CreateFromInt32(nNumber)) +#define UIdString(aID) MakeStringParam(UIdKenn,String(rtl::OStringToOUString( aID, RTL_TEXTENCODING_ASCII_US ))) +#define MethodString(nNumber) MakeStringNumber(MethodKenn,nNumber) +#define TypeString(nNumber) MakeStringNumber(TypeKenn,nNumber) +#define SlotString(nNumber) MakeStringNumber(SlotKenn,nNumber) +#define RcString(nNumber) MakeStringNumber(RcKenn,nNumber) +#define TabString(nNumber) MakeStringNumber(TabKenn,nNumber) + +#define ResKenn ( StartKenn.AppendAscii("ResId") ) +#define BaseArgKenn ( StartKenn.AppendAscii("Arg") ) +#define ArgKenn(nNumber) ( BaseArgKenn.Append( UniString::CreateFromInt32(nNumber) ) ) +#define ResString(nNumber) MakeStringNumber(ResKenn,nNumber) +#define ArgString(nNumber, aText) MakeStringParam(ArgKenn(nNumber),aText) + +UniString GEN_RES_STR0( sal_uIntPtr nResId ); +UniString GEN_RES_STR1( sal_uIntPtr nResId, const String &Text1 ); +UniString GEN_RES_STR2( sal_uIntPtr nResId, const String &Text1, const String &Text2 ); +UniString GEN_RES_STR3( sal_uIntPtr nResId, const String &Text1, const String &Text2, const String &Text3 ); + +#define GEN_RES_STR1c( nResId, Text1 ) GEN_RES_STR1( nResId, CUniString(Text1) ) +#define GEN_RES_STR2c2( nResId, Text1, Text2 ) GEN_RES_STR2( nResId, Text1, CUniString(Text2) ) +#define GEN_RES_STR3c3( nResId, Text1, Text2, Text3 ) GEN_RES_STR3( nResId, Text1, Text2, CUniString(Text3) ) + +#define IMPL_GEN_RES_STR \ +UniString GEN_RES_STR0( sal_uIntPtr nResId ) { return ResString( nResId ); } \ +UniString GEN_RES_STR1( sal_uIntPtr nResId, const UniString &Text1 ) { return GEN_RES_STR0( nResId ).Append( ArgString( 1, Text1 ) ); } \ +UniString GEN_RES_STR2( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2 ) { return GEN_RES_STR1( nResId, Text1 ).Append( ArgString( 2, Text2 ) ); } \ +UniString GEN_RES_STR3( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2, const UniString &Text3 ) { return GEN_RES_STR2( nResId, Text1, Text2 ).Append( ArgString( 3, Text3 ) );} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/basic/vbahelper.hxx b/basic/inc/basic/vbahelper.hxx new file mode 100644 index 000000000000..0d99387965fe --- /dev/null +++ b/basic/inc/basic/vbahelper.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef BASIC_VBAHELPR_HXX +#define BASIC_VBAHELPR_HXX + +#include <com/sun/star/frame/XModel.hpp> + +namespace basic { +namespace vba { + +/* This header contains public helper functions for VBA used from this module + and from other VBA implementation modules such as vbahelper. + */ + +// ============================================================================ + +/** Locks or unlocks the controllers of all documents that have the same type + as the specified document. + + First, the global module manager (com.sun.star.frame.ModuleManager) is + asked for the type of the passed model, and all open documents with the + same type will be locked or unlocked. + + @param rxModel + A document model determining the type of the documents to be locked or + unlocked. + + @param bLockControllers + Passing true will lock all controllers, passing false will unlock them. + */ +void lockControllersOfAllDocuments( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, + sal_Bool bLockControllers ); + +// ============================================================================ + +/** Enables or disables the container windows of all controllers of all + documents that have the same type as the specified document. + + First, the global module manager (com.sun.star.frame.ModuleManager) is + asked for the type of the passed model, and the container windows of all + open documents with the same type will be enabled or disabled. + + @param rxModel + A document model determining the type of the documents to be enabled or + disabled. + + @param bEnableWindows + Passing true will enable all container windows of all controllers, + passing false will disable them. + */ +void enableContainerWindowsOfAllDocuments( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, + sal_Bool bEnableWindows ); + +// ============================================================================ + +} // namespace vba +} // namespace basic + +#endif |