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 #ifndef _SB_OBJMOD_HXX 24 #define _SB_OBJMOD_HXX 25 26 #include <rtl/ref.hxx> 27 #include <basic/sbmod.hxx> 28 #include <basic/sbstar.hxx> 29 #include <com/sun/star/script/ModuleInfo.hpp> 30 #include <com/sun/star/lang/XEventListener.hpp> 31 #include <com/sun/star/awt/XDialog.hpp> 32 #include <com/sun/star/frame/XModel.hpp> 33 34 namespace css = ::com::sun::star; 35 36 // Basic-Module for excel object. 37 38 class SbObjModule : public SbModule 39 { 40 SbObjModule( const SbObjModule& ); 41 SbObjModule(); 42 43 protected: 44 virtual ~SbObjModule(); 45 46 public: 47 TYPEINFO(); 48 SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible ); 49 virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); 50 51 virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, 52 const SfxHint& rHint, const TypeId& rHintType ); 53 54 using SbxValue::GetObject; 55 SbxVariable* GetObject(); 56 void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ; 57 }; 58 59 class FormObjEventListenerImpl; 60 61 class SbUserFormModule : public SbObjModule 62 { 63 com::sun::star::script::ModuleInfo m_mInfo; 64 ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener; 65 css::uno::Reference<css::awt::XDialog> m_xDialog; 66 css::uno::Reference<css::frame::XModel> m_xModel; 67 String sFormName; 68 bool mbInit; 69 SbUserFormModule( const SbUserFormModule& ); 70 SbUserFormModule(); 71 72 //protected: 73 virtual void InitObject(); 74 public: 75 TYPEINFO(); 76 SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); 77 virtual ~SbUserFormModule(); 78 virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); 79 void ResetApiObj( bool bTriggerTerminateEvent = true ); 80 void Unload(); 81 void Load(); 82 void triggerMethod( const String& ); 83 void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& ); 84 void triggerActivateEvent(); 85 void triggerDeactivateEvent(); 86 void triggerInitializeEvent(); 87 void triggerTerminateEvent(); 88 void triggerLayoutEvent(); 89 void triggerResizeEvent(); 90 getInitState(void)91 bool getInitState( void ) 92 { return mbInit; } setInitState(bool bInit)93 void setInitState( bool bInit ) 94 { mbInit = bInit; } 95 96 class SbUserFormModuleInstance* CreateInstance(); 97 }; 98 99 class SbUserFormModuleInstance : public SbUserFormModule 100 { 101 SbUserFormModule* m_pParentModule; 102 103 public: 104 SbUserFormModuleInstance( SbUserFormModule* pParentModule, const String& rName, 105 const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); 106 107 virtual sal_Bool IsClass( const String& ) const; 108 virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); 109 }; 110 111 112 #ifndef __SB_SBOBJMODULEREF_HXX 113 #define __SB_SBOBJMODULEREF_HXX 114 115 SV_DECL_IMPL_REF(SbObjModule); 116 117 #endif 118 #endif 119 120