xref: /trunk/main/embeddedobj/source/inc/dummyobject.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _INC_DUMMYOBJECT_HXX_
29 #define _INC_DUMMYOBJECT_HXX_
30 
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/uno/Reference.hxx>
33 #include <com/sun/star/uno/Any.hxx>
34 #include <com/sun/star/embed/XEmbeddedObject.hpp>
35 #include <com/sun/star/embed/XEmbedPersist.hpp>
36 #include <cppuhelper/implbase2.hxx>
37 
38 namespace com { namespace sun { namespace star {
39     namespace embed {
40         class XStorage;
41     }
42     namespace frame {
43         class XModel;
44         class XFrame;
45     }
46     namespace lang {
47         class XMultiServiceFactory;
48     }
49     namespace util {
50         class XCloseListener;
51     }
52     namespace beans {
53         struct PropertyValue;
54         struct NamedValue;
55     }
56 }}}
57 
58 namespace cppu {
59     class OMultiTypeInterfaceContainerHelper;
60 }
61 
62 class ODummyEmbeddedObject : public ::cppu::WeakImplHelper2
63                         < ::com::sun::star::embed::XEmbeddedObject
64                         , ::com::sun::star::embed::XEmbedPersist >
65 {
66     ::osl::Mutex    m_aMutex;
67     ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
68     sal_Bool m_bDisposed;
69 
70     ::rtl::OUString m_aEntryName;
71     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage;
72     sal_Int32 m_nObjectState;
73 
74     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite;
75 
76     sal_Int64 m_nCachedAspect;
77     ::com::sun::star::awt::Size m_aCachedSize;
78     sal_Bool m_bHasCachedSize;
79 
80     // following information will be used between SaveAs and SaveCompleted
81     sal_Bool m_bWaitSaveCompleted;
82     ::rtl::OUString m_aNewEntryName;
83     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
84 
85 protected:
86     void CheckInit();
87     void PostEvent_Impl( const ::rtl::OUString& aEventName,
88                         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xSource );
89 
90 public:
91 
92     ODummyEmbeddedObject()
93     : m_pInterfaceContainer( NULL )
94     , m_bDisposed( sal_False )
95     , m_nObjectState( -1 )
96     , m_nCachedAspect( 0 )
97     , m_bHasCachedSize( sal_False )
98     , m_bWaitSaveCompleted( sal_False )
99     {}
100 
101     ~ODummyEmbeddedObject();
102 
103 // XEmbeddedObject
104 
105     virtual void SAL_CALL changeState( sal_Int32 nNewState )
106         throw ( ::com::sun::star::embed::UnreachableStateException,
107                 ::com::sun::star::embed::WrongStateException,
108                 ::com::sun::star::uno::Exception,
109                 ::com::sun::star::uno::RuntimeException );
110 
111     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates()
112         throw ( ::com::sun::star::embed::WrongStateException,
113                 ::com::sun::star::uno::RuntimeException );
114 
115     virtual sal_Int32 SAL_CALL getCurrentState()
116         throw ( ::com::sun::star::embed::WrongStateException,
117                 ::com::sun::star::uno::RuntimeException );
118 
119     virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
120         throw ( ::com::sun::star::lang::IllegalArgumentException,
121                 ::com::sun::star::embed::WrongStateException,
122                 ::com::sun::star::embed::UnreachableStateException,
123                 ::com::sun::star::uno::Exception,
124                 ::com::sun::star::uno::RuntimeException );
125 
126     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs()
127         throw ( ::com::sun::star::embed::WrongStateException,
128                 ::com::sun::star::uno::RuntimeException );
129 
130     virtual void SAL_CALL setClientSite(
131                 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient )
132         throw ( ::com::sun::star::embed::WrongStateException,
133                 ::com::sun::star::uno::RuntimeException );
134 
135     virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite()
136         throw ( ::com::sun::star::embed::WrongStateException,
137                 ::com::sun::star::uno::RuntimeException );
138 
139     virtual void SAL_CALL update()
140         throw ( ::com::sun::star::embed::WrongStateException,
141                 ::com::sun::star::uno::Exception,
142                 ::com::sun::star::uno::RuntimeException );
143 
144     virtual void SAL_CALL setUpdateMode( sal_Int32 nMode )
145         throw ( ::com::sun::star::embed::WrongStateException,
146                 ::com::sun::star::uno::RuntimeException );
147 
148     virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect )
149         throw ( ::com::sun::star::embed::WrongStateException,
150                 ::com::sun::star::uno::RuntimeException );
151 
152     virtual void SAL_CALL setContainerName( const ::rtl::OUString& sName )
153         throw ( ::com::sun::star::uno::RuntimeException );
154 
155 
156 // XVisualObject
157 
158     virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
159         throw ( ::com::sun::star::lang::IllegalArgumentException,
160                 ::com::sun::star::embed::WrongStateException,
161                 ::com::sun::star::uno::Exception,
162                 ::com::sun::star::uno::RuntimeException );
163 
164     virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
165         throw ( ::com::sun::star::lang::IllegalArgumentException,
166                 ::com::sun::star::embed::WrongStateException,
167                 ::com::sun::star::uno::Exception,
168                 ::com::sun::star::uno::RuntimeException );
169 
170     virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
171         throw ( ::com::sun::star::lang::IllegalArgumentException,
172                 ::com::sun::star::embed::WrongStateException,
173                 ::com::sun::star::uno::Exception,
174                 ::com::sun::star::uno::RuntimeException );
175 
176     virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
177         throw ( ::com::sun::star::uno::Exception,
178                 ::com::sun::star::uno::RuntimeException);
179 
180 // XEmbedPersist
181 
182     virtual void SAL_CALL setPersistentEntry(
183                     const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
184                     const ::rtl::OUString& sEntName,
185                     sal_Int32 nEntryConnectionMode,
186                     const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
187                     const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
188         throw ( ::com::sun::star::lang::IllegalArgumentException,
189                 ::com::sun::star::embed::WrongStateException,
190                 ::com::sun::star::io::IOException,
191                 ::com::sun::star::uno::Exception,
192                 ::com::sun::star::uno::RuntimeException );
193 
194     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 )
195         throw ( ::com::sun::star::lang::IllegalArgumentException,
196                 ::com::sun::star::embed::WrongStateException,
197                 ::com::sun::star::io::IOException,
198                 ::com::sun::star::uno::Exception,
199                 ::com::sun::star::uno::RuntimeException );
200 
201     virtual void SAL_CALL storeAsEntry(
202                 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
203                 const ::rtl::OUString& sEntName,
204                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
205                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
206         throw ( ::com::sun::star::lang::IllegalArgumentException,
207                 ::com::sun::star::embed::WrongStateException,
208                 ::com::sun::star::io::IOException,
209                 ::com::sun::star::uno::Exception,
210                 ::com::sun::star::uno::RuntimeException );
211 
212     virtual void SAL_CALL saveCompleted( sal_Bool bUseNew )
213         throw ( ::com::sun::star::embed::WrongStateException,
214                 ::com::sun::star::uno::Exception,
215                 ::com::sun::star::uno::RuntimeException );
216 
217     virtual sal_Bool SAL_CALL hasEntry()
218         throw ( ::com::sun::star::embed::WrongStateException,
219                 ::com::sun::star::uno::RuntimeException );
220 
221     virtual ::rtl::OUString SAL_CALL getEntryName()
222         throw ( ::com::sun::star::embed::WrongStateException,
223                 ::com::sun::star::uno::RuntimeException );
224 
225 
226 // XCommonEmbedPersist
227 
228     virtual void SAL_CALL storeOwn()
229         throw ( ::com::sun::star::embed::WrongStateException,
230                 ::com::sun::star::io::IOException,
231                 ::com::sun::star::uno::Exception,
232                 ::com::sun::star::uno::RuntimeException );
233 
234     virtual sal_Bool SAL_CALL isReadonly()
235         throw ( ::com::sun::star::embed::WrongStateException,
236                 ::com::sun::star::uno::RuntimeException );
237 
238     virtual void SAL_CALL reload(
239                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
240                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
241         throw ( ::com::sun::star::lang::IllegalArgumentException,
242                 ::com::sun::star::embed::WrongStateException,
243                 ::com::sun::star::io::IOException,
244                 ::com::sun::star::uno::Exception,
245                 ::com::sun::star::uno::RuntimeException );
246 
247 
248 // XClassifiedObject
249 
250     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID()
251         throw ( ::com::sun::star::uno::RuntimeException );
252 
253     virtual ::rtl::OUString SAL_CALL getClassName()
254         throw ( ::com::sun::star::uno::RuntimeException );
255 
256     virtual void SAL_CALL setClassInfo(
257                 const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
258         throw ( ::com::sun::star::lang::NoSupportException,
259                 ::com::sun::star::uno::RuntimeException );
260 
261 
262 // XComponentSupplier
263 
264     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent()
265         throw ( ::com::sun::star::uno::RuntimeException );
266 
267 // XStateChangeBroadcaster
268     virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
269     virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
270 
271 // XCloseable
272 
273     virtual void SAL_CALL close( sal_Bool DeliverOwnership )
274         throw ( ::com::sun::star::util::CloseVetoException,
275                 ::com::sun::star::uno::RuntimeException );
276 
277     virtual void SAL_CALL addCloseListener(
278                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
279         throw ( ::com::sun::star::uno::RuntimeException );
280 
281     virtual void SAL_CALL removeCloseListener(
282                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
283         throw ( ::com::sun::star::uno::RuntimeException );
284 
285 // XEventBroadcaster
286     virtual void SAL_CALL addEventListener(
287                 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
288         throw ( ::com::sun::star::uno::RuntimeException );
289 
290     virtual void SAL_CALL removeEventListener(
291                 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
292         throw ( ::com::sun::star::uno::RuntimeException );
293 
294 };
295 
296 #endif
297 
298