1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
21 #define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
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>
30 namespace com
{ namespace sun
{ namespace star
{
44 class OMultiTypeInterfaceContainerHelper
;
47 class ODummyEmbeddedObject
: public ::cppu::WeakImplHelper2
48 < ::com::sun::star::embed::XEmbeddedObject
49 , ::com::sun::star::embed::XEmbedPersist
>
51 ::osl::Mutex m_aMutex
;
52 ::cppu::OMultiTypeInterfaceContainerHelper
* m_pInterfaceContainer
;
55 OUString m_aEntryName
;
56 ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> m_xParentStorage
;
57 sal_Int32 m_nObjectState
;
59 ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XEmbeddedClient
> m_xClientSite
;
61 sal_Int64 m_nCachedAspect
;
62 ::com::sun::star::awt::Size m_aCachedSize
;
63 bool m_bHasCachedSize
;
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
;
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
);
77 ODummyEmbeddedObject()
78 : m_pInterfaceContainer( NULL
)
79 , m_bDisposed( false )
80 , m_nObjectState( -1 )
81 , m_nCachedAspect( 0 )
82 , m_bHasCachedSize( false )
83 , m_bWaitSaveCompleted( false )
86 virtual ~ODummyEmbeddedObject();
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
;
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
;
100 virtual sal_Int32 SAL_CALL
getCurrentState()
101 throw ( ::com::sun::star::embed::WrongStateException
,
102 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
137 virtual void SAL_CALL
setContainerName( const OUString
& sName
)
138 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
202 virtual sal_Bool SAL_CALL
hasEntry()
203 throw ( ::com::sun::star::embed::WrongStateException
,
204 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
206 virtual OUString SAL_CALL
getEntryName()
207 throw ( ::com::sun::star::embed::WrongStateException
,
208 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
211 // XCommonEmbedPersist
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
;
219 virtual sal_Bool SAL_CALL
isReadonly()
220 throw ( ::com::sun::star::embed::WrongStateException
,
221 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
235 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getClassID()
236 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
238 virtual OUString SAL_CALL
getClassName()
239 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
247 // XComponentSupplier
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
;
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
;
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
;
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
;
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
;
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
;
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
;
283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */