Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
21 : #define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
22 :
23 : #include <com/sun/star/uno/Sequence.hxx>
24 : #include <com/sun/star/uno/Reference.hxx>
25 : #include <com/sun/star/uno/Any.hxx>
26 : #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 : #include <com/sun/star/embed/XEmbedPersist.hpp>
28 : #include <cppuhelper/implbase2.hxx>
29 :
30 : namespace com { namespace sun { namespace star {
31 : namespace embed {
32 : class XStorage;
33 : }
34 : namespace util {
35 : class XCloseListener;
36 : }
37 : namespace beans {
38 : struct PropertyValue;
39 : struct NamedValue;
40 : }
41 : }}}
42 :
43 : namespace cppu {
44 : class OMultiTypeInterfaceContainerHelper;
45 : }
46 :
47 : class ODummyEmbeddedObject : public ::cppu::WeakImplHelper2
48 : < ::com::sun::star::embed::XEmbeddedObject
49 : , ::com::sun::star::embed::XEmbedPersist >
50 : {
51 : ::osl::Mutex m_aMutex;
52 : ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
53 : bool m_bDisposed;
54 :
55 : OUString m_aEntryName;
56 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage;
57 : sal_Int32 m_nObjectState;
58 :
59 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite;
60 :
61 : sal_Int64 m_nCachedAspect;
62 : ::com::sun::star::awt::Size m_aCachedSize;
63 : bool m_bHasCachedSize;
64 :
65 : // following information will be used between SaveAs and SaveCompleted
66 : bool m_bWaitSaveCompleted;
67 : OUString m_aNewEntryName;
68 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
69 :
70 : protected:
71 : void CheckInit_WrongState(); //throw WrongStateException on m_nObjectState == -1
72 : void CheckInit_Runtime(); //throw RuntimeException on m_nObjectState == -1
73 : void PostEvent_Impl( const OUString& aEventName );
74 :
75 : public:
76 :
77 152 : ODummyEmbeddedObject()
78 : : m_pInterfaceContainer( NULL )
79 : , m_bDisposed( false )
80 : , m_nObjectState( -1 )
81 : , m_nCachedAspect( 0 )
82 : , m_bHasCachedSize( false )
83 152 : , m_bWaitSaveCompleted( false )
84 152 : {}
85 :
86 : virtual ~ODummyEmbeddedObject();
87 :
88 : // XEmbeddedObject
89 :
90 : virtual void SAL_CALL changeState( sal_Int32 nNewState )
91 : throw ( ::com::sun::star::embed::UnreachableStateException,
92 : ::com::sun::star::embed::WrongStateException,
93 : ::com::sun::star::uno::Exception,
94 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
95 :
96 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates()
97 : throw ( ::com::sun::star::embed::WrongStateException,
98 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
99 :
100 : virtual sal_Int32 SAL_CALL getCurrentState()
101 : throw ( ::com::sun::star::embed::WrongStateException,
102 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
103 :
104 : virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
105 : throw ( ::com::sun::star::lang::IllegalArgumentException,
106 : ::com::sun::star::embed::WrongStateException,
107 : ::com::sun::star::embed::UnreachableStateException,
108 : ::com::sun::star::uno::Exception,
109 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
110 :
111 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs()
112 : throw ( ::com::sun::star::embed::WrongStateException,
113 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
114 :
115 : virtual void SAL_CALL setClientSite(
116 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient )
117 : throw ( ::com::sun::star::embed::WrongStateException,
118 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
119 :
120 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite()
121 : throw ( ::com::sun::star::embed::WrongStateException,
122 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
123 :
124 : virtual void SAL_CALL update()
125 : throw ( ::com::sun::star::embed::WrongStateException,
126 : ::com::sun::star::uno::Exception,
127 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
128 :
129 : virtual void SAL_CALL setUpdateMode( sal_Int32 nMode )
130 : throw ( ::com::sun::star::embed::WrongStateException,
131 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
132 :
133 : virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect )
134 : throw ( ::com::sun::star::embed::WrongStateException,
135 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
136 :
137 : virtual void SAL_CALL setContainerName( const OUString& sName )
138 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
139 :
140 :
141 : // XVisualObject
142 :
143 : virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
144 : throw ( ::com::sun::star::lang::IllegalArgumentException,
145 : ::com::sun::star::embed::WrongStateException,
146 : ::com::sun::star::uno::Exception,
147 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
148 :
149 : virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
150 : throw ( ::com::sun::star::lang::IllegalArgumentException,
151 : ::com::sun::star::embed::WrongStateException,
152 : ::com::sun::star::uno::Exception,
153 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
154 :
155 : virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
156 : throw ( ::com::sun::star::lang::IllegalArgumentException,
157 : ::com::sun::star::embed::WrongStateException,
158 : ::com::sun::star::uno::Exception,
159 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
160 :
161 : virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
162 : throw ( ::com::sun::star::uno::Exception,
163 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 :
165 : // XEmbedPersist
166 :
167 : virtual void SAL_CALL setPersistentEntry(
168 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
169 : const OUString& sEntName,
170 : sal_Int32 nEntryConnectionMode,
171 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
172 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
173 : throw ( ::com::sun::star::lang::IllegalArgumentException,
174 : ::com::sun::star::embed::WrongStateException,
175 : ::com::sun::star::io::IOException,
176 : ::com::sun::star::uno::Exception,
177 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
178 :
179 : virtual void SAL_CALL storeToEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const 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 )
180 : throw ( ::com::sun::star::lang::IllegalArgumentException,
181 : ::com::sun::star::embed::WrongStateException,
182 : ::com::sun::star::io::IOException,
183 : ::com::sun::star::uno::Exception,
184 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
185 :
186 : virtual void SAL_CALL storeAsEntry(
187 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
188 : const OUString& sEntName,
189 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
190 : 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, std::exception ) SAL_OVERRIDE;
196 :
197 : virtual void SAL_CALL saveCompleted( sal_Bool bUseNew )
198 : throw ( ::com::sun::star::embed::WrongStateException,
199 : ::com::sun::star::uno::Exception,
200 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
201 :
202 : virtual sal_Bool SAL_CALL hasEntry()
203 : throw ( ::com::sun::star::embed::WrongStateException,
204 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
205 :
206 : virtual OUString SAL_CALL getEntryName()
207 : throw ( ::com::sun::star::embed::WrongStateException,
208 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
209 :
210 :
211 : // XCommonEmbedPersist
212 :
213 : virtual void SAL_CALL storeOwn()
214 : throw ( ::com::sun::star::embed::WrongStateException,
215 : ::com::sun::star::io::IOException,
216 : ::com::sun::star::uno::Exception,
217 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
218 :
219 : virtual sal_Bool SAL_CALL isReadonly()
220 : throw ( ::com::sun::star::embed::WrongStateException,
221 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
222 :
223 : virtual void SAL_CALL reload(
224 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
225 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
226 : throw ( ::com::sun::star::lang::IllegalArgumentException,
227 : ::com::sun::star::embed::WrongStateException,
228 : ::com::sun::star::io::IOException,
229 : ::com::sun::star::uno::Exception,
230 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
231 :
232 :
233 : // XClassifiedObject
234 :
235 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID()
236 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
237 :
238 : virtual OUString SAL_CALL getClassName()
239 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
240 :
241 : virtual void SAL_CALL setClassInfo(
242 : const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName )
243 : throw ( ::com::sun::star::lang::NoSupportException,
244 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
245 :
246 :
247 : // XComponentSupplier
248 :
249 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent()
250 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
251 :
252 : // XStateChangeBroadcaster
253 : virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
254 : virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 :
256 : // XCloseable
257 :
258 : virtual void SAL_CALL close( sal_Bool DeliverOwnership )
259 : throw ( ::com::sun::star::util::CloseVetoException,
260 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
261 :
262 : virtual void SAL_CALL addCloseListener(
263 : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
264 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
265 :
266 : virtual void SAL_CALL removeCloseListener(
267 : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
268 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
269 :
270 : // XEventBroadcaster
271 : virtual void SAL_CALL addEventListener(
272 : const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
273 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
274 :
275 : virtual void SAL_CALL removeEventListener(
276 : const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
277 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
278 :
279 : };
280 :
281 : #endif
282 :
283 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|