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