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