1*234bd5c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*234bd5c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*234bd5c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*234bd5c5SAndrew Rist * distributed with this work for additional information 6*234bd5c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*234bd5c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*234bd5c5SAndrew Rist * "License"); you may not use this file except in compliance 9*234bd5c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*234bd5c5SAndrew Rist * 11*234bd5c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*234bd5c5SAndrew Rist * 13*234bd5c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*234bd5c5SAndrew Rist * software distributed under the License is distributed on an 15*234bd5c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*234bd5c5SAndrew Rist * KIND, either express or implied. See the License for the 17*234bd5c5SAndrew Rist * specific language governing permissions and limitations 18*234bd5c5SAndrew Rist * under the License. 19*234bd5c5SAndrew Rist * 20*234bd5c5SAndrew Rist *************************************************************/ 21*234bd5c5SAndrew Rist 22*234bd5c5SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SBX_SBXOBJECT_HXX 25cdf0e10cSrcweir #define _SBX_SBXOBJECT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svl/lstner.hxx> 28cdf0e10cSrcweir #include <basic/sbxvar.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 31cdf0e10cSrcweir 32cdf0e10cSrcweir class SbxProperty; 33cdf0e10cSrcweir class SvDispatch; 34cdf0e10cSrcweir 35cdf0e10cSrcweir class SbxObjectImpl; 36cdf0e10cSrcweir 37cdf0e10cSrcweir class SbxObject : public SbxVariable, public SfxListener 38cdf0e10cSrcweir { 39cdf0e10cSrcweir SbxObjectImpl* mpSbxObjectImpl; // Impl data 40cdf0e10cSrcweir 41cdf0e10cSrcweir SbxArray* FindVar( SbxVariable*, sal_uInt16& ); 42cdf0e10cSrcweir // AB 23.3.1997, special method for VCPtrRemove (see below) 43cdf0e10cSrcweir SbxArray* VCPtrFindVar( SbxVariable*, sal_uInt16& ); 44cdf0e10cSrcweir protected: 45cdf0e10cSrcweir SbxArrayRef pMethods; // Methods 46cdf0e10cSrcweir SbxArrayRef pProps; // Properties 47cdf0e10cSrcweir SbxArrayRef pObjs; // Objects 48cdf0e10cSrcweir SbxProperty* pDfltProp; // Default-Property 49cdf0e10cSrcweir String aClassName; // Classname 50cdf0e10cSrcweir String aDfltPropName; 51cdf0e10cSrcweir virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); 52cdf0e10cSrcweir virtual sal_Bool StoreData( SvStream& ) const; 53cdf0e10cSrcweir virtual ~SbxObject(); 54cdf0e10cSrcweir virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, 55cdf0e10cSrcweir const SfxHint& rHint, const TypeId& rHintType ); 56cdf0e10cSrcweir public: 57cdf0e10cSrcweir SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_OBJECT,1); 58cdf0e10cSrcweir TYPEINFO(); 59cdf0e10cSrcweir SbxObject( const String& rClassname ); 60cdf0e10cSrcweir SbxObject( const SbxObject& ); 61cdf0e10cSrcweir SbxObject& operator=( const SbxObject& ); 62cdf0e10cSrcweir virtual SbxDataType GetType() const; 63cdf0e10cSrcweir virtual SbxClassType GetClass() const; 64cdf0e10cSrcweir virtual void Clear(); 65cdf0e10cSrcweir 66cdf0e10cSrcweir virtual sal_Bool IsClass( const String& ) const; GetClassName() const67cdf0e10cSrcweir const String& GetClassName() const { return aClassName; } SetClassName(const String & rNew)68cdf0e10cSrcweir void SetClassName( const String &rNew ) { aClassName = rNew; } 69cdf0e10cSrcweir // Default-Property 70cdf0e10cSrcweir SbxProperty* GetDfltProperty(); 71cdf0e10cSrcweir void SetDfltProperty( const String& r ); 72cdf0e10cSrcweir void SetDfltProperty( SbxProperty* ); 73cdf0e10cSrcweir // Search for an element 74cdf0e10cSrcweir virtual SbxVariable* FindUserData( sal_uInt32 nUserData ); 75cdf0e10cSrcweir virtual SbxVariable* Find( const String&, SbxClassType ); 76cdf0e10cSrcweir SbxVariable* FindQualified( const String&, SbxClassType ); 77cdf0e10cSrcweir // Quick-Call-Interface for Methods 78cdf0e10cSrcweir virtual sal_Bool Call( const String&, SbxArray* = NULL ); 79cdf0e10cSrcweir // Execution of DDE-Commands 80cdf0e10cSrcweir SbxVariable* Execute( const String& ); 81cdf0e10cSrcweir // Manage elements GetAll(SbxClassType)82cdf0e10cSrcweir virtual sal_Bool GetAll( SbxClassType ) { return sal_True; } 83cdf0e10cSrcweir SbxVariable* Make( const String&, SbxClassType, SbxDataType ); 84cdf0e10cSrcweir virtual SbxObject* MakeObject( const String&, const String& ); 85cdf0e10cSrcweir virtual void Insert( SbxVariable* ); 86cdf0e10cSrcweir // AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and 87cdf0e10cSrcweir // without Broadcasts, only used in SO2/auto.cxx 88cdf0e10cSrcweir void QuickInsert( SbxVariable* ); 89cdf0e10cSrcweir // AB 23.3.1997, Special-Method, allow corresponding controls 90cdf0e10cSrcweir void VCPtrInsert( SbxVariable* ); 91cdf0e10cSrcweir virtual void Remove( const String&, SbxClassType ); 92cdf0e10cSrcweir virtual void Remove( SbxVariable* ); 93cdf0e10cSrcweir // AB 23.3.1997, deletion per pointer for controls (duplicate names!) 94cdf0e10cSrcweir void VCPtrRemove( SbxVariable* ); 95cdf0e10cSrcweir void SetPos( SbxVariable*, sal_uInt16 ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // Macro-Recording 98cdf0e10cSrcweir virtual String GenerateSource( const String &rLinePrefix, 99cdf0e10cSrcweir const SbxObject *pRelativeTo ); 100cdf0e10cSrcweir // Direct access on arrays GetMethods()101cdf0e10cSrcweir SbxArray* GetMethods() { return pMethods; } GetProperties()102cdf0e10cSrcweir SbxArray* GetProperties() { return pProps; } GetObjects()103cdf0e10cSrcweir SbxArray* GetObjects() { return pObjs; } 104cdf0e10cSrcweir // Hooks 105cdf0e10cSrcweir virtual SvDispatch* GetSvDispatch(); 106cdf0e10cSrcweir // Debugging 107cdf0e10cSrcweir void Dump( SvStream&, sal_Bool bDumpAll=sal_False ); 108cdf0e10cSrcweir 109cdf0e10cSrcweir static void GarbageCollection( sal_uIntPtr nObjects = 0 /* ::= all */ ); 110cdf0e10cSrcweir }; 111cdf0e10cSrcweir 112cdf0e10cSrcweir #ifndef __SBX_SBXOBJECTREF_HXX 113cdf0e10cSrcweir 114cdf0e10cSrcweir #ifndef SBX_OBJECT_DECL_DEFINED 115cdf0e10cSrcweir #define SBX_OBJECT_DECL_DEFINED 116cdf0e10cSrcweir SV_DECL_REF(SbxObject) 117cdf0e10cSrcweir #endif 118cdf0e10cSrcweir SV_IMPL_REF(SbxObject) 119cdf0e10cSrcweir 120cdf0e10cSrcweir #endif /* __SBX_SBXOBJECTREF_HXX */ 121cdf0e10cSrcweir #endif /* _SBX_SBXOBJECT_HXX */ 122