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 #include <com/sun/star/embed/EmbedStates.hpp>
21 #include <com/sun/star/embed/EmbedVerbs.hpp>
22 #include <com/sun/star/embed/EmbedUpdateModes.hpp>
23 #include <com/sun/star/embed/XEmbeddedClient.hpp>
24 #include <com/sun/star/embed/XInplaceClient.hpp>
25 #include <com/sun/star/embed/XWindowSupplier.hpp>
26 #include <com/sun/star/embed/StateChangeInProgressException.hpp>
27 #include <com/sun/star/embed/Aspects.hpp>
29 #include <com/sun/star/awt/XWindowPeer.hpp>
30 #include <com/sun/star/util/XCloseBroadcaster.hpp>
31 #include <com/sun/star/util/XCloseable.hpp>
32 #include <com/sun/star/util/XModifiable.hpp>
33 #include <com/sun/star/frame/XFrame.hpp>
34 #include <com/sun/star/frame/XComponentLoader.hpp>
35 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
36 #include <com/sun/star/frame/ModuleManager.hpp>
37 #include <com/sun/star/lang/DisposedException.hpp>
39 #include <com/sun/star/embed/EmbedMisc.hpp>
40 #include <comphelper/processfactory.hxx>
42 #include <vcl/svapp.hxx>
44 #include <targetstatecontrol.hxx>
46 #include "commonembobj.hxx"
47 #include "intercept.hxx"
50 using namespace ::com::sun::star
;
52 awt::Rectangle
GetRectangleInterception( const awt::Rectangle
& aRect1
, const awt::Rectangle
& aRect2
)
54 awt::Rectangle aResult
;
56 OSL_ENSURE( aRect1
.Width
>= 0 && aRect2
.Width
>= 0 && aRect1
.Height
>= 0 && aRect2
.Height
>= 0,
57 "Offset must not be less then zero!" );
59 aResult
.X
= aRect1
.X
> aRect2
.X
? aRect1
.X
: aRect2
.X
;
60 aResult
.Y
= aRect1
.Y
> aRect2
.Y
? aRect1
.Y
: aRect2
.Y
;
62 sal_Int32 nRight1
= aRect1
.X
+ aRect1
.Width
;
63 sal_Int32 nBottom1
= aRect1
.Y
+ aRect1
.Height
;
64 sal_Int32 nRight2
= aRect2
.X
+ aRect2
.Width
;
65 sal_Int32 nBottom2
= aRect2
.Y
+ aRect2
.Height
;
66 aResult
.Width
= ( nRight1
< nRight2
? nRight1
: nRight2
) - aResult
.X
;
67 aResult
.Height
= ( nBottom1
< nBottom2
? nBottom1
: nBottom2
) - aResult
.Y
;
72 //----------------------------------------------
73 sal_Int32
OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb
)
75 for ( sal_Int32 nInd
= 0; nInd
< m_aVerbTable
.getLength(); nInd
++ )
76 if ( m_aVerbTable
[nInd
][0] == nVerb
)
77 return m_aVerbTable
[nInd
][1];
79 throw lang::IllegalArgumentException(); // TODO: unexpected verb provided
82 //----------------------------------------------
83 void OCommonEmbeddedObject::Deactivate()
85 uno::Reference
< util::XModifiable
> xModif( m_pDocHolder
->GetComponent(), uno::UNO_QUERY
);
87 // no need to lock for the initialization
88 uno::Reference
< embed::XEmbeddedClient
> xClientSite
= m_xClientSite
;
89 if ( !xClientSite
.is() )
90 throw embed::WrongStateException(); //TODO: client site is not set!
92 // store document if it is modified
93 if ( xModif
.is() && xModif
->isModified() )
96 xClientSite
->saveObject();
98 catch( const embed::ObjectSaveVetoException
& )
101 catch( const uno::Exception
& e
)
103 throw embed::StorageWrappedTargetException(
104 OUString( "The client could not store the object!" ),
105 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >( this ) ),
110 m_pDocHolder
->CloseFrame();
112 xClientSite
->visibilityChanged( sal_False
);
115 //----------------------------------------------
116 void OCommonEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange
, sal_Int32 nOldState
, sal_Int32 nNewState
,::osl::ResettableMutexGuard
& rGuard
)
118 if ( m_pInterfaceContainer
)
120 ::cppu::OInterfaceContainerHelper
* pContainer
= m_pInterfaceContainer
->getContainer(
121 ::getCppuType( ( const uno::Reference
< embed::XStateChangeListener
>*) NULL
) );
122 if ( pContainer
!= NULL
)
124 lang::EventObject
aSource( static_cast< ::cppu::OWeakObject
* >( this ) );
125 ::cppu::OInterfaceIteratorHelper
pIterator(*pContainer
);
127 // should be locked after the method is finished successfully
130 while (pIterator
.hasMoreElements())
135 ((embed::XStateChangeListener
*)pIterator
.next())->changingState( aSource
, nOldState
, nNewState
);
137 ((embed::XStateChangeListener
*)pIterator
.next())->stateChanged( aSource
, nOldState
, nNewState
);
139 catch( const uno::Exception
& )
141 // even if the listener complains ignore it for now
153 //----------------------------------------------
154 void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState
)
156 // TODO: may be needs interaction handler to detect wherether the object state
157 // can be changed even after errors
159 if ( m_nObjectState
== embed::EmbedStates::LOADED
)
161 if ( nNextState
== embed::EmbedStates::RUNNING
)
163 // after the object reaches the running state the cloned size is not necessary any more
164 m_bHasClonedSize
= sal_False
;
168 m_pDocHolder
->SetComponent( LoadLink_Impl(), m_bReadOnly
);
172 uno::Reference
< embed::XEmbedPersist
> xPersist( static_cast < embed::XClassifiedObject
* > (this), uno::UNO_QUERY
);
175 // in case embedded object is in loaded state the contents must
176 // be stored in the related storage and the storage
177 // must be created already
178 if ( !m_xObjectStorage
.is() )
179 throw io::IOException(); //TODO: access denied
181 m_pDocHolder
->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly
);
185 // objects without persistence will be initialized internally
186 uno::Sequence
< uno::Any
> aArgs(1);
187 aArgs
[0] <<= uno::Reference
< embed::XEmbeddedObject
>( this );
188 uno::Reference
< util::XCloseable
> xDocument(
189 m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext( GetDocumentServiceName(), aArgs
, m_xContext
),
192 uno::Reference
< container::XChild
> xChild( xDocument
, uno::UNO_QUERY
);
194 xChild
->setParent( m_xParent
);
196 m_pDocHolder
->SetComponent( xDocument
, m_bReadOnly
);
200 if ( !m_pDocHolder
->GetComponent().is() )
201 throw embed::UnreachableStateException(); //TODO: can't open document
203 m_nObjectState
= nNextState
;
207 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
208 throw uno::RuntimeException(); // TODO
211 else if ( m_nObjectState
== embed::EmbedStates::RUNNING
)
213 if ( nNextState
== embed::EmbedStates::LOADED
)
215 m_nClonedMapUnit
= m_pDocHolder
->GetMapUnit( embed::Aspects::MSOLE_CONTENT
);
216 m_bHasClonedSize
= m_pDocHolder
->GetExtent( embed::Aspects::MSOLE_CONTENT
, &m_aClonedSize
);
218 // actually frame should not exist at this point
219 m_pDocHolder
->CloseDocument( sal_False
, sal_False
);
221 m_nObjectState
= nNextState
;
225 if ( nNextState
== embed::EmbedStates::INPLACE_ACTIVE
)
227 if ( !m_xClientSite
.is() )
228 throw embed::WrongStateException(
229 OUString( "client site not set, yet" ),
233 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY
);
234 if ( xInplaceClient
.is() && xInplaceClient
->canInplaceActivate() )
236 xInplaceClient
->activatingInplace();
238 uno::Reference
< embed::XWindowSupplier
> xClientWindowSupplier( xInplaceClient
, uno::UNO_QUERY
);
239 if ( !xClientWindowSupplier
.is() )
240 throw uno::RuntimeException(); // TODO: the inplace client implementation must support XWinSupp
242 m_xClientWindow
= xClientWindowSupplier
->getWindow();
243 m_aOwnRectangle
= xInplaceClient
->getPlacement();
244 m_aClipRectangle
= xInplaceClient
->getClipRectangle();
245 awt::Rectangle aRectangleToShow
= GetRectangleInterception( m_aOwnRectangle
, m_aClipRectangle
);
247 // create own window based on the client window
248 // place and resize the window according to the rectangles
249 uno::Reference
< awt::XWindowPeer
> xClientWindowPeer( m_xClientWindow
, uno::UNO_QUERY
);
250 if ( !xClientWindowPeer
.is() )
251 throw uno::RuntimeException(); // TODO: the container window must support the interface
253 // dispatch provider may not be provided
254 uno::Reference
< frame::XDispatchProvider
> xContainerDP
= xInplaceClient
->getInplaceDispatchProvider();
255 sal_Bool bOk
= m_pDocHolder
->ShowInplace( xClientWindowPeer
, aRectangleToShow
, xContainerDP
);
256 m_nObjectState
= nNextState
;
259 SwitchStateTo_Impl( embed::EmbedStates::RUNNING
);
260 throw embed::WrongStateException(); //TODO: can't activate inplace
264 throw embed::WrongStateException(); //TODO: can't activate inplace
266 else if ( nNextState
== embed::EmbedStates::ACTIVE
)
268 if ( !m_xClientSite
.is() )
269 throw embed::WrongStateException(); //TODO: client site is not set!
271 // create frame and load document in the frame
272 m_pDocHolder
->Show();
274 m_xClientSite
->visibilityChanged( sal_True
);
275 m_nObjectState
= nNextState
;
279 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
280 throw uno::RuntimeException(); // TODO
284 else if ( m_nObjectState
== embed::EmbedStates::INPLACE_ACTIVE
)
286 if ( nNextState
== embed::EmbedStates::RUNNING
)
288 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY
);
289 if ( !xInplaceClient
.is() )
290 throw uno::RuntimeException();
292 m_xClientSite
->visibilityChanged( sal_True
);
294 xInplaceClient
->deactivatedInplace();
296 m_nObjectState
= nNextState
;
298 else if ( nNextState
== embed::EmbedStates::UI_ACTIVE
)
300 if ( !(m_nMiscStatus
& embed::EmbedMisc::MS_EMBED_NOUIACTIVATE
) )
302 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY_THROW
);
304 uno::Reference
< ::com::sun::star::frame::XLayoutManager
> xContainerLM
=
305 xInplaceClient
->getLayoutManager();
306 if ( xContainerLM
.is() )
308 // dispatch provider may not be provided
309 uno::Reference
< frame::XDispatchProvider
> xContainerDP
= xInplaceClient
->getInplaceDispatchProvider();
311 // get the container module name
312 OUString aModuleName
;
315 uno::Reference
< embed::XComponentSupplier
> xCompSupl( m_xClientSite
, uno::UNO_QUERY_THROW
);
316 uno::Reference
< uno::XInterface
> xContDoc( xCompSupl
->getComponent(), uno::UNO_QUERY_THROW
);
318 uno::Reference
< frame::XModuleManager2
> xManager( frame::ModuleManager::create( m_xContext
) );
320 aModuleName
= xManager
->identify( xContDoc
);
322 catch( const uno::Exception
& )
325 // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
326 // the container. Locking the LM will prevent flicker.
327 xContainerLM
->lock();
328 xInplaceClient
->activatingUI();
329 sal_Bool bOk
= m_pDocHolder
->ShowUI( xContainerLM
, xContainerDP
, aModuleName
);
330 xContainerLM
->unlock();
334 m_nObjectState
= nNextState
;
335 m_pDocHolder
->ResizeHatchWindow();
339 xInplaceClient
->deactivatedUI();
340 throw embed::WrongStateException(); //TODO: can't activate UI
344 throw embed::WrongStateException(); //TODO: can't activate UI
349 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
350 throw uno::RuntimeException(); // TODO
353 else if ( m_nObjectState
== embed::EmbedStates::ACTIVE
)
355 if ( nNextState
== embed::EmbedStates::RUNNING
)
358 m_nObjectState
= nNextState
;
362 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
363 throw uno::RuntimeException(); // TODO
366 else if ( m_nObjectState
== embed::EmbedStates::UI_ACTIVE
)
368 if ( nNextState
== embed::EmbedStates::INPLACE_ACTIVE
)
370 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY_THROW
);
371 uno::Reference
< ::com::sun::star::frame::XLayoutManager
> xContainerLM
=
372 xInplaceClient
->getLayoutManager();
374 sal_Bool bOk
= sal_False
;
375 if ( xContainerLM
.is() )
376 bOk
= m_pDocHolder
->HideUI( xContainerLM
);
380 m_nObjectState
= nNextState
;
381 m_pDocHolder
->ResizeHatchWindow();
382 xInplaceClient
->deactivatedUI();
385 throw embed::WrongStateException(); //TODO: can't activate UI
389 throw embed::WrongStateException( OUString( "The object is in unacceptable state!\n" ),
390 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
393 //----------------------------------------------
394 uno::Sequence
< sal_Int32
> OCommonEmbeddedObject::GetIntermediateStatesSequence_Impl( sal_Int32 nNewState
)
396 sal_Int32 nCurInd
= 0;
397 for ( nCurInd
= 0; nCurInd
< m_aAcceptedStates
.getLength(); nCurInd
++ )
398 if ( m_aAcceptedStates
[nCurInd
] == m_nObjectState
)
401 if ( nCurInd
== m_aAcceptedStates
.getLength() )
402 throw embed::WrongStateException( OUString( "The object is in unacceptable state!\n" ),
403 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
405 sal_Int32 nDestInd
= 0;
406 for ( nDestInd
= 0; nDestInd
< m_aAcceptedStates
.getLength(); nDestInd
++ )
407 if ( m_aAcceptedStates
[nDestInd
] == nNewState
)
410 if ( nDestInd
== m_aAcceptedStates
.getLength() )
411 throw embed::UnreachableStateException(
412 OUString( "The state either not reachable, or the object allows the state only as an intermediate one!\n" ),
413 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ),
417 return m_pIntermediateStatesSeqs
[nCurInd
][nDestInd
];
420 //----------------------------------------------
421 void SAL_CALL
OCommonEmbeddedObject::changeState( sal_Int32 nNewState
)
422 throw ( embed::UnreachableStateException
,
423 embed::WrongStateException
,
425 uno::RuntimeException
)
427 SAL_INFO( "embeddedobj.common", "embeddedobj (mv76033) OCommonEmbeddedObject::changeState" );
429 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >( this ), uno::UNO_QUERY
);
431 ::osl::ResettableMutexGuard
aGuard( m_aMutex
);
433 throw lang::DisposedException(); // TODO
435 if ( m_nObjectState
== -1 )
436 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
437 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
439 sal_Int32 nOldState
= m_nObjectState
;
441 if ( m_nTargetState
!= -1 )
443 // means that the object is currently trying to reach the target state
444 throw embed::StateChangeInProgressException( OUString(),
445 uno::Reference
< uno::XInterface
>(),
450 TargetStateControl_Impl
aControl( m_nTargetState
, nNewState
);
452 // in case the object is already in requested state
453 if ( m_nObjectState
== nNewState
)
455 // if active object is activated again, bring it's window to top
456 if ( m_nObjectState
== embed::EmbedStates::ACTIVE
)
457 m_pDocHolder
->Show();
462 // retrieve sequence of states that should be passed to reach desired state
463 uno::Sequence
< sal_Int32
> aIntermediateStates
= GetIntermediateStatesSequence_Impl( nNewState
);
465 // notify listeners that the object is going to change the state
466 StateChangeNotification_Impl( sal_True
, nOldState
, nNewState
,aGuard
);
469 for ( sal_Int32 nInd
= 0; nInd
< aIntermediateStates
.getLength(); nInd
++ )
470 SwitchStateTo_Impl( aIntermediateStates
[nInd
] );
472 SwitchStateTo_Impl( nNewState
);
474 catch( const uno::Exception
& )
476 if ( nOldState
!= m_nObjectState
)
477 // notify listeners that the object has changed the state
478 StateChangeNotification_Impl( sal_False
, nOldState
, m_nObjectState
, aGuard
);
484 // notify listeners that the object has changed the state
485 StateChangeNotification_Impl( sal_False
, nOldState
, nNewState
, aGuard
);
487 // let the object window be shown
488 if ( nNewState
== embed::EmbedStates::UI_ACTIVE
|| nNewState
== embed::EmbedStates::INPLACE_ACTIVE
)
489 PostEvent_Impl( OUString( "OnVisAreaChanged" ) );
493 //----------------------------------------------
494 uno::Sequence
< sal_Int32
> SAL_CALL
OCommonEmbeddedObject::getReachableStates()
495 throw ( embed::WrongStateException
,
496 uno::RuntimeException
)
499 throw lang::DisposedException(); // TODO
501 if ( m_nObjectState
== -1 )
502 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
503 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
505 return m_aAcceptedStates
;
508 //----------------------------------------------
509 sal_Int32 SAL_CALL
OCommonEmbeddedObject::getCurrentState()
510 throw ( embed::WrongStateException
,
511 uno::RuntimeException
)
514 throw lang::DisposedException(); // TODO
516 if ( m_nObjectState
== -1 )
517 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
518 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
520 return m_nObjectState
;
523 //----------------------------------------------
524 void SAL_CALL
OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID
)
525 throw ( lang::IllegalArgumentException
,
526 embed::WrongStateException
,
527 embed::UnreachableStateException
,
529 uno::RuntimeException
)
531 SAL_INFO( "embeddedobj.common", "embeddedobj (mv76033) OCommonEmbeddedObject::doVerb" );
533 SolarMutexGuard aSolarGuard
;
534 //TODO: a gross hack to avoid deadlocks when this is called from the
535 // outside and OCommonEmbeddedObject::changeState, with m_aMutex locked,
536 // calls into framework code that tries to lock the solar mutex, while
537 // another thread (through Window::ImplCallPaint, say) calls
538 // OCommonEmbeddedObject::getComponent with the solar mutex locked and
539 // then tries to lock m_aMutex (see fdo#56818); the alternative would be
540 // to get locking done right in this class, but that looks like a
543 ::osl::ResettableMutexGuard
aGuard( m_aMutex
);
545 throw lang::DisposedException(); // TODO
547 if ( m_nObjectState
== -1 )
548 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
549 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
551 // for internal documents this call is just a duplicate of changeState
552 sal_Int32 nNewState
= -1;
555 nNewState
= ConvertVerbToState_Impl( nVerbID
);
557 catch( const uno::Exception
& )
560 if ( nNewState
== -1 )
562 // TODO/LATER: Save Copy as... verb ( -8 ) is implemented by container
563 // TODO/LATER: check if the verb is a supported one and if it is produce related operation
568 changeState( nNewState
);
572 //----------------------------------------------
573 uno::Sequence
< embed::VerbDescriptor
> SAL_CALL
OCommonEmbeddedObject::getSupportedVerbs()
574 throw ( embed::WrongStateException
,
575 uno::RuntimeException
)
578 throw lang::DisposedException(); // TODO
580 if ( m_nObjectState
== -1 )
581 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
582 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
584 return m_aObjectVerbs
;
587 //----------------------------------------------
588 void SAL_CALL
OCommonEmbeddedObject::setClientSite(
589 const uno::Reference
< embed::XEmbeddedClient
>& xClient
)
590 throw ( embed::WrongStateException
,
591 uno::RuntimeException
)
593 ::osl::MutexGuard
aGuard( m_aMutex
);
595 throw lang::DisposedException(); // TODO
597 if ( m_xClientSite
!= xClient
)
599 if ( m_nObjectState
!= embed::EmbedStates::LOADED
&& m_nObjectState
!= embed::EmbedStates::RUNNING
)
600 throw embed::WrongStateException(
601 OUString( "The client site can not be set currently!\n" ),
602 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
604 m_xClientSite
= xClient
;
608 //----------------------------------------------
609 uno::Reference
< embed::XEmbeddedClient
> SAL_CALL
OCommonEmbeddedObject::getClientSite()
610 throw ( embed::WrongStateException
,
611 uno::RuntimeException
)
614 throw lang::DisposedException(); // TODO
616 if ( m_nObjectState
== -1 )
617 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
618 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
620 return m_xClientSite
;
623 //----------------------------------------------
624 void SAL_CALL
OCommonEmbeddedObject::update()
625 throw ( embed::WrongStateException
,
627 uno::RuntimeException
)
629 ::osl::MutexGuard
aGuard( m_aMutex
);
631 throw lang::DisposedException(); // TODO
633 if ( m_nObjectState
== -1 )
634 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
635 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
637 PostEvent_Impl( OUString( "OnVisAreaChanged" ) );
640 //----------------------------------------------
641 void SAL_CALL
OCommonEmbeddedObject::setUpdateMode( sal_Int32 nMode
)
642 throw ( embed::WrongStateException
,
643 uno::RuntimeException
)
645 ::osl::MutexGuard
aGuard( m_aMutex
);
647 throw lang::DisposedException(); // TODO
649 if ( m_nObjectState
== -1 )
650 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
651 uno::Reference
< uno::XInterface
>( static_cast< ::cppu::OWeakObject
* >(this) ) );
653 OSL_ENSURE( nMode
== embed::EmbedUpdateModes::ALWAYS_UPDATE
654 || nMode
== embed::EmbedUpdateModes::EXPLICIT_UPDATE
,
655 "Unknown update mode!\n" );
656 m_nUpdateMode
= nMode
;
659 //----------------------------------------------
660 sal_Int64 SAL_CALL
OCommonEmbeddedObject::getStatus( sal_Int64
)
661 throw ( embed::WrongStateException
,
662 uno::RuntimeException
)
665 throw lang::DisposedException(); // TODO
667 return m_nMiscStatus
;
670 //----------------------------------------------
671 void SAL_CALL
OCommonEmbeddedObject::setContainerName( const OUString
& sName
)
672 throw ( uno::RuntimeException
)
674 ::osl::MutexGuard
aGuard( m_aMutex
);
676 throw lang::DisposedException(); // TODO
678 m_aContainerName
= sName
;
681 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
OCommonEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException
)
686 void SAL_CALL
OCommonEmbeddedObject::setParent( const com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
>& xParent
) throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
)
689 if ( m_nObjectState
!= -1 && m_nObjectState
!= embed::EmbedStates::LOADED
)
691 uno::Reference
< container::XChild
> xChild( m_pDocHolder
->GetComponent(), uno::UNO_QUERY
);
693 xChild
->setParent( xParent
);
697 // XDefaultSizeTransmitter
698 void SAL_CALL
OCommonEmbeddedObject::setDefaultSize( const ::com::sun::star::awt::Size
& rSize_100TH_MM
) throw (::com::sun::star::uno::RuntimeException
)
700 //#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
701 m_aDefaultSizeForChart_In_100TH_MM
= rSize_100TH_MM
;
704 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */