summaryrefslogtreecommitdiff
path: root/basic/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/inc')
-rw-r--r--basic/source/inc/buffer.hxx63
-rw-r--r--basic/source/inc/codegen.hxx92
-rw-r--r--basic/source/inc/collelem.hxx47
-rw-r--r--basic/source/inc/disas.hxx72
-rw-r--r--basic/source/inc/dlgcont.hxx172
-rw-r--r--basic/source/inc/errobject.hxx52
-rw-r--r--basic/source/inc/expr.hxx257
-rw-r--r--basic/source/inc/filefmt.hxx178
-rw-r--r--basic/source/inc/image.hxx110
-rw-r--r--basic/source/inc/iosys.hxx113
-rw-r--r--basic/source/inc/namecont.hxx743
-rw-r--r--basic/source/inc/object.hxx100
-rw-r--r--basic/source/inc/opcodes.hxx171
-rw-r--r--basic/source/inc/parser.hxx151
-rw-r--r--basic/source/inc/propacc.hxx203
-rw-r--r--basic/source/inc/runtime.hxx529
-rw-r--r--basic/source/inc/sbcomp.hxx38
-rw-r--r--basic/source/inc/sbintern.hxx141
-rw-r--r--basic/source/inc/sbjsmeth.hxx53
-rw-r--r--basic/source/inc/sbjsmod.hxx50
-rw-r--r--basic/source/inc/sbunoobj.hxx325
-rw-r--r--basic/source/inc/scanner.hxx146
-rw-r--r--basic/source/inc/scriptcont.hxx196
-rw-r--r--basic/source/inc/stdobj.hxx51
-rw-r--r--basic/source/inc/symtbl.hxx243
-rw-r--r--basic/source/inc/token.hxx165
26 files changed, 4461 insertions, 0 deletions
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx
new file mode 100644
index 000000000000..cbb1a1702354
--- /dev/null
+++ b/basic/source/inc/buffer.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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 _BUFFER_HXX
+#define _BUFFER_HXX
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+
+class SbiParser;
+
+class SbiBuffer { // Code/Konstanten-Puffer:
+ SbiParser* pParser; // fuer Fehlermeldungen
+ char* pBuf; // Puffer-Pointer
+ char* pCur; // aktueller Puffer-Pointer
+ UINT32 nOff; // aktuelles Offset
+ UINT32 nSize; // aktuelle Groesse
+ short nInc; // Inkrement
+ BOOL Check( USHORT ); // Buffergroesse testen
+public:
+ SbiBuffer( SbiParser*, short ); // Inkrement
+ ~SbiBuffer();
+ void Patch( UINT32, UINT32 ); // Patchen
+ void Chain( UINT32 ); // Back-Chain
+ void Align( INT32 ); // Alignment
+ BOOL Add( const void*, USHORT );// Element anfuegen
+ BOOL operator += (const String&);// Basic-String speichern
+ BOOL operator += (INT8); // Zeichen speichern
+ BOOL operator += (INT16); // Integer speichern
+ BOOL operator += (UINT8); // Zeichen speichern
+ BOOL operator += (UINT16); // Integer speichern
+ BOOL operator += (UINT32); // Integer speichern
+ BOOL operator += (INT32); // Integer speichern
+ char* GetBuffer(); // Puffer rausgeben (selbst loeschen!)
+ char* GetBufferPtr(){ return pBuf; }
+ UINT32 GetSize() { return nOff; }
+};
+
+#endif
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
new file mode 100644
index 000000000000..3d90d16bdcbe
--- /dev/null
+++ b/basic/source/inc/codegen.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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 _CODEGEN_HXX
+#define _CODEGEN_HXX
+
+class SbiImage;
+class SbiParser;
+class SbModule;
+#include "opcodes.hxx"
+#include "buffer.hxx"
+
+class SbiCodeGen { // Code-Erzeugung:
+ SbiParser* pParser; // fuer Fehlermeldungen, Line, Column etc.
+ SbModule& rMod; // aktuelles Modul
+ SbiBuffer aCode; // Code-Puffer
+ short nLine, nCol; // Zeile, Spalte fuer Stmnt-Befehl
+ short nForLevel; // #29955 for-Schleifen-Ebene
+ BOOL bStmnt; // TRUE: Statement-Opcode liegt an
+public:
+ SbiCodeGen( SbModule&, SbiParser*, short );
+ SbiParser* GetParser() { return pParser; }
+ UINT32 Gen( SbiOpcode );
+ UINT32 Gen( SbiOpcode, UINT32 );
+ UINT32 Gen( SbiOpcode, UINT32, UINT32 );
+ void Patch( UINT32 o, UINT32 v ){ aCode.Patch( o, v ); }
+ void BackChain( UINT32 off ) { aCode.Chain( off ); }
+ void Statement();
+ void GenStmnt(); // evtl. Statement-Opcode erzeugen
+ UINT32 GetPC();
+ UINT32 GetOffset() { return GetPC() + 1; }
+ SbModule& GetModule() { return rMod; }
+ void Save();
+
+ // #29955 for-Schleifen-Ebene pflegen
+ void IncForLevel( void ) { nForLevel++; }
+ void DecForLevel( void ) { nForLevel--; }
+
+ static UINT32 calcNewOffSet( BYTE* pCode, UINT16 nOffset );
+ static UINT16 calcLegacyOffSet( BYTE* pCode, UINT32 nOffset );
+
+};
+
+template < class T, class S >
+class PCodeBuffConvertor
+{
+ T m_nSize; //
+ BYTE* m_pStart;
+ BYTE* m_pCnvtdBuf;
+ S m_nCnvtdSize; //
+
+ // Disable usual copying symantics and bodgy default ctor
+ PCodeBuffConvertor();
+ PCodeBuffConvertor(const PCodeBuffConvertor& );
+ PCodeBuffConvertor& operator = ( const PCodeBuffConvertor& );
+public:
+ PCodeBuffConvertor( BYTE* pCode, T nSize ): m_nSize( nSize ), m_pStart( pCode ), m_pCnvtdBuf( NULL ), m_nCnvtdSize( 0 ){ convert(); }
+ S GetSize(){ return m_nCnvtdSize; }
+ void convert();
+ // Caller owns the buffer returned
+ BYTE* GetBuffer() { return m_pCnvtdBuf; }
+};
+
+// #111897 PARAM_INFO flags start at 0x00010000 to not
+// conflict with DefaultId in SbxParamInfo::nUserData
+#define PARAM_INFO_PARAMARRAY 0x0010000
+
+#endif
diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx
new file mode 100644
index 000000000000..cd1787d6ff01
--- /dev/null
+++ b/basic/source/inc/collelem.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * 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 _SAMPLE_COLLELEM_HXX
+#define _SAMPLE_COLLELEM_HXX
+
+#include <basic/sbxobj.hxx>
+
+// Das Sample-Element ist ein kleines Objekt, das die Properties
+// Name und Value enth„lt sowie die Methode Say, die den bergebenen
+// Text mit dem eigenen Namen verkoppelt. Der Name ist von aussen setzbar.
+// Die Implementation arbeitet ausschliesslich mit dynamischen Elementen.
+
+class SampleElement : public SbxObject
+{
+ // Broadcaster Notification
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SampleElement( const String& );
+};
+
+#endif
diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx
new file mode 100644
index 000000000000..328a085e6c29
--- /dev/null
+++ b/basic/source/inc/disas.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * 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 _DISAS_HXX
+#define _DISAS_HXX
+
+#include "image.hxx"
+#include "opcodes.hxx"
+// find a place for this limit ( also used in
+class SvStream;
+#define MAX_LABELS 0x2000L
+class SbiDisas {
+ const SbiImage& rImg;
+ SbModule* pMod;
+ char cLabels[ MAX_LABELS ]; // Bitvektor fuer Labels
+ UINT32 nOff; // aktuelle Position
+ UINT32 nPC; // Position des Opcodes
+ SbiOpcode eOp; // Opcode
+ UINT32 nOp1, nOp2; // Operanden
+ UINT32 nParts; // 1, 2 oder 3
+ UINT32 nLine; // aktuelle Zeile
+ BOOL DisasLine( String& );
+ BOOL Fetch(); // naechster Opcode
+public:
+ SbiDisas( SbModule*, const SbiImage* );
+ void Disas( SvStream& );
+ void Disas( String& );
+ // NICHT AUFRUFEN
+ void StrOp( String& );
+ void Str2Op( String& );
+ void ImmOp( String& );
+ void OnOp( String& );
+ void LblOp( String& );
+ void ReturnOp( String& );
+ void ResumeOp( String& );
+ void PromptOp( String& );
+ void CloseOp( String& );
+ void CharOp( String& );
+ void VarOp( String& );
+ void VarDefOp( String& );
+ void OffOp( String& );
+ void TypeOp( String& );
+ void CaseOp( String& );
+ void StmntOp( String& );
+ void StrmOp( String& );
+};
+
+#endif
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
new file mode 100644
index 000000000000..b0b3334b5031
--- /dev/null
+++ b/basic/source/inc/dlgcont.hxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * 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_DIALOGCONTAINER_HXX
+#define BASIC_DIALOGCONTAINER_HXX
+
+#include "namecont.hxx"
+
+#ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCESUPPLIER_HPP_
+#include <com/sun/star/resource/XStringResourceSupplier.hpp>
+#endif
+#include "com/sun/star/resource/XStringResourcePersistence.hpp"
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace basic
+{
+
+//============================================================================
+
+class SfxDialogLibraryContainer : public SfxLibraryContainer
+{
+ // Methods to distinguish between different library types
+ virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
+ virtual SfxLibrary* SAL_CALL implCreateLibraryLink
+ ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
+ const ::rtl::OUString& StorageURL, sal_Bool ReadOnly );
+ virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void );
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
+ virtual void SAL_CALL writeLibraryElement
+ (
+ ::com::sun::star::uno::Any aElement,
+ const ::rtl::OUString& aElementName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
+ )
+ throw(::com::sun::star::uno::Exception);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
+ ( const ::rtl::OUString& aFile,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
+
+ virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
+
+ virtual SfxLibraryContainer* createInstanceImpl( void );
+
+ virtual void onNewRootStorage();
+
+ virtual const sal_Char* SAL_CALL getInfoFileName() const;
+ virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
+ virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
+ virtual const sal_Char* SAL_CALL getLibrariesDir() const;
+
+public:
+ SfxDialogLibraryContainer( void );
+ SfxDialogLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+ // Methods XStorageBasedLibraryContainer
+ virtual void SAL_CALL storeLibrariesToStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& RootStorage )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Resource handling
+ ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
+ implCreateStringResource( class SfxDialogLibrary* pDialog );
+
+ // Methods XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Service
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
+ static ::rtl::OUString getImplementationName_static();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
+ ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
+ throw( ::com::sun::star::uno::Exception );
+};
+
+//============================================================================
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::resource::XStringResourceSupplier
+ > SfxDialogLibrary_BASE;
+
+class SfxDialogLibrary :public SfxLibrary
+ ,public SfxDialogLibrary_BASE
+{
+ SfxDialogLibraryContainer* m_pParent;
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::resource::XStringResourcePersistence> m_xStringResourcePersistence;
+ ::rtl::OUString m_aName;
+
+ // Provide modify state including resources
+ virtual sal_Bool isModified( void );
+ virtual void storeResources( void );
+ virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName );
+ virtual void storeResourcesToURL( const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+ virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
+ < ::com::sun::star::embed::XStorage >& xStorage );
+
+public:
+ SfxDialogLibrary
+ (
+ ModifiableHelper& _rModifiable,
+ const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ SfxDialogLibraryContainer* pParent
+ );
+
+ SfxDialogLibrary
+ (
+ ModifiableHelper& _rModifiable,
+ const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly,
+ SfxDialogLibraryContainer* pParent
+ );
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XStringResourceSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >
+ SAL_CALL getStringResource( ) throw (::com::sun::star::uno::RuntimeException);
+
+ ::rtl::OUString getName( void )
+ { return m_aName; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
+ getStringResourcePersistence( void )
+ {
+ return m_xStringResourcePersistence;
+ }
+
+ static bool containsValidDialog( const ::com::sun::star::uno::Any& aElement );
+
+protected:
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
+};
+
+} // namespace basic
+
+#endif
+
diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx
new file mode 100644
index 000000000000..39e6e319caae
--- /dev/null
+++ b/basic/source/inc/errobject.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+*
+* 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 ERROBJECT_HXX
+#define ERROBJECT_HXX
+#include "sbunoobj.hxx"
+#include <ooo/vba/XErrObject.hpp>
+
+
+class SbxErrObject : public SbUnoObject
+{
+ class ErrObject* m_pErrObject;
+ com::sun::star::uno::Reference< ooo::vba::XErrObject > m_xErr;
+
+ SbxErrObject( const String& aName_, const com::sun::star::uno::Any& aUnoObj_ );
+ ~SbxErrObject();
+
+ class ErrObject* getImplErrObject( void )
+ { return m_pErrObject; }
+
+public:
+ static SbxVariableRef getErrObject();
+ static com::sun::star::uno::Reference< ooo::vba::XErrObject > getUnoErrObject();
+
+ void setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
+ throw (com::sun::star::uno::RuntimeException);
+};
+#endif
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
new file mode 100644
index 000000000000..8ccbcebe4309
--- /dev/null
+++ b/basic/source/inc/expr.hxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * 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 _EXPR_HXX
+#define _EXPR_HXX
+
+#include "opcodes.hxx"
+#include "token.hxx"
+
+class SbiExprNode;
+class SbiExpression;
+class SbiExprList;
+class SbiDimList;
+class SbiParameters;
+class SbiParser;
+class SbiCodeGen;
+class SbiSymDef;
+class SbiProcDef;
+
+
+#include <vector>
+typedef ::std::vector<SbiExprList*> SbiExprListVector;
+
+struct SbVar { // Variablen-Element:
+ SbiExprNode* pNext; // Weiteres Element (bei Strukturen)
+ SbiSymDef* pDef; // Symboldefinition
+ SbiExprList* pPar; // optionale Parameter (wird geloescht)
+ SbiExprListVector* pvMorePar; // Array of arrays foo(pPar)(avMorePar[0])(avMorePar[1])...
+};
+
+enum SbiExprType { // Expression-Typen:
+ SbSTDEXPR, // normaler Ausdruck
+ SbLVALUE, // beliebiger lValue
+ SbSYMBOL, // beliebiges zusammengesetztes Symbol
+ SbOPERAND // Variable/Funktion
+};
+
+enum SbiExprMode { // Expression context:
+ EXPRMODE_STANDARD, // default
+ EXPRMODE_STANDALONE, // a param1, param2 OR a( param1, param2 ) = 42
+ EXPRMODE_LPAREN_PENDING, // start of parameter list with bracket, special handling
+ EXPRMODE_LPAREN_NOT_NEEDED, // pending LPAREN has not been used
+ EXPRMODE_ARRAY_OR_OBJECT, // '=' or '(' or '.' found after ')' on ParenLevel 0, stopping
+ // expression, assuming array syntax a(...)[(...)] = ?
+ // or a(...).b(...)
+ EXPRMODE_EMPTY_PAREN // It turned out that the paren don't contain anything: a()
+};
+
+enum SbiNodeType {
+ SbxNUMVAL, // nVal = Wert
+ SbxSTRVAL, // aStrVal = Wert, before #i59791/#i45570: nStringId = Wert
+ SbxVARVAL, // aVar = Wert
+ SbxTYPEOF, // TypeOf ObjExpr Is Type
+ SbxNODE, // Node
+ SbxDUMMY
+};
+
+enum RecursiveMode
+{
+ UNDEFINED,
+ FORCE_CALL,
+ PREVENT_CALL
+};
+
+class SbiExprNode { // Operatoren (und Operanden)
+ friend class SbiExpression;
+ friend class SbiConstExpression;
+ union {
+ USHORT nTypeStrId; // gepoolter String-ID, #i59791/#i45570 Now only for TypeOf
+ double nVal; // numerischer Wert
+ SbVar aVar; // oder Variable
+ };
+ String aStrVal; // #i59791/#i45570 Store string directly
+ SbiExprNode* pLeft; // linker Zweig
+ SbiExprNode* pRight; // rechter Zweig (NULL bei unaeren Ops)
+ SbiExprNode* pWithParent; // Knoten, dessen Member this per with ist
+ SbiCodeGen* pGen; // Code-Generator
+ SbiNodeType eNodeType; // Art des Nodes
+ SbxDataType eType; // aktueller Datentyp
+ SbiToken eTok; // Token des Operators
+ BOOL bComposite; // TRUE: Zusammengesetzter Ausdruck
+ BOOL bError; // TRUE: Fehlerhaft
+ void FoldConstants(); // Constant Folding durchfuehren
+ void CollectBits(); // Umwandeln von Zahlen in Strings
+ BOOL IsOperand() // TRUE, wenn Operand
+ { return BOOL( eNodeType != SbxNODE && eNodeType != SbxTYPEOF ); }
+ BOOL IsTypeOf()
+ { return BOOL( eNodeType == SbxTYPEOF ); }
+ BOOL IsNumber(); // TRUE bei Zahlen
+ BOOL IsString(); // TRUE bei Strings
+ BOOL IsLvalue(); // TRUE, falls als Lvalue verwendbar
+ void GenElement( SbiOpcode ); // Element
+ void BaseInit( SbiParser* p ); // Hilfsfunktion fuer Ctor, AB 17.12.95
+public:
+ SbiExprNode( void );
+ SbiExprNode( SbiParser*, double, SbxDataType );
+ SbiExprNode( SbiParser*, const String& );
+ SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL );
+ SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* );
+ SbiExprNode( SbiParser*, SbiExprNode*, USHORT ); // #120061 TypeOf
+ virtual ~SbiExprNode();
+
+ BOOL IsValid() { return BOOL( !bError ); }
+ BOOL IsConstant() // TRUE bei konstantem Operanden
+ { return BOOL( eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL ); }
+ BOOL IsIntConst(); // TRUE bei Integer-Konstanten
+ BOOL IsVariable(); // TRUE, wenn Variable
+
+ SbiExprNode* GetWithParent() { return pWithParent; }
+ void SetWithParent( SbiExprNode* p ) { pWithParent = p; }
+
+ SbxDataType GetType() { return eType; }
+ void SetType( SbxDataType eTp ) { eType = eTp; }
+ SbiNodeType GetNodeType() { return eNodeType; }
+ SbiSymDef* GetVar(); // Variable (falls vorhanden)
+ SbiSymDef* GetRealVar(); // letzte Variable in x.y.z
+ SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z
+ short GetDepth(); // Tiefe eines Baumes berechnen
+ const String& GetString() { return aStrVal; }
+ short GetNumber() { return (short)nVal; }
+ SbiExprList* GetParameters() { return aVar.pPar; }
+ SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; }
+
+ void Optimize(); // Baumabgleich
+
+ void Gen( RecursiveMode eRecMode = UNDEFINED ); // Ausgabe eines Nodes
+};
+
+class SbiExpression { // der Ausdruck:
+ friend class SbiExprList;
+ friend class SbiParameters;
+ friend class SbiDimList;
+protected:
+ String aArgName; // Name fuer bananntes Argument
+ SbiParser* pParser; // fuer Fehlermeldungen, Parsing
+ SbiExpression* pNext; // Link bei Parameterlisten
+ SbiExprNode* pExpr; // Der Expression-Baum
+ SbiExprType eCurExpr; // Art des Ausdrucks
+ SbiExprMode m_eMode; // Expression context
+ BOOL bBased; // TRUE: einfacher DIM-Teil (+BASE)
+ BOOL bError; // TRUE: Fehler
+ BOOL bByVal; // TRUE: ByVal-Parameter
+ BOOL bBracket; // TRUE: Parameter list with brackets
+ USHORT nParenLevel;
+ SbiExprNode* Term();
+ SbiExprNode* ObjTerm( SbiSymDef& );
+ SbiExprNode* Operand();
+ SbiExprNode* Unary();
+ SbiExprNode* Exp();
+ SbiExprNode* MulDiv();
+ SbiExprNode* IntDiv();
+ SbiExprNode* Mod();
+ SbiExprNode* AddSub();
+ SbiExprNode* Cat();
+ SbiExprNode* Like();
+ SbiExprNode* Comp();
+ SbiExprNode* Boolean();
+public:
+ SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, SbiExprMode eMode = EXPRMODE_STANDARD ); // Parsender Ctor
+ SbiExpression( SbiParser*, const String& );
+ SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE );
+ SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL );
+ SbiExpression( SbiParser*, SbiToken ); // Spezial-Expr mit Spezial-Tokens
+ ~SbiExpression();
+ String& GetName() { return aArgName; }
+ void SetBased() { bBased = TRUE; }
+ BOOL IsBased() { return bBased; }
+ void SetByVal() { bByVal = TRUE; }
+ BOOL IsByVal() { return bByVal; }
+ BOOL IsBracket() { return bBracket; }
+ BOOL IsValid() { return pExpr->IsValid(); }
+ BOOL IsConstant() { return pExpr->IsConstant(); }
+ BOOL IsVariable() { return pExpr->IsVariable(); }
+ BOOL IsLvalue() { return pExpr->IsLvalue(); }
+ BOOL IsIntConstant() { return pExpr->IsIntConst(); }
+ const String& GetString() { return pExpr->GetString(); }
+ SbiSymDef* GetVar() { return pExpr->GetVar(); }
+ SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); }
+ SbiExprNode* GetExprNode() { return pExpr; }
+ SbxDataType GetType() { return pExpr->GetType(); }
+ void SetType( SbxDataType eType){ pExpr->eType = eType; }
+ void Gen( RecursiveMode eRecMode = UNDEFINED ); // Ausgabe eines Nodes
+};
+
+class SbiConstExpression : public SbiExpression {
+ double nVal;
+ String aVal;
+ SbxDataType eType;
+public: // numerische Konstante
+ SbiConstExpression( SbiParser* );
+ SbxDataType GetType() { return eType; }
+ const String& GetString() { return aVal; }
+ double GetValue() { return nVal; }
+ short GetShortValue();
+};
+
+class SbiExprList { // Basisklasse fuer Parameter und Dims
+protected:
+ SbiParser* pParser; // Parser
+ SbiExpression* pFirst; // Expressions
+ SbiProcDef* pProc; // DECLARE-Funktion (Parameter-Anpassung)
+ short nExpr; // Anzahl Expressions
+ short nDim; // Anzahl Dimensionen
+ BOOL bError; // TRUE: Fehler
+ BOOL bBracket; // TRUE: Klammern
+public:
+ SbiExprList( SbiParser* );
+ virtual ~SbiExprList();
+ BOOL IsBracket() { return bBracket; }
+ BOOL IsValid() { return BOOL( !bError ); }
+ short GetSize() { return nExpr; }
+ short GetDims() { return nDim; }
+ SbiExpression* Get( short );
+ BOOL Test( const SbiProcDef& ); // Parameter-Checks
+ void Gen(); // Code-Erzeugung
+ // Setzen einer Funktionsdefinition zum Abgleich der Parameter
+ void SetProc( SbiProcDef* p ) { pProc = p; }
+ void addExpression( SbiExpression* pExpr );
+};
+
+class SbiParameters : public SbiExprList {
+public:
+ SbiParameters( SbiParser*, BOOL bConst = FALSE, BOOL bPar = TRUE);// parsender Ctor
+};
+
+class SbiDimList : public SbiExprList {
+ BOOL bConst; // TRUE: Alles sind Integer-Konstanten
+public:
+ SbiDimList( SbiParser* ); // Parsender Ctor
+ BOOL IsConstant() { return bConst; }
+};
+
+#endif
diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx
new file mode 100644
index 000000000000..dccdec703dd3
--- /dev/null
+++ b/basic/source/inc/filefmt.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * 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_FILEFMT_HXX
+#define _SB_FILEFMT_HXX
+
+#include <tools/solar.h>
+
+class SvStream;
+
+// Version 2: Datentyp des Returnwerts fuer Publics
+// Version 3: neue Opcodes
+// Version 4: neue Opcodes
+// Version 5: Bug (Ansprung von STATIC-Variablen im Init-Code)
+// Version 6: Neue Opcodes und Bug (Globals anlegen, ohne BASIC zu beenden)
+// Version 7: Korrektur im WITH-Parsing
+// Version 8: Korrektur im IF-Parsing
+// Version 9: Init-Code auch mit LEAVE beenden, wenn keine SUB/FUNCTION folgt
+// Version A: #36374 Bei DIM AS NEW... auch Variablen anlegen
+// Version B: #40689 Static umgestellt
+// Version C: #41606 Bug bei Static
+// Version D: #42678 Bug bei RTL-Function spc
+// Version E: #56204 DCREATE, um auch bei DIM AS NEW Arrays anzulegen
+// Version F: #57844 Einfuehrung von SvNumberformat::StringToDouble
+// Version 10: #29955 For-Schleifen-Level in Statement-PCodes generieren
+// Version 11: #29955 Wegen Build-Inkonsistenzen Neu-Compilieren erzwingen
+
+#define B_LEGACYVERSION 0x00000011L
+#define B_CURVERSION 0x00000012L
+#define B_EXT_IMG_VERSION 0x00000012L
+
+// Eine Datei enthaelt entweder einen Modul- oder einen Library-Record.
+// Diese Records enthalten wiederum weitere Records. Jeder Record hat
+// den folgenden Header:
+
+// UINT16 Kennung
+// UINT32 Laenge des Records ohne Header
+// UINT16 Anzahl Unterelemente
+
+// Alle Datei-Offsets in Records sind relativ zum Start des Moduls!
+
+#define B_LIBRARY 0x4C42 // BL Library Record
+#define B_MODULE 0x4D42 // BM Module Record
+#define B_NAME 0x4E4D // MN module name
+#define B_COMMENT 0x434D // MC comment
+#define B_SOURCE 0x4353 // SC source code
+#define B_PCODE 0x4350 // PC p-code
+#define B_OLDPUBLICS 0x7550 // Pu publics
+#define B_PUBLICS 0x5550 // PU publics
+#define B_POOLDIR 0x4450 // PD symbol pool directory
+#define B_SYMPOOL 0x5953 // SY symbol pool
+#define B_STRINGPOOL 0x5453 // ST symbol pool
+#define B_LINERANGES 0x524C // LR line ranges for publics
+#define B_MODEND 0x454D // ME module end
+#define B_SBXOBJECTS 0x5853 // SX SBX objects
+
+#define EXTENDED_BINARY_MODULES
+#ifdef EXTENDED_BINARY_MODULES
+#define B_EXTSOURCE 0x5345 // ES extended source
+#endif
+
+// Ein Library Record enthaelt nur Module Records
+// UINT16 Kennung BL
+// UINT32 Laenge des Records
+// UINT16 Anzahl Module
+
+// Ein Modul-Record enthaelt alle anderen Recordtypen
+// UINT16 Kennung BM
+// UINT32 Laenge des Records
+// UINT16 1
+// Daten:
+// UINT32 Versionsnummer
+// UINT32 Zeichensatz
+// UINT32 Startadresse Initialisierungscode
+// UINT32 Startadresse Sub Main
+// UINT32 Reserviert
+// UINT32 Reserviert
+
+// Modulname, Kommentar und Quellcode:
+// UINT16 Kennung MN, MC oder SC
+// UINT32 Laenge des Records
+// UINT16 1
+// Daten:
+// String-Instanz
+
+// P-Code:
+// UINT16 Kennung PC
+// UINT32 Laenge des Records
+// UINT16 1
+// Daten:
+// Der P-Code als Bytesack
+
+// Alle Symbole und Strings werden in einem String-Pool gehalten.
+// Verweise auf diese Strings sind in Form eines Indexes in diesen Pool.
+
+// Liste aller Publics:
+// UINT16 Kennung PU oder Pu
+// UINT32 Laenge des Records
+// UINT16 Anzahl der Publics
+// Daten fuer jeden Public-Eintrag:
+// UINT16 String-Index
+// UINT32 Startadresse im P-Code-Image (UINT16 fuer alte Publics)
+// UINT16 Datentyp des Returnwertes (ab Version 2)
+
+// Verzeichnis der Symbol-Tabellen:
+// UINT16 Kennung SP
+// UINT32 Laenge des Records
+// UINT16 Anzahl der Symboltabellen
+// Daten fuer jede Symboltabelle:
+// UINT16 Stringindex des Namens
+// UINT16 Anzahl Symbole
+// UINT16 Scope-Kennung
+
+// Symboltabelle:
+// UINT16 Kennung SY
+// UINT32 Laenge des Records
+// UINT16 Anzahl der Symbole
+// Daten:
+// UINT16 Stringindex des Namens
+// UINT16 Anzahl Symbole
+// Daten fuer jedes Symbol:
+// UINT16 Stringindex des Namens
+// UINT16 Datentyp
+// UINT16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable)
+
+// Stringpool:
+// UINT16 Kennung ST
+// UINT32 Laenge des Records
+// UINT16 Anzahl der Strings
+// Daten fuer jeden String:
+// UINT32 Offset in den Block aller Strings
+// Danach folgt der Block aller Strings, die dort als ASCIIZ-Strings liegen.
+
+// Line Ranges:
+// UINT16 Kennung LR
+// UINT32 Laenge des Records
+// UINT16 Anzahl der Strings
+// Daten fuer jedes Public:
+// UINT16 1. Zeile (Sub XXX)
+// UINT16 2. Zeile (End Sub)
+
+// SBX-Objekte:
+// UINT16 Anzahl Objekte
+// .... Objektdaten
+
+////////////////////////////////////////////////////////////////////////////
+
+// Service-Routinen (in IMAGE.CXX)
+
+BOOL SbGood( SvStream& r );
+ULONG SbOpenRecord( SvStream&, UINT16 nSignature, UINT16 nElem );
+void SbCloseRecord( SvStream&, ULONG );
+
+#endif
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
new file mode 100644
index 000000000000..d674b91faf71
--- /dev/null
+++ b/basic/source/inc/image.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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 _SBIMAGE_HXX
+#define _SBIMAGE_HXX
+
+#include "sbintern.hxx"
+#ifndef _RTL_USTRING_HXX
+#include <rtl/ustring.hxx>
+#endif
+#include <filefmt.hxx>
+
+// Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet
+// den Zugriff auf die einzelnen Elemente.
+
+struct SbPublicEntry;
+
+class SbiImage {
+ friend class SbiCodeGen; // Compiler-Klassen, die die private-
+
+ SbxArrayRef rTypes; // User defined types
+ SbxArrayRef rEnums; // Enum types
+ UINT32* pStringOff; // StringId-Offsets
+ sal_Unicode* pStrings; // StringPool
+ char* pCode; // Code-Image
+ char* pLegacyPCode; // Code-Image
+ BOOL bError; // TRUE: Fehler
+ USHORT nFlags; // Flags (s.u.)
+ short nStrings; // Anzahl Strings
+ UINT32 nStringSize; // Groesse des String-Puffers
+ UINT32 nCodeSize; // Groesse des Code-Blocks
+ UINT16 nLegacyCodeSize; // Groesse des Code-Blocks
+ UINT16 nDimBase; // OPTION BASE-Wert
+ rtl_TextEncoding eCharSet; // Zeichensatz fuer Strings
+ // temporaere Verwaltungs-Variable:
+ short nStringIdx; // aktueller String-Index
+ UINT32 nStringOff; // aktuelle Pos im Stringpuffer
+ // Routinen fuer Compiler:
+ void MakeStrings( short ); // StringPool einrichten
+ void AddString( const String& );// String zufuegen
+ void AddCode( char*, UINT32 ); // Codeblock dazu
+ void AddType(SbxObject *); // User-Type mit aufnehmen
+ void AddEnum(SbxObject *); // Register enum type
+
+public:
+ String aName; // Makroname
+ ::rtl::OUString aOUSource; // Quellcode
+ String aComment; // Kommentar
+ BOOL bInit; // TRUE: Init-Code ist gelaufen
+ BOOL bFirstInit; // TRUE, wenn das Image das erste mal nach
+ // dem Compilieren initialisiert wird.
+ SbiImage();
+ ~SbiImage();
+ void Clear(); // Inhalt loeschen
+ BOOL Load( SvStream&, UINT32& nVer ); // Loads image from stream
+ // nVer is set to version
+ // of image
+ BOOL Load( SvStream& );
+ BOOL Save( SvStream&, UINT32 = B_CURVERSION );
+ BOOL IsError() { return bError; }
+
+ const char* GetCode() const { return pCode; }
+ UINT32 GetCodeSize() const { return nCodeSize; }
+ ::rtl::OUString& GetSource32() { return aOUSource; }
+ USHORT GetBase() const { return nDimBase; }
+ String GetString( short nId ) const;
+ //const char* GetString( short nId ) const;
+ const SbxObject* FindType (String aTypeName) const;
+
+ SbxArrayRef GetEnums() { return rEnums; }
+
+ void SetFlag( USHORT n ) { nFlags |= n; }
+ USHORT GetFlag( USHORT n ) const { return nFlags & n; }
+ UINT16 CalcLegacyOffset( INT32 nOffset );
+ UINT32 CalcNewOffset( INT16 nOffset );
+ void ReleaseLegacyBuffer();
+ BOOL ExceedsLegacyLimits();
+
+};
+
+#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT ist aktiv
+#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv
+#define SBIMG_INITCODE 0x0004 // Init-Code vorhanden
+#define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
+
+#endif
diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx
new file mode 100644
index 000000000000..b0ebcb0e87f0
--- /dev/null
+++ b/basic/source/inc/iosys.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * 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 _SBIOSYS_HXX
+#define _SBIOSYS_HXX
+
+#include <tools/stream.hxx>
+#ifndef _SBERRORS_HXX
+#include <basic/sberrors.hxx>
+#endif
+
+class SvStream;
+
+// Zur Zeit sind globale Dateien (Kanalnummern 256 bis 511)
+// nicht implementiert.
+
+#define CHANNELS 256
+#define CONSOLE 0
+
+#define SBSTRM_INPUT 0x0001 // Input
+#define SBSTRM_OUTPUT 0x0002 // Output
+#define SBSTRM_RANDOM 0x0004 // Random
+#define SBSTRM_APPEND 0x0008 // Append
+#define SBSTRM_BINARY 0x0010 // Binary
+
+class SbiStream {
+ SvStream* pStrm; // der Stream
+ ULONG nExpandOnWriteTo; // bei Schreibzugriff, den Stream
+ // bis zu dieser Groesse aufblasen
+ ByteString aLine; // aktuelle Zeile
+ ULONG nLine; // aktuelle Zeilennummer
+ short nLen; // Pufferlaenge
+ short nMode; // Bits:
+ short nChan; // aktueller Kanal
+ SbError nError; // letzter Fehlercode
+ void MapError(); // Fehlercode mappen
+
+public:
+ SbiStream();
+ ~SbiStream();
+ SbError Open( short, const ByteString&, short, short, short );
+ SbError Close();
+ SbError Read( ByteString&, USHORT = 0, bool bForceReadingPerByte=false );
+ SbError Read( char& );
+ SbError Write( const ByteString&, USHORT = 0 );
+
+ bool IsText() const { return (nMode & SBSTRM_BINARY) == 0; }
+ bool IsRandom() const { return (nMode & SBSTRM_RANDOM) != 0; }
+ bool IsBinary() const { return (nMode & SBSTRM_BINARY) != 0; }
+ bool IsSeq() const { return (nMode & SBSTRM_RANDOM) == 0; }
+ bool IsAppend() const { return (nMode & SBSTRM_APPEND) != 0; }
+ short GetBlockLen() const { return nLen; }
+ short GetMode() const { return nMode; }
+ ULONG GetLine() const { return nLine; }
+ void SetExpandOnWriteTo( ULONG n ) { nExpandOnWriteTo = n; }
+ void ExpandFile();
+ SvStream* GetStrm() { return pStrm; }
+};
+
+class SbiIoSystem {
+ SbiStream* pChan[ CHANNELS ];
+ ByteString aPrompt; // Input-Prompt
+ ByteString aIn, aOut; // Console-Buffer
+ short nChan; // aktueller Kanal
+ SbError nError; // letzter Fehlercode
+ void ReadCon( ByteString& );
+ void WriteCon( const ByteString& );
+public:
+ SbiIoSystem();
+ ~SbiIoSystem();
+ SbError GetError();
+ void Shutdown();
+ void SetPrompt( const ByteString& r ) { aPrompt = r; }
+ void SetChannel( short n ) { nChan = n; }
+ short GetChannel() const { return nChan;}
+ void ResetChannel() { nChan = 0; }
+ void Open( short, const ByteString&, short, short, short );
+ void Close();
+ void Read( ByteString&, short = 0 );
+ char Read();
+ void Write( const ByteString&, short = 0 );
+ short NextChannel();
+ // 0 == bad channel or no SvStream (nChannel=0..CHANNELS-1)
+ SbiStream* GetStream( short nChannel ) const;
+ void CloseAll(); // JSM
+};
+
+#endif
+
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
new file mode 100644
index 000000000000..1f4084db1d0d
--- /dev/null
+++ b/basic/source/inc/namecont.hxx
@@ -0,0 +1,743 @@
+/*************************************************************************
+ *
+ * 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_NAMECONTAINER_HXX
+#define BASIC_NAMECONTAINER_HXX
+
+#include <hash_map>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
+#include <com/sun/star/script/XLibraryContainerPassword.hpp>
+#include <com/sun/star/script/XLibraryContainerExport.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <osl/mutex.hxx>
+#include <unotools/eventlisteneradapter.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <sot/storage.hxx>
+#include <xmlscript/xmllib_imexp.hxx>
+#include <com/sun/star/deployment/XPackage.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/compbase6.hxx>
+#include <cppuhelper/compbase7.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/script/XVBACompat.hpp>
+
+class BasicManager;
+
+namespace basic
+{
+
+typedef ::cppu::WeakComponentImplHelper7<
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::script::XStorageBasedLibraryContainer,
+ ::com::sun::star::script::XLibraryContainerPassword,
+ ::com::sun::star::script::XLibraryContainerExport,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XVBACompat,
+ ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
+
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::container::XContainer > NameContainerHelper;
+
+
+struct hashName_Impl
+{
+ size_t operator()(const ::rtl::OUString Str) const
+ {
+ return (size_t)Str.hashCode();
+ }
+};
+
+struct eqName_Impl
+{
+ sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
+ {
+ return ( Str1 == Str2 );
+ }
+};
+
+typedef std::hash_map
+<
+ ::rtl::OUString,
+ sal_Int32,
+ hashName_Impl,
+ eqName_Impl
+>
+NameContainerNameMap;
+
+
+//============================================================================
+
+class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
+{
+ NameContainerNameMap mHashMap;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > mNames;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
+ sal_Int32 mnElementCount;
+
+ ::com::sun::star::uno::Type mType;
+ ::com::sun::star::uno::XInterface* mpxEventSource;
+
+ ::cppu::OInterfaceContainerHelper maListenerContainer;
+
+public:
+ NameContainer( const ::com::sun::star::uno::Type& rType )
+ : mnElementCount( 0 )
+ , mType( rType )
+ , mpxEventSource( NULL )
+ , maListenerContainer( m_aMutex )
+ {}
+
+ void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource )
+ { mpxEventSource = pxEventSource; }
+
+ // Methods XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+//============================================================================
+
+class SfxLibrary;
+
+enum InitMode
+{
+ DEFAULT,
+ CONTAINER_INIT_FILE,
+ LIBRARY_INIT_FILE,
+ OFFICE_DOCUMENT,
+ OLD_BASIC_STORAGE
+};
+
+class ModifiableHelper
+{
+private:
+ ::cppu::OInterfaceContainerHelper m_aModifyListeners;
+ ::cppu::OWeakObject& m_rEventSource;
+ sal_Bool mbModified;
+
+public:
+ ModifiableHelper( ::cppu::OWeakObject& _rEventSource, ::osl::Mutex& _rMutex )
+ :m_aModifyListeners( _rMutex )
+ ,m_rEventSource( _rEventSource )
+ ,mbModified( sal_False )
+ {
+ }
+
+ inline sal_Bool isModified() const { return mbModified; }
+ void setModified( sal_Bool _bModified );
+
+ inline void addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener )
+ {
+ m_aModifyListeners.addInterface( _rxListener );
+ }
+
+ inline void removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener )
+ {
+ m_aModifyListeners.removeInterface( _rxListener );
+ }
+};
+
+class SfxLibraryContainer :public LibraryContainerHelper
+ ,public ::utl::OEventListenerAdapter
+{
+ sal_Bool mbVBACompat;
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XMacroExpander > mxMacroExpander;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubstitution;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > mxOwnerDocument;
+
+ ::osl::Mutex maMutex;
+ ModifiableHelper maModifiable;
+
+ NameContainer maNameContainer;
+ sal_Bool mbOldInfoFormat;
+ sal_Bool mbOasis2OOoFormat;
+
+ ::rtl::OUString maInitialDocumentURL;
+ ::rtl::OUString maInfoFileName;
+ ::rtl::OUString maOldInfoFileName;
+ ::rtl::OUString maLibElementFileExtension;
+ ::rtl::OUString maLibraryPath;
+ ::rtl::OUString maLibrariesDir;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > mxStorage;
+ BasicManager* mpBasMgr;
+ sal_Bool mbOwnBasMgr;
+
+ InitMode meInitMode;
+
+ void implStoreLibrary( SfxLibrary* pLib,
+ const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+ // New variant for library export
+ void implStoreLibrary( SfxLibrary* pLib,
+ const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::rtl::OUString& aTargetURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+
+ void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+ // New variant for library export
+ void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::rtl::OUString& aTargetURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI );
+
+ sal_Bool implLoadLibraryIndexFile( SfxLibrary* pLib,
+ ::xmlscript::LibDescriptor& rLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::rtl::OUString& aIndexFileName );
+
+ void implImportLibDescriptor( SfxLibrary* pLib, ::xmlscript::LibDescriptor& rLib );
+
+ // Methods to distinguish between deffirent library types
+ virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ) = 0;
+ virtual SfxLibrary* SAL_CALL implCreateLibraryLink
+ ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
+ const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) = 0;
+ virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0;
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
+ virtual void SAL_CALL writeLibraryElement
+ (
+ ::com::sun::star::uno::Any aElement,
+ const ::rtl::OUString& aElementName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
+ )
+ throw(::com::sun::star::uno::Exception) = 0;
+
+ virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
+ ( const ::rtl::OUString& aFile,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0;
+ virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0;
+
+ // Password encryption
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
+
+ // New variant for library export
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::rtl::OUString& aTargetURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
+
+ virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
+ sal_Bool bVerifyPasswordOnly=false )
+ throw(::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void onNewRootStorage() = 0;
+
+
+ // #56666, Creates another library container
+ // instance of the same derived class
+ virtual SfxLibraryContainer* createInstanceImpl( void ) = 0;
+
+
+ // Interface to get the BasicManager (Hack for password implementation)
+ BasicManager* getBasicManager( void );
+ ::rtl::OUString createAppLibraryFolder( SfxLibrary* pLib, const ::rtl::OUString& aName );
+
+ sal_Bool init( const ::rtl::OUString& rInitialDocumentURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxInitialStorage );
+
+ virtual const sal_Char* SAL_CALL getInfoFileName() const = 0;
+ virtual const sal_Char* SAL_CALL getOldInfoFileName() const = 0;
+ virtual const sal_Char* SAL_CALL getLibElementFileExtension() const = 0;
+ virtual const sal_Char* SAL_CALL getLibrariesDir() const = 0;
+
+ // Handle maLibInfoFileURL and maStorageURL correctly
+ void checkStorageURL
+ (
+ const ::rtl::OUString& aSourceURL,
+ ::rtl::OUString& aLibInfoFileURL,
+ ::rtl::OUString& aStorageURL,
+ ::rtl::OUString& aUnexpandedStorageURL
+ );
+ ::rtl::OUString expand_url( const ::rtl::OUString& url )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ SfxLibrary* getImplLib( const String& rLibraryName );
+
+ void storeLibraries_Impl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ sal_Bool bComplete );
+
+ void SAL_CALL initializeFromDocumentURL( const ::rtl::OUString& _rInitialDocumentURL );
+ void SAL_CALL initializeFromDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& _rxDocument );
+
+ // OEventListenerAdapter
+ virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+private:
+ sal_Bool init_Impl( const ::rtl::OUString& rInitialDocumentURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxInitialStorage );
+ void implScanExtensions( void );
+
+public:
+ SfxLibraryContainer( void );
+ ~SfxLibraryContainer();
+
+
+ // Interface to set the BasicManager (Hack for password implementation)
+ void setBasicManager( BasicManager* pBasMgr )
+ {
+ mpBasMgr = pBasMgr;
+ }
+
+ void enterMethod();
+ void leaveMethod();
+ bool isDisposed() const { return rBHelper.bInDispose || rBHelper.bDisposed; }
+ void checkDisposed() const;
+
+ // Methods XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Members XStorageBasedLibraryContainer
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL getRootStorage() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRootStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rootstorage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL storeLibrariesToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& RootStorage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // Methods XModifiable (base of XPersistentLibraryContainer)
+ virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // Methods XPersistentLibraryContainer (base of XStorageBasedLibraryContainer)
+ virtual ::com::sun::star::uno::Any SAL_CALL getRootLocation() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
+ virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XLibraryContainer (base of XLibraryContainer2)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL
+ createLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL createLibraryLink
+ ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XLibraryContainerPassword
+ virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
+ const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Methods XLibraryContainerExport
+ virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+ // Methods XVBACompat
+ virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+class LibraryContainerMethodGuard
+{
+private:
+ SfxLibraryContainer& m_rContainer;
+public:
+ LibraryContainerMethodGuard( SfxLibraryContainer& _rContainer )
+ :m_rContainer( _rContainer )
+ {
+ m_rContainer.enterMethod();
+ }
+
+ ~LibraryContainerMethodGuard()
+ {
+ m_rContainer.leaveMethod();
+ }
+};
+
+
+//============================================================================
+
+class SfxLibrary
+ : public ::com::sun::star::container::XNameContainer
+ , public ::com::sun::star::container::XContainer
+ , public ::cppu::BaseMutex
+ , public ::cppu::OComponentHelper
+{
+ friend class SfxLibraryContainer;
+ friend class SfxDialogLibraryContainer;
+ friend class SfxScriptLibraryContainer;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
+
+ ModifiableHelper& mrModifiable;
+ NameContainer maNameContainer;
+
+ sal_Bool mbLoaded;
+ sal_Bool mbIsModified;
+ sal_Bool mbInitialised;
+
+private:
+
+ ::rtl::OUString maLibElementFileExtension;
+ ::rtl::OUString maLibInfoFileURL;
+ ::rtl::OUString maStorageURL;
+ ::rtl::OUString maUnexpandedStorageURL;
+ sal_Bool mbLink;
+ sal_Bool mbReadOnly;
+ sal_Bool mbReadOnlyLink;
+ sal_Bool mbPreload;
+
+ sal_Bool mbPasswordProtected;
+ sal_Bool mbPasswordVerified;
+ sal_Bool mbDoc50Password;
+ ::rtl::OUString maPassword;
+
+ sal_Bool mbSharedIndexFile;
+ sal_Bool mbExtension;
+
+ // Additional functionality for localisation
+ // Provide modify state including resources
+ virtual sal_Bool isModified( void ) = 0;
+ virtual void storeResources( void ) = 0;
+ virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName ) = 0;
+ virtual void storeResourcesToURL( const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) = 0;
+ virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
+ < ::com::sun::star::embed::XStorage >& xStorage ) = 0;
+
+protected:
+ inline sal_Bool implIsModified() const { return mbIsModified; }
+ void implSetModified( sal_Bool _bIsModified );
+
+private:
+ /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
+ */
+ void impl_checkReadOnly();
+ /** checks whether the library is loaded, throws a LibraryNotLoadedException (wrapped in a WrappedTargetException),
+ if not.
+ */
+ void impl_checkLoaded();
+
+private:
+ void impl_removeWithoutChecks( const ::rtl::OUString& _rElementName );
+
+public:
+ SfxLibrary(
+ ModifiableHelper& _rModifiable,
+ const ::com::sun::star::uno::Type& aType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
+ );
+ SfxLibrary(
+ ModifiableHelper& _rModifiable,
+ const ::com::sun::star::uno::Type& aType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::rtl::OUString& aLibInfoFileURL,
+ const ::rtl::OUString&
+ aStorageURL,
+ sal_Bool ReadOnly
+ );
+
+ // Methods XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); }
+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); }
+
+ // Methods XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
+ throw( ::com::sun::star::uno::RuntimeException );
+ ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // Methods XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+public:
+ struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } };
+ void removeElementWithoutChecks( const ::rtl::OUString& _rElementName, LibraryContainerAccess )
+ {
+ impl_removeWithoutChecks( _rElementName );
+ }
+
+protected:
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
+};
+
+//===================================================================
+class ScriptSubPackageIterator
+{
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > m_xMainPackage;
+
+ bool m_bIsValid;
+ bool m_bIsBundle;
+
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > > m_aSubPkgSeq;
+ sal_Int32 m_nSubPkgCount;
+ sal_Int32 m_iNextSubPkg;
+
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
+ implDetectScriptPackage( const com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > xPackage, bool& rbPureDialogLib );
+
+public:
+ ScriptSubPackageIterator( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xMainPackage );
+
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > getNextScriptSubPackage( bool& rbPureDialogLib );
+};
+
+enum IteratorState
+{
+ USER_EXTENSIONS,
+ SHARED_EXTENSIONS,
+ END_REACHED
+};
+
+class ScriptExtensionIterator
+{
+public:
+ ScriptExtensionIterator( void );
+ rtl::OUString nextBasicOrDialogLibrary( bool& rbPureDialogLib );
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetScriptPackageFromPackage
+ ( const com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage,
+ bool& rbPureDialogLib );
+
+protected:
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
+ implGetNextUserScriptPackage( bool& rbPureDialogLib );
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
+ implGetNextSharedScriptPackage( bool& rbPureDialogLib );
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
+
+ IteratorState m_eState;
+
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > > m_aUserPackagesSeq;
+ bool m_bUserPackagesLoaded;
+
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
+ bool m_bSharedPackagesLoaded;
+
+ int m_iUserPackage;
+ int m_iSharedPackage;
+
+ ScriptSubPackageIterator* m_pScriptSubPackageIterator;
+
+}; // end class ScriptExtensionIterator
+
+
+
+} // namespace basic
+
+#endif
+
diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx
new file mode 100644
index 000000000000..29e4f68cc133
--- /dev/null
+++ b/basic/source/inc/object.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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 _SAMPLE_OBJECT_HXX
+#define _SAMPLE_OBJECT_HXX
+
+#include <basic/sbxfac.hxx>
+#ifndef __SBX_SBXVARIABLE_HXX //autogen
+#include <basic/sbxvar.hxx>
+#endif
+#include <basic/sbxobj.hxx>
+
+// 1) Properties:
+// Name der Name, R/O
+// Value ein double-Wert, R/W
+// 2) Methoden:
+// Display Ausgabe eines Textes
+// Square Argument * Argument
+// Event Aufruf eines Basic-Programms
+// 3) Unterobjekte:
+// eine Collection names "Elements". Der Zugriff ist sowohl als
+// Property (fuer das gesamte Objekt) als auch als Methode (fuer
+// einzelne Elemente, wird durchgereicht) implementiert.
+// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte
+// Version, die sehr viele Elemente enthalten kann.
+// Die Collection findet sich in COLLECTN.*, die in der Collection
+// enthaltenen Objekte in COLLELEM.*
+
+class SampleObject : public SbxObject
+{
+using SbxVariable::GetInfo;
+ // Definition eines Tabelleneintrags. Dies wird hier gemacht,
+ // da dadurch die Methoden und Properties als private deklariert
+ // werden koennen.
+#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) || defined ( C52 )
+public:
+#endif
+ typedef void( SampleObject::*pMeth )
+ ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite );
+#if defined ( ICC ) || defined ( HPUX )
+private:
+#endif
+
+ struct Methods {
+ const char* pName; // Name des Eintrags
+ SbxDataType eType; // Datentyp
+ pMeth pFunc; // Function Pointer
+ short nArgs; // Argumente und Flags
+ };
+ static Methods aMethods[]; // Methodentabelle
+
+ // Methoden
+ void Display( SbxVariable*, SbxArray*, BOOL );
+ void Event( SbxVariable*, SbxArray*, BOOL );
+ void Square( SbxVariable*, SbxArray*, BOOL );
+ void Create( SbxVariable*, SbxArray*, BOOL );
+ // Infoblock auffuellen
+ SbxInfo* GetInfo( short nIdx );
+ // Broadcaster Notification
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SampleObject( const String& );
+ // Suchen eines Elements
+ virtual SbxVariable* Find( const String&, SbxClassType );
+};
+
+// Die dazugehoerige Factory:
+
+class SampleObjectFac : public SbxFactory
+{
+public:
+ virtual SbxObject* CreateObject( const String& );
+};
+
+#endif
diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx
new file mode 100644
index 000000000000..9d909c03c436
--- /dev/null
+++ b/basic/source/inc/opcodes.hxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * 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 _OPCODES_HXX
+#define _OPCODES_HXX
+
+#include "sbintern.hxx"
+
+#ifdef MTW
+#undef _NUMBER
+#endif
+
+// Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen
+// Wert des Opcodes (s.u.).
+
+enum SbiOpcode {
+ // Alle Opcodes ohne Operanden
+ _NOP = 0,
+
+ SbOP0_START = _NOP,
+
+ // Operatoren
+ // die folgenden Operatoren sind genauso angeordnet
+ // wie der enum SbxVarOp
+ _EXP, _MUL, _DIV, _MOD, _PLUS, _MINUS, _NEG,
+ _EQ, _NE, _LT, _GT, _LE, _GE,
+ _IDIV, _AND, _OR, _XOR, _EQV, _IMP, _NOT,
+ _CAT,
+ // Ende enum SbxVarOp
+ _LIKE, _IS,
+ // Laden/speichern
+ _ARGC, // neuen Argv einrichten
+ _ARGV, // TOS ==> aktueller Argv
+ _INPUT, // Input ==> TOS
+ _LINPUT, // Line Input ==> TOS
+ _GET, // TOS anfassen
+ _SET, // Speichern Objekt TOS ==> TOS-1
+ _PUT, // TOS ==> TOS-1
+ _PUTC, // TOS ==> TOS-1, dann ReadOnly
+ _DIM, // DIM
+ _REDIM, // REDIM
+ _REDIMP, // REDIM PRESERVE
+ _ERASE, // TOS loeschen
+ // Verzweigen
+ _STOP, // Programmende
+ _INITFOR, // FOR-Variable initialisieren
+ _NEXT, // FOR-Variable inkrementieren
+ _CASE, // Anfang CASE
+ _ENDCASE, // Ende CASE
+ _STDERROR, // Standard-Fehlerbehandlung
+ _NOERROR, // keine Fehlerbehandlung
+ _LEAVE, // UP verlassen
+ // E/A
+ _CHANNEL, // TOS = Kanalnummer
+ _BPRINT, // print TOS
+ _PRINTF, // print TOS in field
+ _BWRITE, // write TOS
+ _RENAME, // Rename Tos+1 to Tos
+ _PROMPT, // TOS = Prompt for Input
+ _RESTART, // Restartpunkt definieren
+ _CHAN0, // I/O-Kanal 0
+ // Sonstiges
+ _EMPTY, // Leeren Ausdruck auf Stack
+ _ERROR, // TOS = Fehlercode
+ _LSET, // Speichern Objekt TOS ==> TOS-1
+ _RSET, // Speichern Objekt TOS ==> TOS-1
+ _REDIMP_ERASE, // Copies array to be later used by REDIM PRESERVE before erasing it
+ _INITFOREACH,
+ _VBASET, // VBA-like Set
+ _ERASE_CLEAR, // Erase array and clear variable
+ _ARRAYACCESS, // Assign parameters to TOS and get value, used for array of arrays
+ SbOP0_END,
+
+ // Alle Opcodes mit einem Operanden
+
+ _NUMBER = 0x40, // Laden einer numerischen Konstanten (+ID)
+
+ SbOP1_START = _NUMBER,
+
+ _SCONST, // Laden einer Stringkonstanten (+ID)
+ _CONST, // Immediate Load (+Wert)
+ _ARGN, // Speichern eines named Args in Argv (+StringID)
+ _PAD, // String auf feste Laenge bringen (+Laenge)
+ // Verzweigungen
+ _JUMP, // Sprung (+Target)
+ _JUMPT, // TOS auswerten, bedingter Sprung (+Target)
+ _JUMPF, // TOS auswerten, bedingter Sprung (+Target)
+ _ONJUMP, // TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal)
+ _GOSUB, // UP-Aufruf (+Target)
+ _RETURN, // UP-Return (+0 oder Target)
+ _TESTFOR, // FOR-Variable testen, inkrementieren (+Endlabel)
+ _CASETO, // Tos+1 <= Case <= Tos, 2xremove (+Target)
+ _ERRHDL, // Fehler-Handler (+Offset)
+ _RESUME, // Resume nach Fehlern (+0 or 1 or Label)
+ // E/A
+ _CLOSE, // (+Kanal/0)
+ _PRCHAR, // (+char)
+ // Verwaltung
+ _SETCLASS, // Set + Klassennamen testen (+StringId)
+ _TESTCLASS, // Check TOS class (+StringId)
+ _LIB, // Libnamen fuer Declare-Procs setzen (+StringId)
+ _BASED, // TOS wird um BASE erhoeht, BASE davor gepusht (+base)
+ // Typanpassung im Argv
+ _ARGTYP, // Letzten Parameter in Argv konvertieren (+Typ)
+ _VBASETCLASS, // VBA-like Set
+ SbOP1_END,
+
+ // Alle Opcodes mit zwei Operanden
+
+ _RTL = 0x80, // Laden aus RTL (+StringID+Typ)
+
+ SbOP2_START = _RTL,
+
+ _FIND, // Laden (+StringID+Typ)
+ _ELEM, // Laden Element (+StringID+Typ)
+ _PARAM, // Parameter (+Offset+Typ)
+ // Verzweigen
+ _CALL, // DECLARE-Methode rufen (+StringID+Typ)
+ _CALLC, // Cdecl-DECLARE-Methode rufen (+StringID+Typ)
+ _CASEIS, // Case-Test (+Test-Opcode+True-Target)
+ // Verwaltung
+ _STMNT, // Beginn eines Statements (+Line+Col)
+ // E/A
+ _OPEN, // (+SvStreamFlags+Flags)
+ // Objekte
+ _LOCAL, // Lokale Variable definieren (+StringID+Typ)
+ _PUBLIC, // Modulglobale Variable (+StringID+Typ)
+ _GLOBAL, // Globale Variable definieren, public-Anweisung (+StringID+Typ)
+ _CREATE, // Objekt kreieren (+StringId+StringID)
+ _STATIC, // Statische Variabl (+StringID+Typ) JSM
+ _TCREATE, // User Defined Objekt kreieren
+ _DCREATE, // Objekt-Array kreieren (+StringId+StringID)
+ _GLOBAL_P, // Globale Variable definieren, die beim Neustart von Basic
+ // nicht ueberschrieben wird, P=PERSIST (+StringID+Typ)
+ _FIND_G, // Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P
+ _DCREATE_REDIMP, // Objekt-Array redimensionieren (+StringId+StringID)
+ _FIND_CM, // Search inside a class module (CM) to enable global search in time
+ _PUBLIC_P, // Module global Variable (persisted between calls)(+StringID+Typ)
+ _FIND_STATIC, // local static var lookup (+StringID+Typ)
+
+ SbOP2_END
+
+};
+
+
+
+#endif
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
new file mode 100644
index 000000000000..3dc8525377a2
--- /dev/null
+++ b/basic/source/inc/parser.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * 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 _PARSER_HXX
+#define _PARSER_HXX
+
+#include "expr.hxx"
+#include "codegen.hxx"
+#include "symtbl.hxx"
+
+
+#include <vector>
+typedef ::std::vector< String > IfaceVector;
+
+struct SbiParseStack;
+
+class SbiParser : public SbiTokenizer
+{
+ friend class SbiExpression;
+
+ SbiParseStack* pStack; // Block-Stack
+ SbiProcDef* pProc; // aktuelle Prozedur
+ SbiExprNode* pWithVar; // aktuelle With-Variable
+ SbiToken eEndTok; // das Ende-Token
+ UINT32 nGblChain; // Chainkette fuer globale DIMs
+ BOOL bGblDefs; // TRUE globale Definitionen allgemein
+ BOOL bNewGblDefs; // TRUE globale Definitionen vor Sub
+ BOOL bSingleLineIf; // TRUE einzeiliges if-Statement
+
+ SbiSymDef* VarDecl( SbiDimList**,BOOL,BOOL );// Variablen-Deklaration
+ SbiProcDef* ProcDecl(BOOL bDecl);// Prozedur-Deklaration
+ void DefStatic( BOOL bPrivate );
+ void DefProc( BOOL bStatic, BOOL bPrivate ); // Prozedur einlesen
+ void DefVar( SbiOpcode eOp, BOOL bStatic ); // DIM/REDIM einlesen
+ void TypeDecl( SbiSymDef&, BOOL bAsNewAlreadyParsed=FALSE ); // AS-Deklaration
+ void OpenBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen
+ void CloseBlock(); // Block aufloesen
+ BOOL Channel( BOOL=FALSE ); // Kanalnummer parsen
+ void StmntBlock( SbiToken ); // Statement-Block abarbeiten
+ void DefType( BOOL bPrivate ); // Parse type declaration
+ void DefEnum( BOOL bPrivate ); // Parse enum declaration
+ void DefDeclare( BOOL bPrivate );
+ void EnableCompatibility();
+public:
+ SbxArrayRef rTypeArray; // das Type-Array
+ SbxArrayRef rEnumArray; // Enum types
+ SbiStringPool aGblStrings; // der String-Pool
+ SbiStringPool aLclStrings; // der String-Pool
+ SbiSymPool aGlobals; // globale Variable
+ SbiSymPool aPublics; // modulglobale Variable
+ SbiSymPool aRtlSyms; // Runtime-Library
+ SbiCodeGen aGen; // Code-Generator
+ StarBASIC* pBasic; // StarBASIC-Instanz
+ SbiSymPool* pPool; // aktueller Pool
+ SbiExprType eCurExpr; // aktueller Expr-Typ
+ short nBase; // OPTION BASE-Wert
+ BOOL bText; // OPTION COMPARE TEXT
+ BOOL bExplicit; // TRUE: OPTION EXPLICIT
+ BOOL bClassModule; // TRUE: OPTION ClassModule
+ IfaceVector aIfaceVector; // Holds all interfaces implemented by a class module
+ SbxDataType eDefTypes[26]; // DEFxxx-Datentypen
+
+ SbiParser( StarBASIC*, SbModule* );
+ BOOL Parse(); // die Aktion
+ SbiExprNode* GetWithVar(); // Innerste With-Variable liefern
+
+ // AB 31.3.1996, Symbol in Runtime-Library suchen
+ SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType );
+ void AddConstants( void );
+
+ BOOL HasGlobalCode(); // Globaler Code definiert?
+
+ BOOL TestToken( SbiToken ); // bestimmtes TOken?
+ BOOL TestSymbol( BOOL=FALSE ); // Symbol?
+ BOOL TestComma(); // Komma oder EOLN?
+ void TestEoln(); // EOLN?
+
+ void Symbol(); // Let oder Call
+ void ErrorStmnt(); // ERROR n
+ void NotImp(); // nicht implementiert
+ void BadBlock(); // LOOP/WEND/NEXT
+ void BadSyntax(); // Falsches SbiToken
+ void NoIf(); // ELSE/ELSE IF ohne IF
+ void Assign(); // LET
+ void Call(); // CALL
+ void Close(); // CLOSE
+ void Declare(); // DECLARE
+ void DefXXX(); // DEFxxx
+ void Dim(); // DIM
+ void ReDim(); // ReDim();
+ void Erase(); // ERASE
+ void Exit(); // EXIT
+ void For(); // FOR...NEXT
+ void Goto(); // GOTO / GOSUB
+ void If(); // IF
+ void Implements(); // IMPLEMENTS
+ void Input(); // INPUT, INPUT #
+ void LineInput(); // LINE INPUT, LINE INPUT #
+ void LSet(); // LSET
+ void Name(); // NAME .. AS ..
+ void On(); // ON ERROR/variable
+ void OnGoto(); // ON...GOTO / GOSUB
+ void Open(); // OPEN
+ void Option(); // OPTION
+ void Print(); // PRINT, PRINT #
+ void SubFunc(); // SUB / FUNCTION
+ void Resume(); // RESUME
+ void Return(); // RETURN
+ void RSet(); // RSET
+ void DoLoop(); // DO...LOOP
+ void Select(); // SELECT ... CASE
+ void Set(); // SET
+ void Static(); // STATIC
+ void Stop(); // STOP/SYSTEM
+ void Type(); // TYPE...AS...END TYPE
+ void Enum(); // TYPE...END ENUM
+ void While(); // WHILE/WEND
+ void With(); // WITH
+ void Write(); // WRITE
+};
+
+
+
+
+
+
+#endif
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
new file mode 100644
index 000000000000..be396a426185
--- /dev/null
+++ b/basic/source/inc/propacc.hxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * 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 _SFX_PROPBAG_HXX
+#define _SFX_PROPBAG_HXX
+
+#include <svl/svarray.hxx>
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#endif
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#define NS_BEANS ::com::sun::star::beans
+#define NS_LANG ::com::sun::star::lang
+#define NS_UNO ::com::sun::star::uno
+
+typedef NS_BEANS::PropertyValue* SbPropertyValuePtr;
+SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4, 4 )
+
+typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySet,
+ NS_BEANS::XPropertyAccess > SbPropertyValuesHelper;
+
+
+//==========================================================================
+
+class SbPropertyValues: public SbPropertyValuesHelper
+{
+ SbPropertyValueArr_Impl _aPropVals;
+ NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo;
+
+private:
+ INT32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
+
+public:
+ SbPropertyValues();
+ virtual ~SbPropertyValues();
+
+ // XPropertySet
+ virtual NS_UNO::Reference< NS_BEANS::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo(void) throw( NS_UNO::RuntimeException );
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& aPropertyName,
+ const NS_UNO::Any& aValue)
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual NS_UNO::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw( NS_BEANS::UnknownPropertyException,
+ NS_LANG::WrappedTargetException,
+ NS_UNO::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& )
+ throw ();
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& )
+ throw ();
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& )
+ throw ();
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& )
+ throw ();
+
+ // XPropertyAccess
+ virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+//==========================================================================
+
+typedef ::cppu::WeakImplHelper1< NS_BEANS::XPropertySetInfo > SbPropertySetInfoHelper;
+
+// AB 20.3.2000 Help Class for XPropertySetInfo implementation
+class PropertySetInfoImpl
+{
+ friend class SbPropertySetInfo;
+ friend class SbPropertyContainer;
+
+ NS_UNO::Sequence< NS_BEANS::Property > _aProps;
+
+ sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
+
+public:
+ PropertySetInfoImpl();
+ PropertySetInfoImpl( NS_UNO::Sequence< NS_BEANS::Property >& rProps );
+
+ // XPropertySetInfo
+ NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw ();
+ NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
+ throw( NS_UNO::RuntimeException );
+ sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
+ throw ( NS_UNO::RuntimeException );
+};
+
+class SbPropertySetInfo: public SbPropertySetInfoHelper
+{
+ PropertySetInfoImpl aImpl;
+
+public:
+ SbPropertySetInfo();
+ SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals );
+ virtual ~SbPropertySetInfo();
+
+ // XPropertySetInfo
+ virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void)
+ throw( NS_UNO::RuntimeException );
+ virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
+ throw( NS_UNO::RuntimeException );
+ virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
+ throw( NS_UNO::RuntimeException );
+};
+
+//==========================================================================
+
+typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySetInfo, NS_BEANS::XPropertyContainer > SbPropertyContainerHelper;
+
+class SbPropertyContainer: public SbPropertyContainerHelper
+{
+ PropertySetInfoImpl aImpl;
+
+public:
+ SbPropertyContainer();
+ virtual ~SbPropertyContainer();
+
+ // XPropertyContainer
+ virtual void SAL_CALL addProperty( const ::rtl::OUString& Name,
+ INT16 Attributes,
+ const NS_UNO::Any& DefaultValue)
+ throw( NS_BEANS::PropertyExistException, NS_BEANS::IllegalTypeException,
+ NS_LANG::IllegalArgumentException, NS_UNO::RuntimeException );
+ virtual void SAL_CALL removeProperty(const ::rtl::OUString& Name)
+ throw( NS_BEANS::UnknownPropertyException, NS_UNO::RuntimeException );
+
+ // XPropertySetInfo
+ virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw();
+ virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
+ throw( NS_UNO::RuntimeException );
+ virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
+ throw( NS_UNO::RuntimeException );
+
+ // XPropertyAccess
+ virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void);
+ virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_);
+};
+
+//=========================================================================
+
+class StarBASIC;
+class SbxArray;
+
+void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+
+
+#undef NS_BEANS
+#undef NS_LANG
+#undef NS_UNO
+
+
+
+#endif
+
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
new file mode 100644
index 000000000000..c9a41110ad46
--- /dev/null
+++ b/basic/source/inc/runtime.hxx
@@ -0,0 +1,529 @@
+/*************************************************************************
+ *
+ * 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 _SBRUNTIME_HXX
+#define _SBRUNTIME_HXX
+
+#ifndef _SBX_HXX
+#include <basic/sbx.hxx>
+#endif
+
+#include "sb.hxx"
+
+// Define activates class UCBStream in iosys.cxx
+#define _USE_UNO
+
+#ifdef _USE_UNO
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <osl/file.hxx>
+#include <rtl/math.hxx>
+#include <i18npool/lang.h>
+
+#include <vector>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <unotools/localedatawrapper.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
+
+
+// Define activates old file implementation
+// (only in non UCB case)
+// #define _OLD_FILE_IMPL
+
+
+//#include <sal/types.h>
+//#include <rtl/byteseq.hxx>
+//#include <rtl/ustring>
+
+
+namespace basicEncoder
+{
+
+// TODO: Use exported functionality (code is copied from deamons2/ucb)
+class AsciiEncoder
+{
+public:
+ static ::rtl::OUString decodeUnoUrlParamValue(const rtl::OUString & rSource);
+ //static ::rtl::OUString encodeUnoUrlParamValue(const rtl::OUString & rSource);
+ //static ::rtl::ByteSequence decode(const ::rtl::OUString & string);
+ //static ::rtl::OUString encode(const ::rtl::ByteSequence & bytes);
+ //static void test();
+};
+
+}
+
+#endif /* _USE_UNO */
+
+class SbiInstance; // aktiver StarBASIC-Prozess
+class SbiRuntime; // aktive StarBASIC-Prozedur-Instanz
+
+struct SbiArgvStack; // Argv stack element
+struct SbiGosubStack; // GOSUB stack element
+class SbiImage; // Code-Image
+class SbiIoSystem; // Dateisystem
+class SbiDdeControl; // DDE-Steuerung
+class SbiDllMgr; // Aufrufe in DLLs
+class SvNumberFormatter; // Zeit/Datumsfunktionen
+
+enum ForType
+{
+ FOR_TO,
+ FOR_EACH_ARRAY,
+ FOR_EACH_COLLECTION,
+ FOR_EACH_XENUMERATION
+};
+
+struct SbiForStack { // for/next stack:
+ SbiForStack* pNext; // Chain
+ SbxVariableRef refVar; // loop variable
+ SbxVariableRef refEnd; // end expression / for each: Array/BasicCollection object
+ SbxVariableRef refInc; // increment expression
+
+ // For each support
+ ForType eForType;
+ INT32 nCurCollectionIndex;
+ INT32* pArrayCurIndices;
+ INT32* pArrayLowerBounds;
+ INT32* pArrayUpperBounds;
+ Reference< XEnumeration > xEnumeration;
+
+ SbiForStack( void )
+ : pArrayCurIndices( NULL )
+ , pArrayLowerBounds( NULL )
+ , pArrayUpperBounds( NULL )
+ {}
+ ~SbiForStack()
+ {
+ delete[] pArrayCurIndices;
+ delete[] pArrayLowerBounds;
+ delete[] pArrayUpperBounds;
+ }
+};
+
+struct SbiGosubStack { // GOSUB-Stack:
+ SbiGosubStack* pNext; // Chain
+ const BYTE* pCode; // Return-Pointer
+ USHORT nStartForLvl; // #118235: For Level in moment of gosub
+};
+
+#define MAXRECURSION 500 // max. 500 Rekursionen
+
+#define Sb_ATTR_NORMAL 0x0000
+#define Sb_ATTR_HIDDEN 0x0002
+#define Sb_ATTR_SYSTEM 0x0004
+#define Sb_ATTR_VOLUME 0x0008
+#define Sb_ATTR_DIRECTORY 0x0010
+#define Sb_ATTR_ARCHIVE 0x0020
+
+
+class Dir;
+class WildCard;
+
+class SbiRTLData
+{
+public:
+
+#ifdef _OLD_FILE_IMPL
+ Dir* pDir;
+#else
+ ::osl::Directory* pDir;
+#endif
+ INT16 nDirFlags;
+ short nCurDirPos;
+
+ String sFullNameToBeChecked;
+ WildCard* pWildCard;
+
+#ifdef _USE_UNO
+ Sequence< ::rtl::OUString > aDirSeq;
+#endif /* _USE_UNO */
+
+ SbiRTLData();
+ ~SbiRTLData();
+};
+
+// Die Instanz entspricht einem laufenden StarBASIC. Mehrere gleichzeitig
+// laufende BASICs werden ueber verkettete Instanzen verwaltet. Hier liegen
+// alle Daten, die nur leben, wenn BASIC auch lebt, wie z.B. das I/O-System.
+
+typedef ::std::vector
+<
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+>
+ComponentVector_t;
+
+
+class SbiInstance
+{
+ friend class SbiRuntime;
+
+ SbiRTLData aRTLData;
+
+ SbiIoSystem* pIosys; // Dateisystem
+ SbiDdeControl* pDdeCtrl; // DDE
+ SbiDllMgr* pDllMgr; // DLL-Calls (DECLARE)
+ StarBASIC* pBasic;
+ SvNumberFormatter* pNumberFormatter;
+ LanguageType meFormatterLangType;
+ DateFormat meFormatterDateFormat;
+ sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
+
+ SbError nErr; // aktueller Fehlercode
+ String aErrorMsg; // letzte Error-Message fuer $ARG
+ USHORT nErl; // aktuelle Fehlerzeile
+ BOOL bReschedule; // Flag: TRUE = Reschedule in Hauptschleife
+ BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
+
+ ComponentVector_t ComponentVector;
+
+public:
+ SbiRuntime* pRun; // Call-Stack
+ SbiInstance* pNext; // Instanzen-Chain
+
+ // #31460 Neues Konzept fuer StepInto/Over/Out,
+ // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel()
+ USHORT nCallLvl; // Call-Level (wg. Rekursion)
+ USHORT nBreakCallLvl; // Call-Level zum Anhalten
+ void CalcBreakCallLevel( USHORT nFlags ); // Gemaess Flags setzen
+
+ SbiInstance( StarBASIC* );
+ ~SbiInstance();
+
+ void Error( SbError ); // trappable Error
+ void Error( SbError, const String& rMsg ); // trappable Error mit Message
+ void ErrorVB( sal_Int32 nVBNumber, const String& rMsg );
+ void setErrorVB( sal_Int32 nVBNumber, const String& rMsg );
+ void FatalError( SbError ); // non-trappable Error
+ void FatalError( SbError, const String& ); // non-trappable Error
+ void Abort(); // Abbruch mit aktuellem Fehlercode
+
+ void Stop();
+ SbError GetErr() { return nErr; }
+ String GetErrorMsg() { return aErrorMsg; }
+ xub_StrLen GetErl() { return nErl; }
+ void EnableReschedule( BOOL bEnable ) { bReschedule = bEnable; }
+ BOOL IsReschedule( void ) { return bReschedule; }
+ void EnableCompatibility( BOOL bEnable ) { bCompatibility = bEnable; }
+ BOOL IsCompatibility( void ) { return bCompatibility; }
+
+ ComponentVector_t& getComponentVector( void ) { return ComponentVector; }
+
+ SbMethod* GetCaller( USHORT );
+ SbModule* GetActiveModule();
+ SbxArray* GetLocals( SbMethod* );
+
+ SbiIoSystem* GetIoSystem() { return pIosys; }
+ SbiDdeControl* GetDdeControl() { return pDdeCtrl; }
+ StarBASIC* GetBasic( void ) { return pBasic; }
+ SbiDllMgr* GetDllMgr();
+ SbiRTLData* GetRTLData() const { return (SbiRTLData*)&aRTLData; }
+
+ SvNumberFormatter* GetNumberFormatter();
+ sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }
+ sal_uInt32 GetStdTimeIdx() const { return nStdTimeIdx; }
+ sal_uInt32 GetStdDateTimeIdx() const { return nStdDateTimeIdx; }
+
+ // #39629# NumberFormatter auch statisch anbieten
+ static void PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
+ sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
+ LanguageType* peFormatterLangType=NULL, DateFormat* peFormatterDateFormat=NULL );
+};
+
+SbiIoSystem* SbGetIoSystem(); // das aktuelle I/O-System
+
+
+// Verkettbare Items, um Referenzen temporaer zu halten
+struct RefSaveItem
+{
+ SbxVariableRef xRef;
+ RefSaveItem* pNext;
+
+ RefSaveItem() { pNext = NULL; }
+};
+
+
+// Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm
+// aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt
+// nur lokale Daten.
+
+class SbiRuntime
+{
+ typedef void( SbiRuntime::*pStep0 )();
+ typedef void( SbiRuntime::*pStep1 )( UINT32 nOp1 );
+ typedef void( SbiRuntime::*pStep2 )( UINT32 nOp1, UINT32 nOp2 );
+ static pStep0 aStep0[]; // Opcode-Tabelle Gruppe 0
+ static pStep1 aStep1[]; // Opcode-Tabelle Gruppe 1
+ static pStep2 aStep2[]; // Opcode-Tabelle Gruppe 2
+
+ StarBASIC& rBasic; // StarBASIC-Instanz
+ SbiInstance* pInst; // aktiver Thread
+ SbModule* pMod; // aktuelles Modul
+ SbMethod* pMeth; // Methoden-Instanz
+ SbiIoSystem* pIosys; // I/O-System
+ const SbiImage* pImg; // Code-Image
+ SbxArrayRef refExprStk; // expression stack
+ SbxArrayRef refCaseStk; // CASE expression stack
+ SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
+ SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
+ SbiArgvStack* pArgvStk; // ARGV-Stack
+ SbiGosubStack* pGosubStk; // GOSUB stack
+ SbiForStack* pForStk; // FOR/NEXT-Stack
+ USHORT nExprLvl; // Tiefe des Expr-Stacks
+ USHORT nGosubLvl; // Zum Vermeiden von Tot-Rekursionen
+ USHORT nForLvl; // #118235: Maintain for level
+ const BYTE* pCode; // aktueller Code-Pointer
+ const BYTE* pStmnt; // Beginn des lezten Statements
+ const BYTE* pError; // Adresse des aktuellen Error-Handlers
+ const BYTE* pRestart; // Restart-Adresse
+ const BYTE* pErrCode; // Restart-Adresse RESUME NEXT
+ const BYTE* pErrStmnt; // Restart-Adresse RESUMT 0
+ String aLibName; // Lib-Name fuer Declare-Call
+ SbxArrayRef refParams; // aktuelle Prozedur-Parameter
+ SbxArrayRef refLocals; // lokale Variable
+ SbxArrayRef refArgv; // aktueller Argv
+ // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
+ //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern
+ short nArgc; // aktueller Argc
+ BOOL bRun; // TRUE: Programm ist aktiv
+ BOOL bError; // TRUE: Fehler behandeln
+ BOOL bInError; // TRUE: in einem Fehler-Handler
+ BOOL bBlocked; // TRUE: blocked by next call level, #i48868
+ BOOL bVBAEnabled;
+ USHORT nFlags; // Debugging-Flags
+ SbError nError; // letzter Fehler
+ USHORT nOps; // Opcode-Zaehler
+ sal_uInt32 m_nLastTime;
+
+ RefSaveItem* pRefSaveList; // #74254 Temporaere Referenzen sichern
+ RefSaveItem* pItemStoreList; // Unbenutzte Items aufbewahren
+ void SaveRef( SbxVariable* pVar )
+ {
+ RefSaveItem* pItem = pItemStoreList;
+ if( pItem )
+ pItemStoreList = pItem->pNext;
+ else
+ pItem = new RefSaveItem();
+ pItem->pNext = pRefSaveList;
+ pItem->xRef = pVar;
+ pRefSaveList = pItem;
+ }
+ void ClearRefs( void )
+ {
+ while( pRefSaveList )
+ {
+ RefSaveItem* pToClearItem = pRefSaveList;
+ pRefSaveList = pToClearItem->pNext;
+ pToClearItem->xRef = NULL;
+ pToClearItem->pNext = pItemStoreList;
+ pItemStoreList = pToClearItem;
+ }
+ }
+
+ SbxVariable* FindElement
+ ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError, BOOL bLocal, BOOL bStatic = FALSE );
+ void SetupArgs( SbxVariable*, UINT32 );
+ SbxVariable* CheckArray( SbxVariable* );
+
+ void PushVar( SbxVariable* ); // Variable push
+ SbxVariableRef PopVar(); // Variable pop
+ SbxVariable* GetTOS( short=0 ); // Variable vom TOS holen
+ void TOSMakeTemp(); // TOS in temp. Variable wandeln
+ BOOL ClearExprStack(); // Expr-Stack freigeben
+
+ void PushGosub( const BYTE* ); // GOSUB-Element push
+ void PopGosub(); // GOSUB-Element pop
+ void ClearGosubStack(); // GOSUB-Stack freigeben
+
+ void PushArgv(); // Argv-Element push
+ void PopArgv(); // Argv-Element pop
+ void ClearArgvStack(); // Argv-Stack freigeben
+
+ void PushFor(); // For-Element push
+ void PushForEach(); // For-Each-Element push
+ void PopFor(); // For-Element pop
+ void ClearForStack(); // For-Stack freigeben
+
+ void StepArith( SbxOperator ); // arithmetische Verknuepfungen
+ void StepUnary( SbxOperator ); // unaere Verknuepfungen
+ void StepCompare( SbxOperator );// Vergleiche
+
+ void SetParameters( SbxArray* );// Parameter uebernehmen
+
+ // MUSS NOCH IMPLEMENTIERT WERDEN
+ void DllCall( const String&, const String&, SbxArray*, SbxDataType, BOOL );
+
+ // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
+ void DimImpl( SbxVariableRef refVar );
+
+ // #115829
+ bool implIsClass( SbxObject* pObj, const String& aClass );
+
+ void StepSETCLASS_impl( UINT32 nOp1, bool bHandleDflt = false );
+
+ // Die nachfolgenden Routinen werden vom Single Stepper
+ // gerufen und implementieren die einzelnen Opcodes
+ void StepNOP(), StepEXP(), StepMUL(), StepDIV();
+ void StepMOD(), StepPLUS(), StepMINUS(), StepNEG();
+ void StepEQ(), StepNE(), StepLT(), StepGT();
+ void StepLE(), StepGE(), StepIDIV(), StepAND();
+ void StepOR(), StepXOR(), StepEQV(), StepIMP();
+ void StepNOT(), StepCAT(), StepLIKE(), StepIS();
+ void StepCLONE(), StepOLDBASED(), StepARGC();
+ void StepARGV(), StepINPUT(), StepLINPUT(), StepSTOP();
+ void StepGET(), StepSET(), StepVBASET(), StepPUT(), StepPUTC();
+ void StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bDefaultHandling = false );
+ void StepDIM(), StepREDIM(), StepREDIMP(), StepERASE();
+ void StepINITFOR(), StepNEXT(), StepERROR(), StepINITFOREACH();
+ void StepCASE(), StepENDCASE(), StepSTDERROR();
+ void StepNOERROR(), StepCHANNEL(), StepCHANNEL0(), StepPRINT();
+ void StepPRINTF(), StepWRITE(), StepRENAME(), StepPROMPT();
+ void StepRESTART(), StepEMPTY(), StepLEAVE();
+ void StepLSET(), StepRSET(), StepREDIMP_ERASE(), StepERASE_CLEAR();
+ void StepARRAYACCESS();
+ // Alle Opcodes mit einem Operanden
+ void StepLOADNC( UINT32 ), StepLOADSC( UINT32 ), StepLOADI( UINT32 );
+ void StepARGN( UINT32 ), StepBASED( UINT32 ), StepPAD( UINT32 );
+ void StepJUMP( UINT32 ), StepJUMPT( UINT32 );
+ void StepJUMPF( UINT32 ), StepONJUMP( UINT32 );
+ void StepGOSUB( UINT32 ), StepRETURN( UINT32 );
+ void StepTESTFOR( UINT32 ), StepCASETO( UINT32 ), StepERRHDL( UINT32 );
+ void StepRESUME( UINT32 ), StepSETCLASS( UINT32 ), StepVBASETCLASS( UINT32 ), StepTESTCLASS( UINT32 ), StepLIB( UINT32 );
+ bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors );
+ void StepCLOSE( UINT32 ), StepPRCHAR( UINT32 ), StepARGTYP( UINT32 );
+ // Alle Opcodes mit zwei Operanden
+ void StepRTL( UINT32, UINT32 ), StepPUBLIC( UINT32, UINT32 ), StepPUBLIC_P( UINT32, UINT32 );
+ void StepPUBLIC_Impl( UINT32, UINT32, bool bUsedForClassModule );
+ void StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError, BOOL bLocal, BOOL bStatic = FALSE );
+ void StepFIND( UINT32, UINT32 ), StepELEM( UINT32, UINT32 );
+ void StepGLOBAL( UINT32, UINT32 ), StepLOCAL( UINT32, UINT32 );
+ void StepPARAM( UINT32, UINT32), StepCREATE( UINT32, UINT32 );
+ void StepCALL( UINT32, UINT32 ), StepCALLC( UINT32, UINT32 );
+ void StepCASEIS( UINT32, UINT32 ), StepSTMNT( UINT32, UINT32 );
+ SbxVariable* StepSTATIC_Impl( String& aName, SbxDataType& t );
+ void StepOPEN( UINT32, UINT32 ), StepSTATIC( UINT32, UINT32 );
+ void StepTCREATE(UINT32,UINT32), StepDCREATE(UINT32,UINT32);
+ void StepGLOBAL_P( UINT32, UINT32 ),StepFIND_G( UINT32, UINT32 );
+ void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32);
+ void StepFIND_CM( UINT32, UINT32 );
+ void StepFIND_STATIC( UINT32, UINT32 );
+public:
+ void SetVBAEnabled( bool bEnabled );
+ USHORT GetImageFlag( USHORT n ) const;
+ USHORT GetBase();
+ xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich
+ SbiRuntime* pNext; // Stack-Chain
+
+ SbiRuntime( SbModule*, SbMethod*, UINT32 );
+ ~SbiRuntime();
+ void Error( SbError, bool bVBATranslationAlreadyDone = false ); // Fehler setzen, falls != 0
+ void Error( SbError, const String& ); // Fehler setzen, falls != 0
+ void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
+ void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen
+ static sal_Int32 translateErrorToVba( SbError nError, String& rMsg );
+ void DumpPCode();
+ BOOL Step(); // Einzelschritt (ein Opcode)
+ void Stop() { bRun = FALSE; }
+ BOOL IsRun() { return bRun; }
+ void block( void ) { bBlocked = TRUE; }
+ void unblock( void ) { bBlocked = FALSE; }
+ SbMethod* GetMethod() { return pMeth; }
+ SbModule* GetModule() { return pMod; }
+ USHORT GetDebugFlags() { return nFlags; }
+ void SetDebugFlags( USHORT nFl ) { nFlags = nFl; }
+ SbMethod* GetCaller();
+ SbxArray* GetLocals();
+ SbxArray* GetParams();
+
+ SbxBase* FindElementExtern( const String& rName );
+ static bool isVBAEnabled();
+
+};
+
+inline void checkArithmeticOverflow( double d )
+{
+ if( !::rtl::math::isFinite( d ) )
+ StarBASIC::Error( SbERR_MATH_OVERFLOW );
+}
+
+inline void checkArithmeticOverflow( SbxVariable* pVar )
+{
+ if( pVar->GetType() == SbxDOUBLE )
+ {
+ double d = pVar->GetDouble();
+ checkArithmeticOverflow( d );
+ }
+}
+
+// Hilfsfunktion, um aktives Basic zu finden
+StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic );
+
+// Get information if security restrictions should be
+// used (File IO based on UCB, no RTL function SHELL
+// no DDE functionality, no DLLCALL) in basic because
+// of portal "virtual" users (portal user != UNIX user)
+// (Implemented in iosys.cxx)
+BOOL needSecurityRestrictions( void );
+
+// Returns TRUE if UNO is available, otherwise the old
+// file system implementation has to be used
+// (Implemented in iosys.cxx)
+BOOL hasUno( void );
+
+// Converts possibly relative paths to absolute paths
+// according to the setting done by ChDir/ChDrive
+// (Implemented in methods.cxx)
+String getFullPath( const String& aRelPath );
+
+// Sets (virtual) current path for UCB file access
+void implChDir( const String& aDir );
+
+// Sets (virtual) current drive for UCB file access
+void implChDrive( const String& aDrive );
+
+// Returns (virtual) current path for UCB file access
+String implGetCurDir( void );
+
+// Implementation of StepRENAME with UCB
+// (Implemented in methods.cxx, so step0.cxx
+// has not to be infected with UNO)
+void implStepRenameUCB( const String& aSource, const String& aDest );
+
+//*** OSL file access ***
+// #87427 OSL need File URLs, so map to getFullPath
+inline String getFullPathUNC( const String& aRelPath )
+{
+ return getFullPath( aRelPath );
+}
+void implStepRenameOSL( const String& aSource, const String& aDest );
+bool IsBaseIndexOne();
+
+#endif
+
diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx
new file mode 100644
index 000000000000..6335a55da62f
--- /dev/null
+++ b/basic/source/inc/sbcomp.hxx
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * 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 _SBCOMP_HXX
+#define _SBCOMP_HXX
+
+// das folgende habe ich der neuen Datei von MD entnommen! (MT)
+#include "sbintern.hxx"
+#include "token.hxx" // Tokenizer
+#include "symtbl.hxx" // Symbolverwaltung
+#include "parser.hxx" // Parser
+#include "codegen.hxx" // Code-Generator
+
+#endif
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
new file mode 100644
index 000000000000..5896db78ea40
--- /dev/null
+++ b/basic/source/inc/sbintern.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * 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_INTERN_HXX
+#define _SB_INTERN_HXX
+
+#include <basic/sbxfac.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include "sb.hxx"
+
+namespace utl
+{
+ class TransliterationWrapper;
+}
+class SbUnoFactory;
+class SbTypeFactory;
+class SbOLEFactory;
+class SbiInstance;
+class SbModule;
+
+class SbiFactory : public SbxFactory
+{
+public:
+ virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
+ virtual SbxObject* CreateObject( const String& );
+};
+
+struct SbClassData
+{
+ SbxArrayRef mxIfaces;
+
+ SbClassData( void );
+ ~SbClassData( void )
+ { clear(); }
+ void clear( void );
+};
+
+// #115824: Factory class to create class objects (type command)
+// Implementation: sb.cxx
+class SbClassFactory : public SbxFactory
+{
+ SbxObjectRef xClassModules;
+
+public:
+ SbClassFactory( void );
+ virtual ~SbClassFactory();
+
+ void AddClassModule( SbModule* pClassModule );
+ void RemoveClassModule( SbModule* pClassModule );
+
+ virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
+ virtual SbxObject* CreateObject( const String& );
+
+ SbModule* FindClass( const String& rClassName );
+};
+
+// Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
+class SbErrorStackEntry
+{
+public:
+ SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2)
+ : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {}
+ SbMethodRef aMethod;
+ xub_StrLen nLine;
+ xub_StrLen nCol1, nCol2;
+};
+
+SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1)
+
+
+
+struct SbiGlobals
+{
+ SbiInstance* pInst; // alle aktiven Runtime-Instanzen
+ SbiFactory* pSbFac; // StarBASIC-Factory
+ SbUnoFactory* pUnoFac; // Factory fuer Uno-Structs bei DIM AS NEW
+ SbTypeFactory* pTypeFac; // Factory for user defined types
+ SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules)
+ SbOLEFactory* pOLEFac; // Factory for OLE types
+ SbModule* pMod; // aktuell aktives Modul
+ SbModule* pCompMod; // aktuell compiliertes Modul
+ short nInst; // Anzahl BASICs
+ Link aErrHdl; // globaler Error-Handler
+ Link aBreakHdl; // globaler Break-Handler
+ SbError nCode; // aktueller Fehlercode
+ xub_StrLen nLine; // aktuelle Zeile
+ xub_StrLen nCol1,nCol2; // aktuelle Spalten (von,bis)
+ BOOL bCompiler; // Flag fuer Compiler-Error
+ BOOL bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf
+ BOOL bRunInit; // TRUE, wenn RunInit vom Basic aktiv ist
+ String aErrMsg; // Puffer fuer GetErrorText()
+ SbLanguageMode eLanguageMode; // Flag fuer Visual-Basic-Script-Modus
+ SbErrorStack* pErrStack; // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
+ ::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp
+ BOOL bBlockCompilerError;
+ BasicManager* pAppBasMgr;
+ StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
+
+ SbiGlobals();
+ ~SbiGlobals();
+};
+
+// Utility-Makros und -Routinen
+
+SbiGlobals* GetSbData();
+
+#define pINST GetSbData()->pInst
+#define pMOD GetSbData()->pMod
+#define pCMOD GetSbData()->pCompMod
+#define pSBFAC GetSbData()->pSbFac
+#define pUNOFAC GetSbData()->pUnoFac
+#define pTYPEFAC GetSbData()->pTypeFac
+#define pCLASSFAC GetSbData()->pClassFac
+#define pOLEFAC GetSbData()->pOLEFac
+
+#endif
+
diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx
new file mode 100644
index 000000000000..80c301821884
--- /dev/null
+++ b/basic/source/inc/sbjsmeth.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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_SBJSMETH_HXX
+#define _SB_SBJSMETH_HXX
+
+#include <basic/sbmeth.hxx>
+
+// Basic-Modul fuer JavaScript-Sourcen.
+// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert
+// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI.
+
+class SbJScriptMethod : public SbMethod
+{
+public:
+ SbJScriptMethod( const String&, SbxDataType, SbModule* );
+ virtual ~SbJScriptMethod();
+
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMETH,2);
+ TYPEINFO();
+};
+
+#ifndef __SB_SBJSCRIPTMETHODREF_HXX
+#define __SB_SBJSCRIPTMETHODREF_HXX
+SV_DECL_IMPL_REF(SbJScriptMethod)
+#endif
+
+#endif
diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
new file mode 100644
index 000000000000..a9b035e79da2
--- /dev/null
+++ b/basic/source/inc/sbjsmod.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * 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_SBJSMOD_HXX
+#define _SB_SBJSMOD_HXX
+
+#include <basic/sbmod.hxx>
+
+// Basic-Modul fuer JavaScript-Sourcen.
+// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert
+// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI.
+
+class SbJScriptModule : public SbModule
+{
+ virtual BOOL LoadData( SvStream&, USHORT );
+ virtual BOOL StoreData( SvStream& ) const;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMOD,1);
+ TYPEINFO();
+ SbJScriptModule( const String& ); // DURCHREICHEN
+};
+
+#endif
+
+
+
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
new file mode 100644
index 000000000000..2d9836e3530e
--- /dev/null
+++ b/basic/source/inc/sbunoobj.hxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * 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_UNO_OBJ
+#define SB_UNO_OBJ
+
+#include <basic/sbxobj.hxx>
+#include <basic/sbxmeth.hxx>
+#include <basic/sbxprop.hxx>
+#include <basic/sbxfac.hxx>
+#ifndef __SBX_SBX_HXX //autogen
+#include <basic/sbx.hxx>
+#endif
+#include <com/sun/star/beans/XMaterialHolder.hpp>
+#include <com/sun/star/beans/XExactName.hpp>
+#include <com/sun/star/beans/XIntrospectionAccess.hpp>
+#include <com/sun/star/beans/XIntrospection.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/reflection/XIdlClass.hpp>
+#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
+#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
+#include <rtl/ustring.hxx>
+
+class SbUnoObject: public SbxObject
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > mxUnoAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMaterialHolder > mxMaterialHolder;
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > mxInvocation;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
+ BOOL bNeedIntrospection;
+ ::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
+
+ // Hilfs-Methode zum Anlegen der dbg_-Properties
+ void implCreateDbgProperties( void );
+
+ // Hilfs-Methode zum Anlegen aller Properties und Methoden
+ // (Beim on-demand-Mechanismus erforderlich fuer die dbg_-Properties)
+ void implCreateAll( void );
+
+public:
+ static bool getDefaultPropName( SbUnoObject* pUnoObj, String& sDfltProp );
+ TYPEINFO();
+ SbUnoObject( const String& aName_, const ::com::sun::star::uno::Any& aUnoObj_ );
+ ~SbUnoObject();
+
+ // #76470 Introspection on Demand durchfuehren
+ void doIntrospection( void );
+
+ // Find ueberladen, um z.B. NameAccess zu unterstuetzen
+ virtual SbxVariable* Find( const String&, SbxClassType );
+
+ // Force creation of all properties for debugging
+ void createAllProperties( void )
+ { implCreateAll(); }
+
+ // Wert rausgeben
+ ::com::sun::star::uno::Any getUnoAny( void );
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > getIntrospectionAccess( void ) { return mxUnoAccess; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > getInvocation( void ) { return mxInvocation; }
+
+ void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+};
+SV_DECL_IMPL_REF(SbUnoObject);
+
+
+// #67781 Rueckgabewerte der Uno-Methoden loeschen
+void clearUnoMethods( void );
+
+class SbUnoMethod : public SbxMethod
+{
+ friend class SbUnoObject;
+ friend void clearUnoMethods( void );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq;
+
+ // #67781 Verweis auf vorige und naechste Methode in der Methoden-Liste
+ SbUnoMethod* pPrev;
+ SbUnoMethod* pNext;
+
+ bool mbInvocation; // Method is based on invocation
+
+public:
+ TYPEINFO();
+
+ SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
+ bool bInvocation );
+ virtual ~SbUnoMethod();
+ virtual SbxInfo* GetInfo();
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >& getParamInfos( void );
+
+ bool isInvocationBased( void )
+ { return mbInvocation; }
+};
+
+
+class SbUnoProperty : public SbxProperty
+{
+ friend class SbUnoObject;
+
+ // Daten der Uno-Property
+ ::com::sun::star::beans::Property aUnoProp;
+ INT32 nId;
+
+ bool mbInvocation; // Property is based on invocation
+
+ virtual ~SbUnoProperty();
+public:
+ TYPEINFO();
+ SbUnoProperty( const String& aName_, SbxDataType eSbxType,
+ const ::com::sun::star::beans::Property& aUnoProp_, INT32 nId_, bool bInvocation );
+
+ bool isInvocationBased( void )
+ { return mbInvocation; }
+};
+
+// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW
+class SbUnoFactory : public SbxFactory
+{
+public:
+ virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
+ virtual SbxObject* CreateObject( const String& );
+};
+
+// Wrapper fuer eine Uno-Klasse
+class SbUnoClass : public SbxObject
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > m_xClass;
+
+public:
+ TYPEINFO();
+ SbUnoClass( const String& aName_ )
+ : SbxObject( aName_ )
+ {}
+ SbUnoClass( const String& aName_, const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& xClass_ )
+ : SbxObject( aName_ )
+ , m_xClass( xClass_ )
+ {}
+ //~SbUnoClass();
+
+ // Find ueberladen, um Elemente on Demand anzulegen
+ virtual SbxVariable* Find( const String&, SbxClassType );
+
+ // Wert rausgeben
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& getUnoClass( void ) { return m_xClass; }
+
+ //void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+};
+SV_DECL_IMPL_REF(SbUnoClass);
+
+
+// Funktion, um einen globalen Bezeichner im
+// UnoScope zu suchen und fuer Sbx zu wrappen
+SbUnoClass* findUnoClass( const String& rName );
+
+
+// Wrapper for UNO Service
+class SbUnoService : public SbxObject
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc;
+ bool m_bNeedsInit;
+
+public:
+ TYPEINFO();
+ SbUnoService( const String& aName_,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceTypeDescription2 >& xServiceTypeDesc )
+ : SbxObject( aName_ )
+ , m_xServiceTypeDesc( xServiceTypeDesc )
+ , m_bNeedsInit( true )
+ {}
+
+ virtual SbxVariable* Find( const String&, SbxClassType );
+
+ void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+};
+SV_DECL_IMPL_REF(SbUnoService);
+
+SbUnoService* findUnoService( const String& rName );
+
+
+void clearUnoServiceCtors( void );
+
+class SbUnoServiceCtor : public SbxMethod
+{
+ friend class SbUnoService;
+ friend void clearUnoServiceCtors( void );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > m_xServiceCtorDesc;
+
+ SbUnoServiceCtor* pPrev;
+ SbUnoServiceCtor* pNext;
+
+public:
+ TYPEINFO();
+
+ SbUnoServiceCtor( const String& aName_, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > xServiceCtorDesc );
+ virtual ~SbUnoServiceCtor();
+ virtual SbxInfo* GetInfo();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XServiceConstructorDescription > getServiceCtorDesc( void )
+ { return m_xServiceCtorDesc; }
+};
+
+
+// Wrapper for UNO Singleton
+class SbUnoSingleton : public SbxObject
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XSingletonTypeDescription > m_xSingletonTypeDesc;
+
+public:
+ TYPEINFO();
+ SbUnoSingleton( const String& aName_,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XSingletonTypeDescription >& xSingletonTypeDesc );
+
+ void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+};
+SV_DECL_IMPL_REF(SbUnoSingleton);
+
+SbUnoSingleton* findUnoSingleton( const String& rName );
+
+
+// #105565 Special Object to wrap a strongly typed Uno Any
+class SbUnoAnyObject: public SbxObject
+{
+ ::com::sun::star::uno::Any mVal;
+
+public:
+ SbUnoAnyObject( const ::com::sun::star::uno::Any& rVal )
+ : SbxObject( String() )
+ , mVal( rVal )
+ {}
+
+ const ::com::sun::star::uno::Any& getValue( void )
+ { return mVal; }
+
+ TYPEINFO();
+};
+
+
+// #112509 Special SbxArray to transport named parameters for calls
+// to OLEAutomation objects through the UNO OLE automation bridge
+
+class AutomationNamedArgsSbxArray : public SbxArray
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > maNameSeq;
+public:
+ TYPEINFO();
+ AutomationNamedArgsSbxArray( sal_Int32 nSeqSize )
+ : maNameSeq( nSeqSize )
+ {}
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& getNames( void )
+ { return maNameSeq; }
+};
+
+
+class StarBASIC;
+
+// Impl-Methoden fuer RTL
+void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+
+
+//========================================================================
+// #118116 Collection object
+
+class BasicCollection : public SbxObject
+{
+ friend class SbiRuntime;
+ SbxArrayRef xItemArray;
+ static SbxInfoRef xAddInfo;
+ static SbxInfoRef xItemInfo;
+
+ void Initialize();
+ virtual ~BasicCollection();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+ INT32 implGetIndex( SbxVariable* pIndexVar );
+ INT32 implGetIndexForName( const String& rName );
+ void CollAdd( SbxArray* pPar_ );
+ void CollItem( SbxArray* pPar_ );
+ void CollRemove( SbxArray* pPar_ );
+
+public:
+ TYPEINFO();
+ BasicCollection( const String& rClassname );
+ virtual SbxVariable* Find( const String&, SbxClassType );
+ virtual void Clear();
+};
+
+#endif
+
+
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
new file mode 100644
index 000000000000..9738e8763a1a
--- /dev/null
+++ b/basic/source/inc/scanner.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * 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 _SCANNER_HXX
+#define _SCANNER_HXX
+
+#include <tools/string.hxx>
+#ifndef _SBERRORS_HXX
+#include <basic/sberrors.hxx>
+#endif
+
+// Der Scanner ist stand-alone, d.h. er kann von ueberallher verwendet
+// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne
+// BASIC werden die Fehler nur gezaehlt. Auch ist Basic notwendig, wenn
+// eine erweiterte SBX-Variable zur Erkennung von Datentypen etc. verwendet
+// werden soll.
+
+class StarBASIC;
+
+class SbiScanner
+{
+ ::rtl::OUString aBuf; // Input-Puffer
+ ::rtl::OUString aLine; // aktuelle Zeile
+ const sal_Unicode* pLine; // Pointer
+ const sal_Unicode* pSaveLine; // Merker fuer Line
+protected:
+ String aSym; // Symbolpuffer
+ String aError; // Fehler-String
+ SbxDataType eScanType; // evtl. Datentyp
+ StarBASIC* pBasic; // Instanz fuer Fehler-Callbacks
+ double nVal; // numerischer Wert
+ short nCurCol1; // aktuelle Spalte 1
+ short nSavedCol1; // gerettete Spalte 1
+ short nCol; // aktuelle Spaltennummer
+ short nErrors; // Anzahl Fehler
+ short nColLock; // Lock-Zaehler fuer Col1
+ INT32 nBufPos; // aktuelle Buffer-Pos
+ USHORT nLine; // aktuelle Zeile
+ USHORT nCol1, nCol2; // aktuelle 1. und 2. Spalte
+ BOOL bSymbol; // TRUE: Symbol gescannt
+ BOOL bNumber; // TRUE: Zahl gescannt
+ BOOL bSpaces; // TRUE: Whitespace vor Token
+ BOOL bErrors; // TRUE: Fehler generieren
+ BOOL bAbort; // TRUE: abbrechen
+ BOOL bHash; // TRUE: # eingelesen
+ BOOL bError; // TRUE: Fehler generieren
+ BOOL bUsedForHilite; // TRUE: Nutzung fuer Highlighting
+ BOOL bCompatible; // TRUE: OPTION Compatibl
+ BOOL bVBASupportOn; // TRUE: OPTION VBASupport 1 otherwise default False
+ BOOL bPrevLineExtentsComment; // TRUE: Previous line is comment and ends on "... _"
+
+ void GenError( SbError );
+public:
+ SbiScanner( const ::rtl::OUString&, StarBASIC* = NULL );
+ ~SbiScanner();
+
+ void EnableErrors() { bError = FALSE; }
+ BOOL IsHash() { return bHash; }
+ BOOL IsCompatible() { return bCompatible; }
+ void SetCompatible( bool b ) { bCompatible = b; } // #118206
+ BOOL IsVBASupportOn() { return bVBASupportOn; }
+ void SetVBASupportOn( bool b ) { bVBASupportOn = b; }
+ BOOL WhiteSpace() { return bSpaces; }
+ short GetErrors() { return nErrors; }
+ short GetLine() { return nLine; }
+ short GetCol1() { return nCol1; }
+ short GetCol2() { return nCol2; }
+ void SetCol1( short n ) { nCol1 = n; }
+ StarBASIC* GetBasic() { return pBasic; }
+ void SaveLine(void) { pSaveLine = pLine; }
+ void RestoreLine(void) { pLine = pSaveLine; }
+ void LockColumn();
+ void UnlockColumn();
+ BOOL DoesColonFollow();
+
+ BOOL NextSym(); // naechstes Symbol lesen
+ const String& GetSym() { return aSym; }
+ SbxDataType GetType() { return eScanType; }
+ double GetDbl() { return nVal; }
+};
+
+class LetterTable
+{
+ bool IsLetterTab[256];
+
+public:
+ LetterTable( void );
+
+ inline bool isLetter( sal_Unicode c )
+ {
+ bool bRet = (c < 256) ? IsLetterTab[c] : isLetterUnicode( c );
+ return bRet;
+ }
+ bool isLetterUnicode( sal_Unicode c );
+};
+
+class BasicSimpleCharClass
+{
+ static LetterTable aLetterTable;
+
+public:
+ static BOOL isAlpha( sal_Unicode c, bool bCompatible )
+ {
+ BOOL bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
+ || (bCompatible && aLetterTable.isLetter( c ));
+ return bRet;
+ }
+
+ static BOOL isDigit( sal_Unicode c )
+ {
+ BOOL bRet = (c >= '0' && c <= '9');
+ return bRet;
+ }
+
+ static BOOL isAlphaNumeric( sal_Unicode c, bool bCompatible )
+ {
+ BOOL bRet = isDigit( c ) || isAlpha( c, bCompatible );
+ return bRet;
+ }
+};
+
+#endif
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
new file mode 100644
index 000000000000..31025c48c4a4
--- /dev/null
+++ b/basic/source/inc/scriptcont.hxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * 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_SCRIPTCONTAINER_HXX
+#define BASIC_SCRIPTCONTAINER_HXX
+
+#include "namecont.hxx"
+#include <basic/basmgr.hxx>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <comphelper/uno3.hxx>
+
+class BasicManager;
+
+//============================================================================
+
+namespace basic
+{
+
+class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
+{
+ ::rtl::OUString maScriptLanguage;
+
+ // Methods to distinguish between deffirent library types
+ virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
+ virtual SfxLibrary* SAL_CALL implCreateLibraryLink
+ ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
+ const ::rtl::OUString& StorageURL, sal_Bool ReadOnly );
+ virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void );
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
+ virtual void SAL_CALL writeLibraryElement
+ (
+ ::com::sun::star::uno::Any aElement,
+ const ::rtl::OUString& aElementName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
+ )
+ throw(::com::sun::star::uno::Exception);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
+ ( const ::rtl::OUString& aFile,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
+
+ virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
+
+ virtual SfxLibraryContainer* createInstanceImpl( void );
+
+
+ // Password encryption
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
+
+ // New variant for library export
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::rtl::OUString& aTargetURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
+
+ virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
+ sal_Bool bVerifyPasswordOnly=false )
+ throw(::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void onNewRootStorage();
+
+
+ // OldBasicPassword interface
+ virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword );
+ virtual String getLibraryPassword( const String& rLibraryName );
+ virtual void clearLibraryPassword( const String& rLibraryName );
+ virtual sal_Bool hasLibraryPassword( const String& rLibraryName );
+
+ virtual const sal_Char* SAL_CALL getInfoFileName() const;
+ virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
+ virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
+ virtual const sal_Char* SAL_CALL getLibrariesDir() const;
+
+public:
+ SfxScriptLibraryContainer( void );
+ SfxScriptLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+
+ // Methods XLibraryContainerPassword
+ virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
+ const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Service
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
+ static ::rtl::OUString getImplementationName_static();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
+ ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
+ throw( ::com::sun::star::uno::Exception );
+
+};
+
+//============================================================================
+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XVBAModuleInfo
+ > SfxScriptLibrary_BASE;
+
+class SfxScriptLibrary : public SfxLibrary
+ , public SfxScriptLibrary_BASE
+{
+ friend class SfxScriptLibraryContainer;
+
+ sal_Bool mbLoadedSource;
+ sal_Bool mbLoadedBinary;
+ ModuleInfoMap mModuleInfos;
+
+ // Provide modify state including resources
+ virtual sal_Bool isModified( void );
+ virtual void storeResources( void );
+ virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName );
+ virtual void storeResourcesToURL( const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+ virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
+ < ::com::sun::star::embed::XStorage >& xStorage );
+
+public:
+ SfxScriptLibrary
+ (
+ ModifiableHelper& _rModifiable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
+ );
+
+ SfxScriptLibrary
+ (
+ ModifiableHelper& _rModifiable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
+ );
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XVBAModuleInfo
+ virtual ::com::sun::star::script::ModuleInfo SAL_CALL getModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertModuleInfo( const ::rtl::OUString& ModuleName, const ::com::sun::star::script::ModuleInfo& ModuleInfo ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
+
+protected:
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
+};
+
+} // namespace base
+
+#endif
+
diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx
new file mode 100644
index 000000000000..000e39973eb3
--- /dev/null
+++ b/basic/source/inc/stdobj.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * 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 _SBSTDOBJ_HXX
+#define _SBSTDOBJ_HXX
+
+#include <basic/sbxobj.hxx>
+
+class StarBASIC;
+class SbStdFactory;
+
+class SbiStdObject : public SbxObject
+{
+ SbStdFactory* pStdFactory;
+
+ ~SbiStdObject();
+ using SbxVariable::GetInfo;
+ SbxInfo* GetInfo( short );
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SbiStdObject( const String&, StarBASIC* );
+ virtual SbxVariable* Find( const String&, SbxClassType );
+ virtual void SetModified( BOOL );
+};
+
+#endif
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
new file mode 100644
index 000000000000..03202edba910
--- /dev/null
+++ b/basic/source/inc/symtbl.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * 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 _SYMTBL_HXX
+#define _SYMTBL_HXX
+
+#include <svl/svarray.hxx>
+#include <tools/string.hxx>
+#include <basic/sbxdef.hxx>
+#include <basic/sbdef.hxx>
+
+class SbiSymDef; // Basisklasse
+class SbiProcDef; // Prozedur
+class SbiConstDef; // Konstante
+class SbiSymPool; // Symbol-Pool
+class SbiStringPool; // gepoolte Strings
+
+class SvStream;
+class SbiParser;
+
+enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL };
+
+///////////////////////////////////////////////////////////////////////////
+
+// Der String-Pool nimmt String-Eintraege auf und sorgt dafuer,
+// dass sie nicht doppelt vorkommen.
+
+SV_DECL_PTRARR_DEL(SbiStrings,String*,5,5)
+
+class SbiStringPool { // String-Pool
+ SbiStrings aData; // Daten
+ String aEmpty; // for convenience
+ SbiParser* pParser; // der Parser
+public:
+ SbiStringPool( SbiParser* );
+ ~SbiStringPool();
+ USHORT GetSize() const { return aData.Count(); }
+ // AB 8.4.1999, Default wegen #64236 auf TRUE geaendert
+ // Wenn der Bug sauber behoben ist, wieder auf FALSE aendern.
+ short Add( const String&, BOOL=TRUE );
+ short Add( double, SbxDataType );
+ const String& Find( USHORT ) const;
+ SbiParser* GetParser() { return pParser; }
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+SV_DECL_PTRARR_DEL(SbiSymbols,SbiSymDef*,5,5)
+
+class SbiSymPool { // Symbol-Pool
+ friend class SbiSymDef;
+ friend class SbiProcDef;
+protected:
+ SbiStringPool& rStrings; // verwendeter Stringpool
+ SbiSymbols aData; // Daten
+ SbiSymPool* pParent; // uebergeordneter Symbol-Pool
+ SbiParser* pParser; // der Parser
+ SbiSymScope eScope; // Scope des Pools
+ USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable
+ USHORT nCur; // Iterator
+public:
+ SbiSymPool( SbiStringPool&, SbiSymScope );
+ ~SbiSymPool();
+
+ void Clear();
+
+ void SetParent( SbiSymPool* p ) { pParent = p; }
+ void SetProcId( short n ) { nProcId = n; }
+ USHORT GetSize() const { return aData.Count(); }
+ SbiSymScope GetScope() const { return eScope; }
+ void SetScope( SbiSymScope s ) { eScope = s; }
+ SbiParser* GetParser() { return pParser; }
+
+ SbiSymDef* AddSym( const String& ); // Symbol hinzufuegen
+ SbiProcDef* AddProc( const String& );// Prozedur hinzufuegen
+ void Add( SbiSymDef* ); // Symbol uebernehmen
+ SbiSymDef* Find( const String& ) const;// Variablenname
+ SbiSymDef* FindId( USHORT ) const; // Variable per ID suchen
+ SbiSymDef* Get( USHORT ) const; // Variable per Position suchen
+ SbiSymDef* First(), *Next(); // Iteratoren
+
+ UINT32 Define( const String& ); // Label definieren
+ UINT32 Reference( const String& ); // Label referenzieren
+ void CheckRefs(); // offene Referenzen suchen
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+class SbiSymDef { // Allgemeiner Symboleintrag
+ friend class SbiSymPool;
+protected:
+ String aName; // Name des Eintrags
+ SbxDataType eType; // Typ des Eintrags
+ SbiSymPool* pIn; // Parent-Pool
+ SbiSymPool* pPool; // Pool fuer Unterelemente
+ short nLen; // Stringlaenge bei STRING*n
+ short nDims; // Array-Dimensionen
+ USHORT nId; // Symbol-Nummer
+ USHORT nTypeId; // String-ID des Datentyps (Dim X AS Dytentyp)
+ USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable
+ USHORT nPos; // Positions-Nummer
+ UINT32 nChain; // Backchain-Kette
+ BOOL bNew : 1; // TRUE: Dim As New...
+ BOOL bChained : 1; // TRUE: Symbol ist in Code definiert
+ BOOL bByVal : 1; // TRUE: ByVal-Parameter
+ BOOL bOpt : 1; // TRUE: optionaler Parameter
+ BOOL bStatic : 1; // TRUE: STATIC-Variable
+ BOOL bAs : 1; // TRUE: Datentyp per AS XXX definiert
+ BOOL bGlobal : 1; // TRUE: Global-Variable
+ BOOL bParamArray : 1; // TRUE: ParamArray parameter
+ USHORT nDefaultId; // Symbol number of default value
+public:
+ SbiSymDef( const String& );
+ virtual ~SbiSymDef();
+ virtual SbiProcDef* GetProcDef();
+ virtual SbiConstDef* GetConstDef();
+
+ SbxDataType GetType() const { return eType; }
+ virtual void SetType( SbxDataType );
+ const String& GetName();
+ SbiSymScope GetScope() const;
+ USHORT GetProcId() const{ return nProcId; }
+ UINT32 GetAddr() const { return nChain; }
+ USHORT GetId() const { return nId; }
+ USHORT GetTypeId() const{ return nTypeId; }
+ void SetTypeId( USHORT n ) { nTypeId = n; eType = SbxOBJECT; }
+ USHORT GetPos() const { return nPos; }
+ void SetLen( short n ){ nLen = n; }
+ short GetLen() const { return nLen; }
+ void SetDims( short n ) { nDims = n; }
+ short GetDims() const { return nDims; }
+ BOOL IsDefined() const{ return bChained; }
+ void SetOptional() { bOpt = TRUE; }
+ void SetParamArray() { bParamArray = TRUE; }
+ void SetByVal() { bByVal = TRUE; }
+ void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; }
+ void SetNew() { bNew = TRUE; }
+ void SetDefinedAs() { bAs = TRUE; }
+ void SetGlobal(BOOL b){ bGlobal = b; }
+ void SetDefaultId( USHORT n ) { nDefaultId = n; }
+ USHORT GetDefaultId( void ) { return nDefaultId; }
+ BOOL IsOptional() const{ return bOpt; }
+ BOOL IsParamArray() const{ return bParamArray; }
+ BOOL IsByVal() const { return bByVal; }
+ BOOL IsStatic() const { return bStatic; }
+ BOOL IsNew() const { return bNew; }
+ BOOL IsDefinedAs() const { return bAs; }
+ BOOL IsGlobal() const { return bGlobal; }
+
+ SbiSymPool& GetPool();
+ UINT32 Define(); // Symbol in Code definieren
+ UINT32 Reference(); // Symbol in Code referenzieren
+
+private:
+ SbiSymDef( const SbiSymDef& );
+
+};
+
+class SbiProcDef : public SbiSymDef { // Prozedur-Definition (aus Basic):
+ SbiSymPool aParams; // Parameter
+ SbiSymPool aLabels; // lokale Sprungziele
+ String aLibName; // LIB "name"
+ String aAlias; // ALIAS "name"
+ USHORT nLine1, nLine2; // Zeilenbereich
+ PropertyMode mePropMode; // Marks if this is a property procedure and which
+ String maPropName; // Property name if property procedure (!= proc name)
+ BOOL bCdecl : 1; // TRUE: CDECL angegeben
+ BOOL bPublic : 1; // TRUE: proc ist PUBLIC
+ BOOL mbProcDecl : 1; // TRUE: instanciated by SbiParser::ProcDecl
+public:
+ SbiProcDef( SbiParser*, const String&, BOOL bProcDecl=false );
+ virtual ~SbiProcDef();
+ virtual SbiProcDef* GetProcDef();
+ virtual void SetType( SbxDataType );
+ SbiSymPool& GetParams() { return aParams; }
+ SbiSymPool& GetLabels() { return aLabels; }
+ SbiSymPool& GetLocals() { return GetPool();}
+ String& GetLib() { return aLibName; }
+ String& GetAlias() { return aAlias; }
+ void SetPublic( BOOL b ) { bPublic = b; }
+ BOOL IsPublic() const { return bPublic; }
+ void SetCdecl( BOOL b = TRUE) { bCdecl = b; }
+ BOOL IsCdecl() const { return bCdecl; }
+ BOOL IsUsedForProcDecl() const { return mbProcDecl; }
+ void SetLine1( USHORT n ) { nLine1 = n; }
+ USHORT GetLine1() const { return nLine1; }
+ void SetLine2( USHORT n ) { nLine2 = n; }
+ USHORT GetLine2() const { return nLine2; }
+ PropertyMode getPropertyMode() { return mePropMode; }
+ void setPropertyMode( PropertyMode ePropMode );
+ const String& GetPropName() { return maPropName; }
+
+ // Match mit einer Forward-Deklaration. Die Parameternamen
+ // werden abgeglichen und die Forward-Deklaration wird
+ // durch this ersetzt
+ void Match( SbiProcDef* pForward );
+
+private:
+ SbiProcDef( const SbiProcDef& );
+
+};
+
+class SbiConstDef : public SbiSymDef
+{
+ double nVal;
+ String aVal;
+public:
+ SbiConstDef( const String& );
+ virtual ~SbiConstDef();
+ virtual SbiConstDef* GetConstDef();
+ void Set( double, SbxDataType );
+ void Set( const String& );
+ double GetValue() { return nVal; }
+ const String& GetString() { return aVal; }
+};
+
+
+#endif
+
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
new file mode 100644
index 000000000000..3dc1113b57d1
--- /dev/null
+++ b/basic/source/inc/token.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * 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 _TOKEN_HXX
+#define _TOKEN_HXX
+
+#include "scanner.hxx"
+#ifndef _SBDEF_HXX
+#include <basic/sbdef.hxx>
+#endif
+
+#if defined( SHARED )
+#define SbiTokenSHAREDTMPUNDEF
+#undef SHARED
+#endif
+
+// Der Tokenizer ist stand-alone, d.h. er kann von ueberallher verwendet
+// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne
+// BASIC werden die Fehler nur gezaehlt. Auch ist Basic notwendig, wenn
+// eine erweiterte SBX-Variable zur Erkennung von Datentypen etc. verwendet
+// werden soll.
+
+enum SbiToken {
+ NIL = 0,
+ // Token zwischen 0x20 und 0x3F sind Literale:
+ LPAREN = '(', RPAREN = ')', COMMA = ',', DOT = '.', EXCLAM = '!',
+ HASH = '#', SEMICOLON = ';',
+
+ // Anweisungen:
+ FIRSTKWD = 0x40,
+ AS = FIRSTKWD, ALIAS, ASSIGN,
+ CALL, CASE, CLOSE, COMPARE, _CONST_,
+ DECLARE, DIM, DO,
+
+ // in der Reihenfolge der Datentyp-Enums!
+ DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFCUR, DEFDATE, DEFSTR, DEFOBJ,
+ DEFERR, DEFBOOL, DEFVAR,
+ // in der Reihenfolge der Datentyp-Enums!
+ DATATYPE1,
+ TINTEGER = DATATYPE1,
+ TLONG, TSINGLE, TDOUBLE, TCURRENCY, TDATE, TSTRING, TOBJECT,
+ _ERROR_, TBOOLEAN, TVARIANT, TBYTE,
+ DATATYPE2 = TBYTE,
+
+ EACH, ELSE, ELSEIF, END, ERASE, EXIT,
+ FOR, FUNCTION,
+ GET, GLOBAL, GOSUB, GOTO,
+ IF, _IN_, INPUT,
+ LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET,
+ NAME, NEW, NEXT,
+ ON, OPEN, OPTION, IMPLEMENTS,
+ PRINT, PRIVATE, PROPERTY, PUBLIC,
+ REDIM, REM, RESUME, RETURN, RSET,
+ SELECT, SET, SHARED, STATIC, STEP, STOP, SUB,
+ TEXT, THEN, TO, TYPE, ENUM,
+ UNTIL,
+ WEND, WHILE, WITH, WRITE,
+ ENDENUM, ENDIF, ENDFUNC, ENDPROPERTY, ENDSUB, ENDTYPE, ENDSELECT, ENDWITH,
+ // Ende aller Keywords
+ LASTKWD = ENDWITH,
+ // Statement-Ende
+ EOS, EOLN,
+ // Operatoren:
+ EXPON, NEG, MUL,
+ DIV, IDIV, MOD, PLUS, MINUS,
+ EQ, NE, LT, GT, LE, GE,
+ NOT, AND, OR, XOR, EQV,
+ IMP, CAT, LIKE, IS, TYPEOF,
+ // Sonstiges:
+ FIRSTEXTRA,
+ NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, BYREF,
+ OUTPUT, RANDOM, APPEND, BINARY, ACCESS,
+ LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_,
+ EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY,
+
+ // Ab hier kommen JavaScript-Tokens (gleiches enum, damit gleicher Typ)
+ FIRSTJAVA,
+ JS_BREAK=FIRSTJAVA, JS_CONTINUE, JS_FOR, JS_FUNCTION, JS_IF, JS_NEW,
+ JS_RETURN, JS_THIS, JS_VAR, JS_WHILE, JS_WITH,
+
+ // JavaScript-Operatoren
+ // _ASS_ = Assignment
+ JS_COMMA, JS_ASSIGNMENT, JS_ASS_PLUS, JS_ASS_MINUS, JS_ASS_MUL,
+ JS_ASS_DIV, JS_ASS_MOD, JS_ASS_LSHIFT, JS_ASS_RSHIFT, JS_ASS_RSHIFT_Z,
+ JS_ASS_AND, JS_ASS_XOR, JS_ASS_OR,
+ JS_COND_QUEST, JS_COND_SEL, JS_LOG_OR, JS_LOG_AND, JS_BIT_OR,
+ JS_BIT_XOR, JS_BIT_AND, JS_EQ, JS_NE, JS_LT, JS_LE,
+ JS_GT, JS_GE, JS_LSHIFT, JS_RSHIFT, JS_RSHIFT_Z,
+ JS_PLUS, JS_MINUS, JS_MUL, JS_DIV, JS_MOD, JS_LOG_NOT, JS_BIT_NOT,
+ JS_INC, JS_DEC, JS_LPAREN, JS_RPAREN, JS_LINDEX, JS_RINDEX
+ , VBASUPPORT
+};
+
+#ifdef SbiTokenSHAREDTMPUNDEF
+#define SHARED
+#undef SbiTokenSHAREDTMPUNDEF
+#endif
+
+class SbiTokenizer : public SbiScanner {
+protected:
+ SbiToken eCurTok; // aktuelles Token
+ SbiToken ePush; // Pushback-Token
+ USHORT nPLine, nPCol1, nPCol2; // Pushback-Location
+ BOOL bEof; // TRUE bei Dateiende
+ BOOL bEos; // TRUE bei Statement-Ende
+ BOOL bKeywords; // TRUE, falls Keywords geparst werden
+ BOOL bAs; // letztes Keyword war AS
+ BOOL bErrorIsSymbol; // Handle Error token as Symbol, not keyword
+public:
+ SbiTokenizer( const ::rtl::OUString&, StarBASIC* = NULL );
+ ~SbiTokenizer();
+
+ inline BOOL IsEof() { return bEof; }
+ inline BOOL IsEos() { return bEos; }
+
+ void Push( SbiToken ); // Pushback eines Tokens
+ const String& Symbol( SbiToken );// Rueckumwandlung
+
+ SbiToken Peek(); // das naechste Token lesen
+ SbiToken Next(); // Ein Token lesen
+ BOOL MayBeLabel( BOOL= FALSE ); // Kann es ein Label sein?
+
+ void Hilite( SbTextPortions& ); // Syntax-Highlighting
+
+ void Error( SbError c ) { GenError( c ); }
+ void Error( SbError, SbiToken );
+ void Error( SbError, const char* );
+ void Error( SbError, String );
+
+ void Keywords( BOOL b ) { bKeywords = b; }
+
+ static BOOL IsEoln( SbiToken t )
+ { return BOOL( t == EOS || t == EOLN || t == REM ); }
+ static BOOL IsKwd( SbiToken t )
+ { return BOOL( t >= FIRSTKWD && t <= LASTKWD ); }
+ static BOOL IsExtra( SbiToken t )
+ { return BOOL( t >= FIRSTEXTRA ); }
+};
+
+
+#endif