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 _INC_DUMMYOBJECT_HXX_
25 #define _INC_DUMMYOBJECT_HXX_
26 
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <com/sun/star/uno/Any.hxx>
30 #include <com/sun/star/embed/XEmbeddedObject.hpp>
31 #include <com/sun/star/embed/XEmbedPersist.hpp>
32 #include <cppuhelper/implbase2.hxx>
33 
34 namespace com { namespace sun { namespace star {
35 	namespace embed {
36 		class XStorage;
37 	}
38 	namespace frame {
39 		class XModel;
40 		class XFrame;
41 	}
42 	namespace lang {
43 		class XMultiServiceFactory;
44 	}
45 	namespace util {
46 		class XCloseListener;
47 	}
48 	namespace beans {
49 		struct PropertyValue;
50 		struct NamedValue;
51 	}
52 }}}
53 
54 namespace cppu {
55 	class OMultiTypeInterfaceContainerHelper;
56 }
57 
58 class ODummyEmbeddedObject : public ::cppu::WeakImplHelper2
59 						< ::com::sun::star::embed::XEmbeddedObject
60 						, ::com::sun::star::embed::XEmbedPersist >
61 {
62 	::osl::Mutex	m_aMutex;
63 	::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
64 	sal_Bool m_bDisposed;
65 
66 	::rtl::OUString m_aEntryName;
67 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage;
68 	sal_Int32 m_nObjectState;
69 
70 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite;
71 
72 	sal_Int64 m_nCachedAspect;
73 	::com::sun::star::awt::Size m_aCachedSize;
74 	sal_Bool m_bHasCachedSize;
75 
76 	// following information will be used between SaveAs and SaveCompleted
77 	sal_Bool m_bWaitSaveCompleted;
78 	::rtl::OUString m_aNewEntryName;
79 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
80 
81 protected:
82 	void CheckInit();
83 	void PostEvent_Impl( const ::rtl::OUString& aEventName,
84 						const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xSource );
85 
86 public:
87 
ODummyEmbeddedObject()88 	ODummyEmbeddedObject()
89 	: m_pInterfaceContainer( NULL )
90 	, m_bDisposed( sal_False )
91 	, m_nObjectState( -1 )
92 	, m_nCachedAspect( 0 )
93 	, m_bHasCachedSize( sal_False )
94 	, m_bWaitSaveCompleted( sal_False )
95 	{}
96 
97 	~ODummyEmbeddedObject();
98 
99 // XEmbeddedObject
100 
101     virtual void SAL_CALL changeState( sal_Int32 nNewState )
102 		throw ( ::com::sun::star::embed::UnreachableStateException,
103 				::com::sun::star::embed::WrongStateException,
104 				::com::sun::star::uno::Exception,
105 				::com::sun::star::uno::RuntimeException );
106 
107     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates()
108 		throw ( ::com::sun::star::embed::WrongStateException,
109 				::com::sun::star::uno::RuntimeException );
110 
111     virtual sal_Int32 SAL_CALL getCurrentState()
112 		throw ( ::com::sun::star::embed::WrongStateException,
113 				::com::sun::star::uno::RuntimeException );
114 
115     virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
116 		throw ( ::com::sun::star::lang::IllegalArgumentException,
117 				::com::sun::star::embed::WrongStateException,
118 				::com::sun::star::embed::UnreachableStateException,
119 				::com::sun::star::uno::Exception,
120 				::com::sun::star::uno::RuntimeException );
121 
122     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs()
123 		throw ( ::com::sun::star::embed::WrongStateException,
124 				::com::sun::star::uno::RuntimeException );
125 
126     virtual void SAL_CALL setClientSite(
127 				const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient )
128 		throw ( ::com::sun::star::embed::WrongStateException,
129 				::com::sun::star::uno::RuntimeException );
130 
131     virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite()
132 		throw ( ::com::sun::star::embed::WrongStateException,
133 				::com::sun::star::uno::RuntimeException );
134 
135     virtual void SAL_CALL update()
136 		throw ( ::com::sun::star::embed::WrongStateException,
137 				::com::sun::star::uno::Exception,
138 				::com::sun::star::uno::RuntimeException );
139 
140     virtual void SAL_CALL setUpdateMode( sal_Int32 nMode )
141 		throw ( ::com::sun::star::embed::WrongStateException,
142 				::com::sun::star::uno::RuntimeException );
143 
144     virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect )
145 		throw ( ::com::sun::star::embed::WrongStateException,
146 				::com::sun::star::uno::RuntimeException );
147 
148     virtual void SAL_CALL setContainerName( const ::rtl::OUString& sName )
149 		throw ( ::com::sun::star::uno::RuntimeException );
150 
151 
152 // XVisualObject
153 
154     virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
155 		throw ( ::com::sun::star::lang::IllegalArgumentException,
156 				::com::sun::star::embed::WrongStateException,
157 				::com::sun::star::uno::Exception,
158 				::com::sun::star::uno::RuntimeException );
159 
160     virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
161 		throw ( ::com::sun::star::lang::IllegalArgumentException,
162 				::com::sun::star::embed::WrongStateException,
163 				::com::sun::star::uno::Exception,
164 				::com::sun::star::uno::RuntimeException );
165 
166     virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
167 		throw ( ::com::sun::star::lang::IllegalArgumentException,
168 				::com::sun::star::embed::WrongStateException,
169 				::com::sun::star::uno::Exception,
170 				::com::sun::star::uno::RuntimeException );
171 
172     virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
173 		throw ( ::com::sun::star::uno::Exception,
174 				::com::sun::star::uno::RuntimeException);
175 
176 // XEmbedPersist
177 
178     virtual void SAL_CALL setPersistentEntry(
179 					const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
180 					const ::rtl::OUString& sEntName,
181 					sal_Int32 nEntryConnectionMode,
182 					const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
183 					const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
184 		throw ( ::com::sun::star::lang::IllegalArgumentException,
185 				::com::sun::star::embed::WrongStateException,
186 				::com::sun::star::io::IOException,
187 				::com::sun::star::uno::Exception,
188 				::com::sun::star::uno::RuntimeException );
189 
190     virtual void SAL_CALL storeToEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
191 		throw ( ::com::sun::star::lang::IllegalArgumentException,
192 				::com::sun::star::embed::WrongStateException,
193 				::com::sun::star::io::IOException,
194 				::com::sun::star::uno::Exception,
195 				::com::sun::star::uno::RuntimeException );
196 
197     virtual void SAL_CALL storeAsEntry(
198 				const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
199 				const ::rtl::OUString& sEntName,
200 				const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
201 				const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
202 		throw ( ::com::sun::star::lang::IllegalArgumentException,
203 				::com::sun::star::embed::WrongStateException,
204 				::com::sun::star::io::IOException,
205 				::com::sun::star::uno::Exception,
206 				::com::sun::star::uno::RuntimeException );
207 
208     virtual void SAL_CALL saveCompleted( sal_Bool bUseNew )
209 		throw ( ::com::sun::star::embed::WrongStateException,
210 				::com::sun::star::uno::Exception,
211 				::com::sun::star::uno::RuntimeException );
212 
213     virtual sal_Bool SAL_CALL hasEntry()
214 		throw ( ::com::sun::star::embed::WrongStateException,
215 				::com::sun::star::uno::RuntimeException );
216 
217     virtual ::rtl::OUString SAL_CALL getEntryName()
218 		throw ( ::com::sun::star::embed::WrongStateException,
219 				::com::sun::star::uno::RuntimeException );
220 
221 
222 // XCommonEmbedPersist
223 
224     virtual void SAL_CALL storeOwn()
225 		throw ( ::com::sun::star::embed::WrongStateException,
226 				::com::sun::star::io::IOException,
227 				::com::sun::star::uno::Exception,
228 				::com::sun::star::uno::RuntimeException );
229 
230     virtual sal_Bool SAL_CALL isReadonly()
231 		throw ( ::com::sun::star::embed::WrongStateException,
232 				::com::sun::star::uno::RuntimeException );
233 
234     virtual void SAL_CALL reload(
235 				const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
236 				const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
237 		throw ( ::com::sun::star::lang::IllegalArgumentException,
238 				::com::sun::star::embed::WrongStateException,
239 				::com::sun::star::io::IOException,
240 				::com::sun::star::uno::Exception,
241 				::com::sun::star::uno::RuntimeException );
242 
243 
244 // XClassifiedObject
245 
246 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID()
247 		throw ( ::com::sun::star::uno::RuntimeException );
248 
249     virtual ::rtl::OUString SAL_CALL getClassName()
250 		throw ( ::com::sun::star::uno::RuntimeException );
251 
252     virtual void SAL_CALL setClassInfo(
253 				const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
254 		throw ( ::com::sun::star::lang::NoSupportException,
255 				::com::sun::star::uno::RuntimeException );
256 
257 
258 // XComponentSupplier
259 
260     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent()
261 		throw ( ::com::sun::star::uno::RuntimeException );
262 
263 // XStateChangeBroadcaster
264     virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
265     virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
266 
267 // XCloseable
268 
269     virtual void SAL_CALL close( sal_Bool DeliverOwnership )
270 		throw ( ::com::sun::star::util::CloseVetoException,
271 				::com::sun::star::uno::RuntimeException );
272 
273     virtual void SAL_CALL addCloseListener(
274 				const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
275 		throw ( ::com::sun::star::uno::RuntimeException );
276 
277     virtual void SAL_CALL removeCloseListener(
278 				const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
279 		throw ( ::com::sun::star::uno::RuntimeException );
280 
281 // XEventBroadcaster
282     virtual void SAL_CALL addEventListener(
283 				const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
284 		throw ( ::com::sun::star::uno::RuntimeException );
285 
286     virtual void SAL_CALL removeEventListener(
287 				const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
288 		throw ( ::com::sun::star::uno::RuntimeException );
289 
290 };
291 
292 #endif
293 
294