build fix
[LibreOffice.git] / embeddedobj / source / commonembedding / embedobj.cxx
blob32974547a50c519803d584545699ce0668950054
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>
41 #include <cppuhelper/interfacecontainer.hxx>
42 #include <comphelper/lok.hxx>
44 #include <vcl/svapp.hxx>
46 #include <targetstatecontrol.hxx>
48 #include "commonembobj.hxx"
49 #include "intercept.hxx"
50 #include "embedobj.hxx"
52 using namespace ::com::sun::star;
54 awt::Rectangle GetRectangleInterception( const awt::Rectangle& aRect1, const awt::Rectangle& aRect2 )
56 awt::Rectangle aResult;
58 OSL_ENSURE( aRect1.Width >= 0 && aRect2.Width >= 0 && aRect1.Height >= 0 && aRect2.Height >= 0,
59 "Offset must not be less then zero!" );
61 aResult.X = aRect1.X > aRect2.X ? aRect1.X : aRect2.X;
62 aResult.Y = aRect1.Y > aRect2.Y ? aRect1.Y : aRect2.Y;
64 sal_Int32 nRight1 = aRect1.X + aRect1.Width;
65 sal_Int32 nBottom1 = aRect1.Y + aRect1.Height;
66 sal_Int32 nRight2 = aRect2.X + aRect2.Width;
67 sal_Int32 nBottom2 = aRect2.Y + aRect2.Height;
68 aResult.Width = ( nRight1 < nRight2 ? nRight1 : nRight2 ) - aResult.X;
69 aResult.Height = ( nBottom1 < nBottom2 ? nBottom1 : nBottom2 ) - aResult.Y;
71 return aResult;
75 sal_Int32 OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb )
77 for ( sal_Int32 nInd = 0; nInd < m_aVerbTable.getLength(); nInd++ )
78 if ( m_aVerbTable[nInd][0] == nVerb )
79 return m_aVerbTable[nInd][1];
81 throw lang::IllegalArgumentException(); // TODO: unexpected verb provided
85 void OCommonEmbeddedObject::Deactivate()
87 uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
89 // no need to lock for the initialization
90 uno::Reference< embed::XEmbeddedClient > xClientSite = m_xClientSite;
91 if ( !xClientSite.is() )
92 throw embed::WrongStateException(); //TODO: client site is not set!
94 // store document if it is modified
95 if ( xModif.is() && xModif->isModified() )
97 try {
98 xClientSite->saveObject();
100 catch( const embed::ObjectSaveVetoException& )
103 catch( const uno::Exception& e )
105 throw embed::StorageWrappedTargetException(
106 "The client could not store the object!",
107 static_cast< ::cppu::OWeakObject* >( this ),
108 uno::makeAny( e ) );
112 m_pDocHolder->CloseFrame();
114 xClientSite->visibilityChanged( false );
118 void OCommonEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState ,::osl::ResettableMutexGuard& rGuard )
120 if ( m_pInterfaceContainer )
122 ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
123 cppu::UnoType<embed::XStateChangeListener>::get());
124 if ( pContainer != nullptr )
126 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
127 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
129 // should be locked after the method is finished successfully
130 rGuard.clear();
132 while (pIterator.hasMoreElements())
136 if ( bBeforeChange )
137 static_cast<embed::XStateChangeListener*>(pIterator.next())->changingState( aSource, nOldState, nNewState );
138 else
139 static_cast<embed::XStateChangeListener*>(pIterator.next())->stateChanged( aSource, nOldState, nNewState );
141 catch( const uno::Exception& )
143 // even if the listener complains ignore it for now
146 if ( m_bDisposed )
147 return;
150 rGuard.reset();
156 void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
158 // TODO: may be needs interaction handler to detect whether the object state
159 // can be changed even after errors
161 if ( m_nObjectState == embed::EmbedStates::LOADED )
163 if ( nNextState == embed::EmbedStates::RUNNING )
165 // after the object reaches the running state the cloned size is not necessary any more
166 m_bHasClonedSize = false;
168 if ( m_bIsLink )
170 m_pDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
172 else
174 uno::Reference < embed::XEmbedPersist > xPersist( static_cast < embed::XClassifiedObject* > (this), uno::UNO_QUERY );
175 if ( xPersist.is() )
177 // in case embedded object is in loaded state the contents must
178 // be stored in the related storage and the storage
179 // must be created already
180 if ( !m_xObjectStorage.is() )
181 throw io::IOException(); //TODO: access denied
183 m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly );
185 else
187 // objects without persistence will be initialized internally
188 uno::Sequence < uno::Any > aArgs(1);
189 aArgs[0] <<= uno::Reference < embed::XEmbeddedObject >( this );
190 uno::Reference< util::XCloseable > xDocument(
191 m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( GetDocumentServiceName(), aArgs, m_xContext),
192 uno::UNO_QUERY );
194 uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
195 if ( xChild.is() )
196 xChild->setParent( m_xParent );
198 m_pDocHolder->SetComponent( xDocument, m_bReadOnly );
202 if ( !m_pDocHolder->GetComponent().is() )
203 throw embed::UnreachableStateException(); //TODO: can't open document
205 m_nObjectState = nNextState;
207 else
209 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
210 throw uno::RuntimeException(); // TODO
213 else if ( m_nObjectState == embed::EmbedStates::RUNNING )
215 if ( nNextState == embed::EmbedStates::LOADED )
217 m_nClonedMapUnit = m_pDocHolder->GetMapUnit( embed::Aspects::MSOLE_CONTENT );
218 m_bHasClonedSize = m_pDocHolder->GetExtent( embed::Aspects::MSOLE_CONTENT, &m_aClonedSize );
220 // actually frame should not exist at this point
221 m_pDocHolder->CloseDocument( false, false );
223 m_nObjectState = nNextState;
225 else
227 if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
229 if ( !m_xClientSite.is() )
230 throw embed::WrongStateException( "client site not set, yet", *this );
232 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
233 if ( xInplaceClient.is() && xInplaceClient->canInplaceActivate() )
235 xInplaceClient->activatingInplace();
237 uno::Reference< embed::XWindowSupplier > xClientWindowSupplier( xInplaceClient, uno::UNO_QUERY );
238 if ( !xClientWindowSupplier.is() )
239 throw uno::RuntimeException(); // TODO: the inplace client implementation must support XWinSupp
241 m_xClientWindow = xClientWindowSupplier->getWindow();
242 m_aOwnRectangle = xInplaceClient->getPlacement();
243 m_aClipRectangle = xInplaceClient->getClipRectangle();
244 awt::Rectangle aRectangleToShow = GetRectangleInterception( m_aOwnRectangle, m_aClipRectangle );
246 // create own window based on the client window
247 // place and resize the window according to the rectangles
248 uno::Reference< awt::XWindowPeer > xClientWindowPeer( m_xClientWindow, uno::UNO_QUERY );
249 if ( !xClientWindowPeer.is() )
250 throw uno::RuntimeException(); // TODO: the container window must support the interface
252 // dispatch provider may not be provided
253 uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
254 bool bOk = m_pDocHolder->ShowInplace( xClientWindowPeer, aRectangleToShow, xContainerDP );
255 m_nObjectState = nNextState;
256 if ( !bOk )
258 SwitchStateTo_Impl( embed::EmbedStates::RUNNING );
259 throw embed::WrongStateException(); //TODO: can't activate inplace
262 else
263 throw embed::WrongStateException(); //TODO: can't activate inplace
265 else if ( nNextState == embed::EmbedStates::ACTIVE )
267 if ( !m_xClientSite.is() )
268 throw embed::WrongStateException(); //TODO: client site is not set!
270 // create frame and load document in the frame
271 m_pDocHolder->Show();
273 m_xClientSite->visibilityChanged( true );
274 m_nObjectState = nNextState;
276 else
278 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
279 throw uno::RuntimeException(); // TODO
283 else if ( m_nObjectState == embed::EmbedStates::INPLACE_ACTIVE )
285 if ( nNextState == embed::EmbedStates::RUNNING )
287 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
288 if ( !xInplaceClient.is() )
289 throw uno::RuntimeException();
291 m_xClientSite->visibilityChanged( true );
293 xInplaceClient->deactivatedInplace();
294 Deactivate();
295 m_nObjectState = nNextState;
297 else if ( nNextState == embed::EmbedStates::UI_ACTIVE )
299 if ( !(m_nMiscStatus & embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
301 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
302 // TODO:
303 uno::Reference< css::frame::XLayoutManager > xContainerLM =
304 xInplaceClient->getLayoutManager();
305 if ( xContainerLM.is() )
307 // dispatch provider may not be provided
308 uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
310 // get the container module name
311 OUString aModuleName;
314 uno::Reference< embed::XComponentSupplier > xCompSupl( m_xClientSite, uno::UNO_QUERY_THROW );
315 uno::Reference< uno::XInterface > xContDoc( xCompSupl->getComponent(), uno::UNO_QUERY_THROW );
317 uno::Reference< frame::XModuleManager2 > xManager( frame::ModuleManager::create( m_xContext ) );
319 aModuleName = xManager->identify( xContDoc );
321 catch( const uno::Exception& )
324 if (!comphelper::LibreOfficeKit::isActive())
326 // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
327 // the container. Locking the LM will prevent flicker.
328 xContainerLM->lock();
329 xInplaceClient->activatingUI();
330 bool bOk = m_pDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
331 xContainerLM->unlock();
333 if ( bOk )
335 m_nObjectState = nNextState;
336 m_pDocHolder->ResizeHatchWindow();
338 else
340 xInplaceClient->deactivatedUI();
341 throw embed::WrongStateException(); //TODO: can't activate UI
345 else
347 throw embed::WrongStateException(); //TODO: can't activate UI
351 else
353 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
354 throw uno::RuntimeException(); // TODO
357 else if ( m_nObjectState == embed::EmbedStates::ACTIVE )
359 if ( nNextState == embed::EmbedStates::RUNNING )
361 Deactivate();
362 m_nObjectState = nNextState;
364 else
366 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
367 throw uno::RuntimeException(); // TODO
370 else if ( m_nObjectState == embed::EmbedStates::UI_ACTIVE )
372 if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
374 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
375 uno::Reference< css::frame::XLayoutManager > xContainerLM =
376 xInplaceClient->getLayoutManager();
378 bool bOk = false;
379 if ( xContainerLM.is() )
380 bOk = m_pDocHolder->HideUI( xContainerLM );
382 if ( bOk )
384 m_nObjectState = nNextState;
385 m_pDocHolder->ResizeHatchWindow();
386 xInplaceClient->deactivatedUI();
388 else
389 throw embed::WrongStateException(); //TODO: can't activate UI
392 else
393 throw embed::WrongStateException( "The object is in unacceptable state!",
394 static_cast< ::cppu::OWeakObject* >(this) );
398 uno::Sequence< sal_Int32 > const & OCommonEmbeddedObject::GetIntermediateStatesSequence_Impl( sal_Int32 nNewState )
400 sal_Int32 nCurInd = 0;
401 for ( nCurInd = 0; nCurInd < m_aAcceptedStates.getLength(); nCurInd++ )
402 if ( m_aAcceptedStates[nCurInd] == m_nObjectState )
403 break;
405 if ( nCurInd == m_aAcceptedStates.getLength() )
406 throw embed::WrongStateException( "The object is in unacceptable state!",
407 static_cast< ::cppu::OWeakObject* >(this) );
409 sal_Int32 nDestInd = 0;
410 for ( nDestInd = 0; nDestInd < m_aAcceptedStates.getLength(); nDestInd++ )
411 if ( m_aAcceptedStates[nDestInd] == nNewState )
412 break;
414 if ( nDestInd == m_aAcceptedStates.getLength() )
415 throw embed::UnreachableStateException(
416 "The state either not reachable, or the object allows the state only as an intermediate one!",
417 static_cast< ::cppu::OWeakObject* >(this),
418 m_nObjectState,
419 nNewState );
421 return m_pIntermediateStatesSeqs[nCurInd][nDestInd];
425 void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
426 throw ( embed::UnreachableStateException,
427 embed::WrongStateException,
428 uno::Exception,
429 uno::RuntimeException, std::exception )
432 ::osl::ResettableMutexGuard aGuard( m_aMutex );
433 if ( m_bDisposed )
434 throw lang::DisposedException(); // TODO
436 if ( m_nObjectState == -1 )
437 throw embed::WrongStateException( "The object has no persistence!",
438 static_cast< ::cppu::OWeakObject* >(this) );
440 sal_Int32 nOldState = m_nObjectState;
442 if ( m_nTargetState != -1 )
444 // means that the object is currently trying to reach the target state
445 throw embed::StateChangeInProgressException( OUString(),
446 uno::Reference< uno::XInterface >(),
447 m_nTargetState );
449 else
451 TargetStateControl_Impl aControl( m_nTargetState, nNewState );
453 // in case the object is already in requested state
454 if ( m_nObjectState == nNewState )
456 // if active object is activated again, bring its window to top
457 if ( m_nObjectState == embed::EmbedStates::ACTIVE )
458 m_pDocHolder->Show();
460 return;
463 // retrieve sequence of states that should be passed to reach desired state
464 uno::Sequence< sal_Int32 > aIntermediateStates = GetIntermediateStatesSequence_Impl( nNewState );
466 // notify listeners that the object is going to change the state
467 StateChangeNotification_Impl( true, nOldState, nNewState,aGuard );
469 try {
470 for ( sal_Int32 nInd = 0; nInd < aIntermediateStates.getLength(); nInd++ )
471 SwitchStateTo_Impl( aIntermediateStates[nInd] );
473 SwitchStateTo_Impl( nNewState );
475 catch( const uno::Exception& )
477 if ( nOldState != m_nObjectState )
478 // notify listeners that the object has changed the state
479 StateChangeNotification_Impl( false, nOldState, m_nObjectState, aGuard );
481 throw;
485 // notify listeners that the object has changed the state
486 StateChangeNotification_Impl( false, nOldState, nNewState, aGuard );
488 // let the object window be shown
489 if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE )
490 PostEvent_Impl( "OnVisAreaChanged" );
495 uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getReachableStates()
496 throw ( embed::WrongStateException,
497 uno::RuntimeException, std::exception )
499 if ( m_bDisposed )
500 throw lang::DisposedException(); // TODO
502 if ( m_nObjectState == -1 )
503 throw embed::WrongStateException( "The object has no persistence!",
504 static_cast< ::cppu::OWeakObject* >(this) );
506 return m_aAcceptedStates;
510 sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState()
511 throw ( embed::WrongStateException,
512 uno::RuntimeException, std::exception )
514 if ( m_bDisposed )
515 throw lang::DisposedException(); // TODO
517 if ( m_nObjectState == -1 )
518 throw embed::WrongStateException( "The object has no persistence!",
519 static_cast< ::cppu::OWeakObject* >(this) );
521 return m_nObjectState;
525 void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
526 throw ( lang::IllegalArgumentException,
527 embed::WrongStateException,
528 embed::UnreachableStateException,
529 uno::Exception,
530 uno::RuntimeException, std::exception )
532 SolarMutexGuard aSolarGuard;
533 //TODO: a gross hack to avoid deadlocks when this is called from the
534 // outside and OCommonEmbeddedObject::changeState, with m_aMutex locked,
535 // calls into framework code that tries to lock the solar mutex, while
536 // another thread (through Window::ImplCallPaint, say) calls
537 // OCommonEmbeddedObject::getComponent with the solar mutex locked and
538 // then tries to lock m_aMutex (see fdo#56818); the alternative would be
539 // to get locking done right in this class, but that looks like a
540 // daunting task
542 ::osl::ResettableMutexGuard aGuard( m_aMutex );
543 if ( m_bDisposed )
544 throw lang::DisposedException(); // TODO
546 if ( m_nObjectState == -1 )
547 throw embed::WrongStateException( "The object has no persistence!",
548 static_cast< ::cppu::OWeakObject* >(this) );
550 // for internal documents this call is just a duplicate of changeState
551 sal_Int32 nNewState = -1;
554 nNewState = ConvertVerbToState_Impl( nVerbID );
556 catch( const uno::Exception& )
559 if ( nNewState == -1 )
561 // TODO/LATER: Save Copy as... verb ( -8 ) is implemented by container
562 // TODO/LATER: check if the verb is a supported one and if it is produce related operation
564 else
566 aGuard.clear();
567 changeState( nNewState );
572 uno::Sequence< embed::VerbDescriptor > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
573 throw ( embed::WrongStateException,
574 uno::RuntimeException, std::exception )
576 if ( m_bDisposed )
577 throw lang::DisposedException(); // TODO
579 if ( m_nObjectState == -1 )
580 throw embed::WrongStateException( "The object has no persistence!",
581 static_cast< ::cppu::OWeakObject* >(this) );
583 return m_aObjectVerbs;
587 void SAL_CALL OCommonEmbeddedObject::setClientSite(
588 const uno::Reference< embed::XEmbeddedClient >& xClient )
589 throw ( embed::WrongStateException,
590 uno::RuntimeException, std::exception )
592 ::osl::MutexGuard aGuard( m_aMutex );
593 if ( m_bDisposed )
594 throw lang::DisposedException(); // TODO
596 if ( m_xClientSite != xClient)
598 if ( m_nObjectState != embed::EmbedStates::LOADED && m_nObjectState != embed::EmbedStates::RUNNING )
599 throw embed::WrongStateException(
600 "The client site can not be set currently!",
601 static_cast< ::cppu::OWeakObject* >(this) );
603 m_xClientSite = xClient;
608 uno::Reference< embed::XEmbeddedClient > SAL_CALL OCommonEmbeddedObject::getClientSite()
609 throw ( embed::WrongStateException,
610 uno::RuntimeException, std::exception )
612 if ( m_bDisposed )
613 throw lang::DisposedException(); // TODO
615 if ( m_nObjectState == -1 )
616 throw embed::WrongStateException( "The object has no persistence!",
617 static_cast< ::cppu::OWeakObject* >(this) );
619 return m_xClientSite;
623 void SAL_CALL OCommonEmbeddedObject::update()
624 throw ( embed::WrongStateException,
625 uno::Exception,
626 uno::RuntimeException, std::exception )
628 ::osl::MutexGuard aGuard( m_aMutex );
629 if ( m_bDisposed )
630 throw lang::DisposedException(); // TODO
632 if ( m_nObjectState == -1 )
633 throw embed::WrongStateException( "The object has no persistence!",
634 static_cast< ::cppu::OWeakObject* >(this) );
636 PostEvent_Impl( "OnVisAreaChanged" );
640 void SAL_CALL OCommonEmbeddedObject::setUpdateMode( sal_Int32 nMode )
641 throw ( embed::WrongStateException,
642 uno::RuntimeException, std::exception )
644 ::osl::MutexGuard aGuard( m_aMutex );
645 if ( m_bDisposed )
646 throw lang::DisposedException(); // TODO
648 if ( m_nObjectState == -1 )
649 throw embed::WrongStateException( "The object has no persistence!",
650 static_cast< ::cppu::OWeakObject* >(this) );
652 OSL_ENSURE( nMode == embed::EmbedUpdateModes::ALWAYS_UPDATE
653 || nMode == embed::EmbedUpdateModes::EXPLICIT_UPDATE,
654 "Unknown update mode!\n" );
655 m_nUpdateMode = nMode;
659 sal_Int64 SAL_CALL OCommonEmbeddedObject::getStatus( sal_Int64 )
660 throw ( embed::WrongStateException,
661 uno::RuntimeException, std::exception )
663 if ( m_bDisposed )
664 throw lang::DisposedException(); // TODO
666 return m_nMiscStatus;
670 void SAL_CALL OCommonEmbeddedObject::setContainerName( const OUString& sName )
671 throw ( uno::RuntimeException, std::exception )
673 ::osl::MutexGuard aGuard( m_aMutex );
674 if ( m_bDisposed )
675 throw lang::DisposedException(); // TODO
677 m_aContainerName = sName;
680 css::uno::Reference< css::uno::XInterface > SAL_CALL OCommonEmbeddedObject::getParent() throw (css::uno::RuntimeException, std::exception)
682 return m_xParent;
685 void SAL_CALL OCommonEmbeddedObject::setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) throw (css::lang::NoSupportException, css::uno::RuntimeException, std::exception)
687 m_xParent = xParent;
688 if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
690 uno::Reference < container::XChild > xChild( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
691 if ( xChild.is() )
692 xChild->setParent( xParent );
696 // XDefaultSizeTransmitter
697 void SAL_CALL OCommonEmbeddedObject::setDefaultSize( const css::awt::Size& rSize_100TH_MM ) throw (css::uno::RuntimeException, std::exception)
699 //#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
700 m_aDefaultSizeForChart_In_100TH_MM = rSize_100TH_MM;
703 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */