bump product version to 5.0.4.1
[LibreOffice.git] / embeddedobj / source / commonembedding / embedobj.cxx
blob4be6cc99d0236b5d6d3c506413e7e83b302a3c9d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
48 #include "embedobj.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;
69 return aResult;
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
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() )
95 try {
96 xClientSite->saveObject();
98 catch( const embed::ObjectSaveVetoException& )
101 catch( const uno::Exception& e )
103 throw embed::StorageWrappedTargetException(
104 "The client could not store the object!",
105 static_cast< ::cppu::OWeakObject* >( this ),
106 uno::makeAny( e ) );
110 m_pDocHolder->CloseFrame();
112 xClientSite->visibilityChanged( sal_False );
116 void OCommonEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState ,::osl::ResettableMutexGuard& rGuard )
118 if ( m_pInterfaceContainer )
120 ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
121 cppu::UnoType<embed::XStateChangeListener>::get());
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
128 rGuard.clear();
130 while (pIterator.hasMoreElements())
134 if ( bBeforeChange )
135 static_cast<embed::XStateChangeListener*>(pIterator.next())->changingState( aSource, nOldState, nNewState );
136 else
137 static_cast<embed::XStateChangeListener*>(pIterator.next())->stateChanged( aSource, nOldState, nNewState );
139 catch( const uno::Exception& )
141 // even if the listener complains ignore it for now
144 if ( m_bDisposed )
145 return;
148 rGuard.reset();
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 = false;
166 if ( m_bIsLink )
168 m_pDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
170 else
172 uno::Reference < embed::XEmbedPersist > xPersist( static_cast < embed::XClassifiedObject* > (this), uno::UNO_QUERY );
173 if ( xPersist.is() )
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 );
183 else
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),
190 uno::UNO_QUERY );
192 uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
193 if ( xChild.is() )
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;
205 else
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( false, false );
221 m_nObjectState = nNextState;
223 else
225 if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
227 if ( !m_xClientSite.is() )
228 throw embed::WrongStateException( "client site not set, yet", *this );
230 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
231 if ( xInplaceClient.is() && xInplaceClient->canInplaceActivate() )
233 xInplaceClient->activatingInplace();
235 uno::Reference< embed::XWindowSupplier > xClientWindowSupplier( xInplaceClient, uno::UNO_QUERY );
236 if ( !xClientWindowSupplier.is() )
237 throw uno::RuntimeException(); // TODO: the inplace client implementation must support XWinSupp
239 m_xClientWindow = xClientWindowSupplier->getWindow();
240 m_aOwnRectangle = xInplaceClient->getPlacement();
241 m_aClipRectangle = xInplaceClient->getClipRectangle();
242 awt::Rectangle aRectangleToShow = GetRectangleInterception( m_aOwnRectangle, m_aClipRectangle );
244 // create own window based on the client window
245 // place and resize the window according to the rectangles
246 uno::Reference< awt::XWindowPeer > xClientWindowPeer( m_xClientWindow, uno::UNO_QUERY );
247 if ( !xClientWindowPeer.is() )
248 throw uno::RuntimeException(); // TODO: the container window must support the interface
250 // dispatch provider may not be provided
251 uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
252 bool bOk = m_pDocHolder->ShowInplace( xClientWindowPeer, aRectangleToShow, xContainerDP );
253 m_nObjectState = nNextState;
254 if ( !bOk )
256 SwitchStateTo_Impl( embed::EmbedStates::RUNNING );
257 throw embed::WrongStateException(); //TODO: can't activate inplace
260 else
261 throw embed::WrongStateException(); //TODO: can't activate inplace
263 else if ( nNextState == embed::EmbedStates::ACTIVE )
265 if ( !m_xClientSite.is() )
266 throw embed::WrongStateException(); //TODO: client site is not set!
268 // create frame and load document in the frame
269 m_pDocHolder->Show();
271 m_xClientSite->visibilityChanged( sal_True );
272 m_nObjectState = nNextState;
274 else
276 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
277 throw uno::RuntimeException(); // TODO
281 else if ( m_nObjectState == embed::EmbedStates::INPLACE_ACTIVE )
283 if ( nNextState == embed::EmbedStates::RUNNING )
285 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
286 if ( !xInplaceClient.is() )
287 throw uno::RuntimeException();
289 m_xClientSite->visibilityChanged( sal_True );
291 xInplaceClient->deactivatedInplace();
292 Deactivate();
293 m_nObjectState = nNextState;
295 else if ( nNextState == embed::EmbedStates::UI_ACTIVE )
297 if ( !(m_nMiscStatus & embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
299 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
300 // TODO:
301 uno::Reference< ::com::sun::star::frame::XLayoutManager > xContainerLM =
302 xInplaceClient->getLayoutManager();
303 if ( xContainerLM.is() )
305 // dispatch provider may not be provided
306 uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
308 // get the container module name
309 OUString aModuleName;
312 uno::Reference< embed::XComponentSupplier > xCompSupl( m_xClientSite, uno::UNO_QUERY_THROW );
313 uno::Reference< uno::XInterface > xContDoc( xCompSupl->getComponent(), uno::UNO_QUERY_THROW );
315 uno::Reference< frame::XModuleManager2 > xManager( frame::ModuleManager::create( m_xContext ) );
317 aModuleName = xManager->identify( xContDoc );
319 catch( const uno::Exception& )
322 // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
323 // the container. Locking the LM will prevent flicker.
324 xContainerLM->lock();
325 xInplaceClient->activatingUI();
326 bool bOk = m_pDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
327 xContainerLM->unlock();
329 if ( bOk )
331 m_nObjectState = nNextState;
332 m_pDocHolder->ResizeHatchWindow();
334 else
336 xInplaceClient->deactivatedUI();
337 throw embed::WrongStateException(); //TODO: can't activate UI
340 else
341 throw embed::WrongStateException(); //TODO: can't activate UI
344 else
346 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
347 throw uno::RuntimeException(); // TODO
350 else if ( m_nObjectState == embed::EmbedStates::ACTIVE )
352 if ( nNextState == embed::EmbedStates::RUNNING )
354 Deactivate();
355 m_nObjectState = nNextState;
357 else
359 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
360 throw uno::RuntimeException(); // TODO
363 else if ( m_nObjectState == embed::EmbedStates::UI_ACTIVE )
365 if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
367 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
368 uno::Reference< ::com::sun::star::frame::XLayoutManager > xContainerLM =
369 xInplaceClient->getLayoutManager();
371 bool bOk = false;
372 if ( xContainerLM.is() )
373 bOk = m_pDocHolder->HideUI( xContainerLM );
375 if ( bOk )
377 m_nObjectState = nNextState;
378 m_pDocHolder->ResizeHatchWindow();
379 xInplaceClient->deactivatedUI();
381 else
382 throw embed::WrongStateException(); //TODO: can't activate UI
385 else
386 throw embed::WrongStateException( "The object is in unacceptable state!",
387 static_cast< ::cppu::OWeakObject* >(this) );
391 uno::Sequence< sal_Int32 > OCommonEmbeddedObject::GetIntermediateStatesSequence_Impl( sal_Int32 nNewState )
393 sal_Int32 nCurInd = 0;
394 for ( nCurInd = 0; nCurInd < m_aAcceptedStates.getLength(); nCurInd++ )
395 if ( m_aAcceptedStates[nCurInd] == m_nObjectState )
396 break;
398 if ( nCurInd == m_aAcceptedStates.getLength() )
399 throw embed::WrongStateException( "The object is in unacceptable state!",
400 static_cast< ::cppu::OWeakObject* >(this) );
402 sal_Int32 nDestInd = 0;
403 for ( nDestInd = 0; nDestInd < m_aAcceptedStates.getLength(); nDestInd++ )
404 if ( m_aAcceptedStates[nDestInd] == nNewState )
405 break;
407 if ( nDestInd == m_aAcceptedStates.getLength() )
408 throw embed::UnreachableStateException(
409 "The state either not reachable, or the object allows the state only as an intermediate one!",
410 static_cast< ::cppu::OWeakObject* >(this),
411 m_nObjectState,
412 nNewState );
414 return m_pIntermediateStatesSeqs[nCurInd][nDestInd];
418 void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
419 throw ( embed::UnreachableStateException,
420 embed::WrongStateException,
421 uno::Exception,
422 uno::RuntimeException, std::exception )
425 ::osl::ResettableMutexGuard aGuard( m_aMutex );
426 if ( m_bDisposed )
427 throw lang::DisposedException(); // TODO
429 if ( m_nObjectState == -1 )
430 throw embed::WrongStateException( "The object has no persistence!",
431 static_cast< ::cppu::OWeakObject* >(this) );
433 sal_Int32 nOldState = m_nObjectState;
435 if ( m_nTargetState != -1 )
437 // means that the object is currently trying to reach the target state
438 throw embed::StateChangeInProgressException( OUString(),
439 uno::Reference< uno::XInterface >(),
440 m_nTargetState );
442 else
444 TargetStateControl_Impl aControl( m_nTargetState, nNewState );
446 // in case the object is already in requested state
447 if ( m_nObjectState == nNewState )
449 // if active object is activated again, bring it's window to top
450 if ( m_nObjectState == embed::EmbedStates::ACTIVE )
451 m_pDocHolder->Show();
453 return;
456 // retrieve sequence of states that should be passed to reach desired state
457 uno::Sequence< sal_Int32 > aIntermediateStates = GetIntermediateStatesSequence_Impl( nNewState );
459 // notify listeners that the object is going to change the state
460 StateChangeNotification_Impl( true, nOldState, nNewState,aGuard );
462 try {
463 for ( sal_Int32 nInd = 0; nInd < aIntermediateStates.getLength(); nInd++ )
464 SwitchStateTo_Impl( aIntermediateStates[nInd] );
466 SwitchStateTo_Impl( nNewState );
468 catch( const uno::Exception& )
470 if ( nOldState != m_nObjectState )
471 // notify listeners that the object has changed the state
472 StateChangeNotification_Impl( false, nOldState, m_nObjectState, aGuard );
474 throw;
478 // notify listeners that the object has changed the state
479 StateChangeNotification_Impl( false, nOldState, nNewState, aGuard );
481 // let the object window be shown
482 if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE )
483 PostEvent_Impl( OUString( "OnVisAreaChanged" ) );
488 uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getReachableStates()
489 throw ( embed::WrongStateException,
490 uno::RuntimeException, std::exception )
492 if ( m_bDisposed )
493 throw lang::DisposedException(); // TODO
495 if ( m_nObjectState == -1 )
496 throw embed::WrongStateException( "The object has no persistence!",
497 static_cast< ::cppu::OWeakObject* >(this) );
499 return m_aAcceptedStates;
503 sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState()
504 throw ( embed::WrongStateException,
505 uno::RuntimeException, std::exception )
507 if ( m_bDisposed )
508 throw lang::DisposedException(); // TODO
510 if ( m_nObjectState == -1 )
511 throw embed::WrongStateException( "The object has no persistence!",
512 static_cast< ::cppu::OWeakObject* >(this) );
514 return m_nObjectState;
518 void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
519 throw ( lang::IllegalArgumentException,
520 embed::WrongStateException,
521 embed::UnreachableStateException,
522 uno::Exception,
523 uno::RuntimeException, std::exception )
525 SolarMutexGuard aSolarGuard;
526 //TODO: a gross hack to avoid deadlocks when this is called from the
527 // outside and OCommonEmbeddedObject::changeState, with m_aMutex locked,
528 // calls into framework code that tries to lock the solar mutex, while
529 // another thread (through Window::ImplCallPaint, say) calls
530 // OCommonEmbeddedObject::getComponent with the solar mutex locked and
531 // then tries to lock m_aMutex (see fdo#56818); the alternative would be
532 // to get locking done right in this class, but that looks like a
533 // daunting task
535 ::osl::ResettableMutexGuard aGuard( m_aMutex );
536 if ( m_bDisposed )
537 throw lang::DisposedException(); // TODO
539 if ( m_nObjectState == -1 )
540 throw embed::WrongStateException( "The object has no persistence!",
541 static_cast< ::cppu::OWeakObject* >(this) );
543 // for internal documents this call is just a duplicate of changeState
544 sal_Int32 nNewState = -1;
547 nNewState = ConvertVerbToState_Impl( nVerbID );
549 catch( const uno::Exception& )
552 if ( nNewState == -1 )
554 // TODO/LATER: Save Copy as... verb ( -8 ) is implemented by container
555 // TODO/LATER: check if the verb is a supported one and if it is produce related operation
557 else
559 aGuard.clear();
560 changeState( nNewState );
565 uno::Sequence< embed::VerbDescriptor > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
566 throw ( embed::WrongStateException,
567 uno::RuntimeException, std::exception )
569 if ( m_bDisposed )
570 throw lang::DisposedException(); // TODO
572 if ( m_nObjectState == -1 )
573 throw embed::WrongStateException( "The object has no persistence!",
574 static_cast< ::cppu::OWeakObject* >(this) );
576 return m_aObjectVerbs;
580 void SAL_CALL OCommonEmbeddedObject::setClientSite(
581 const uno::Reference< embed::XEmbeddedClient >& xClient )
582 throw ( embed::WrongStateException,
583 uno::RuntimeException, std::exception )
585 ::osl::MutexGuard aGuard( m_aMutex );
586 if ( m_bDisposed )
587 throw lang::DisposedException(); // TODO
589 if ( m_xClientSite != xClient)
591 if ( m_nObjectState != embed::EmbedStates::LOADED && m_nObjectState != embed::EmbedStates::RUNNING )
592 throw embed::WrongStateException(
593 "The client site can not be set currently!",
594 static_cast< ::cppu::OWeakObject* >(this) );
596 m_xClientSite = xClient;
601 uno::Reference< embed::XEmbeddedClient > SAL_CALL OCommonEmbeddedObject::getClientSite()
602 throw ( embed::WrongStateException,
603 uno::RuntimeException, std::exception )
605 if ( m_bDisposed )
606 throw lang::DisposedException(); // TODO
608 if ( m_nObjectState == -1 )
609 throw embed::WrongStateException( "The object has no persistence!",
610 static_cast< ::cppu::OWeakObject* >(this) );
612 return m_xClientSite;
616 void SAL_CALL OCommonEmbeddedObject::update()
617 throw ( embed::WrongStateException,
618 uno::Exception,
619 uno::RuntimeException, std::exception )
621 ::osl::MutexGuard aGuard( m_aMutex );
622 if ( m_bDisposed )
623 throw lang::DisposedException(); // TODO
625 if ( m_nObjectState == -1 )
626 throw embed::WrongStateException( "The object has no persistence!",
627 static_cast< ::cppu::OWeakObject* >(this) );
629 PostEvent_Impl( OUString( "OnVisAreaChanged" ) );
633 void SAL_CALL OCommonEmbeddedObject::setUpdateMode( sal_Int32 nMode )
634 throw ( embed::WrongStateException,
635 uno::RuntimeException, std::exception )
637 ::osl::MutexGuard aGuard( m_aMutex );
638 if ( m_bDisposed )
639 throw lang::DisposedException(); // TODO
641 if ( m_nObjectState == -1 )
642 throw embed::WrongStateException( "The object has no persistence!",
643 static_cast< ::cppu::OWeakObject* >(this) );
645 OSL_ENSURE( nMode == embed::EmbedUpdateModes::ALWAYS_UPDATE
646 || nMode == embed::EmbedUpdateModes::EXPLICIT_UPDATE,
647 "Unknown update mode!\n" );
648 m_nUpdateMode = nMode;
652 sal_Int64 SAL_CALL OCommonEmbeddedObject::getStatus( sal_Int64 )
653 throw ( embed::WrongStateException,
654 uno::RuntimeException, std::exception )
656 if ( m_bDisposed )
657 throw lang::DisposedException(); // TODO
659 return m_nMiscStatus;
663 void SAL_CALL OCommonEmbeddedObject::setContainerName( const OUString& sName )
664 throw ( uno::RuntimeException, std::exception )
666 ::osl::MutexGuard aGuard( m_aMutex );
667 if ( m_bDisposed )
668 throw lang::DisposedException(); // TODO
670 m_aContainerName = sName;
673 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OCommonEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException, std::exception)
675 return m_xParent;
678 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, std::exception)
680 m_xParent = xParent;
681 if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
683 uno::Reference < container::XChild > xChild( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
684 if ( xChild.is() )
685 xChild->setParent( xParent );
689 // XDefaultSizeTransmitter
690 void SAL_CALL OCommonEmbeddedObject::setDefaultSize( const ::com::sun::star::awt::Size& rSize_100TH_MM ) throw (::com::sun::star::uno::RuntimeException, std::exception)
692 //#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
693 m_aDefaultSizeForChart_In_100TH_MM = rSize_100TH_MM;
696 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */