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/EmbedUpdateModes.hpp>
22 #include <com/sun/star/embed/ObjectSaveVetoException.hpp>
23 #include <com/sun/star/embed/StorageWrappedTargetException.hpp>
24 #include <com/sun/star/embed/UnreachableStateException.hpp>
25 #include <com/sun/star/embed/XEmbeddedClient.hpp>
26 #include <com/sun/star/embed/XInplaceClient.hpp>
27 #include <com/sun/star/embed/XWindowSupplier.hpp>
28 #include <com/sun/star/embed/StateChangeInProgressException.hpp>
29 #include <com/sun/star/embed/Aspects.hpp>
31 #include <com/sun/star/awt/XWindowPeer.hpp>
32 #include <com/sun/star/io/IOException.hpp>
33 #include <com/sun/star/util/XCloseable.hpp>
34 #include <com/sun/star/util/XModifiable.hpp>
35 #include <com/sun/star/frame/ModuleManager.hpp>
36 #include <com/sun/star/lang/DisposedException.hpp>
38 #include <com/sun/star/embed/EmbedMisc.hpp>
39 #include <cppuhelper/exc_hlp.hxx>
40 #include <comphelper/multicontainer2.hxx>
41 #include <comphelper/lok.hxx>
42 #include <sal/log.hxx>
43 #include <officecfg/Office/Common.hxx>
45 #include <vcl/svapp.hxx>
47 #include <targetstatecontrol.hxx>
49 #include <commonembobj.hxx>
50 #include "embedobj.hxx"
51 #include <specialobject.hxx>
54 using namespace ::com::sun::star
;
56 awt::Rectangle
GetRectangleInterception( const awt::Rectangle
& aRect1
, const awt::Rectangle
& aRect2
)
58 awt::Rectangle aResult
;
60 OSL_ENSURE( aRect1
.Width
>= 0 && aRect2
.Width
>= 0 && aRect1
.Height
>= 0 && aRect2
.Height
>= 0,
61 "Offset must not be less than zero!" );
63 aResult
.X
= std::max(aRect1
.X
, aRect2
.X
);
64 aResult
.Y
= std::max(aRect1
.Y
, aRect2
.Y
);
66 sal_Int32 nRight1
= aRect1
.X
+ aRect1
.Width
;
67 sal_Int32 nBottom1
= aRect1
.Y
+ aRect1
.Height
;
68 sal_Int32 nRight2
= aRect2
.X
+ aRect2
.Width
;
69 sal_Int32 nBottom2
= aRect2
.Y
+ aRect2
.Height
;
70 aResult
.Width
= std::min( nRight1
, nRight2
) - aResult
.X
;
71 aResult
.Height
= std::min( nBottom1
, nBottom2
) - aResult
.Y
;
78 using IntermediateStatesMap
= std::array
<std::array
<uno::Sequence
< sal_Int32
>, NUM_SUPPORTED_STATES
>, NUM_SUPPORTED_STATES
>;
79 const IntermediateStatesMap
& getIntermediateStatesMap()
81 static const IntermediateStatesMap map
= [] () {
82 IntermediateStatesMap tmp
;
84 // intermediate states
85 // In the following table the first index points to starting state,
86 // the second one to the target state, and the sequence referenced by
87 // first two indexes contains intermediate states, that should be
88 // passed by object to reach the target state.
89 // If the sequence is empty that means that indirect switch from start
90 // state to the target state is forbidden, only if direct switch is possible
91 // the state can be reached.
93 tmp
[0][2] = { embed::EmbedStates::RUNNING
};
95 tmp
[0][3] = { embed::EmbedStates::RUNNING
,
96 embed::EmbedStates::INPLACE_ACTIVE
};
98 tmp
[0][4] = {embed::EmbedStates::RUNNING
};
100 tmp
[1][3] = { embed::EmbedStates::INPLACE_ACTIVE
};
102 tmp
[2][0] = { embed::EmbedStates::RUNNING
};
104 tmp
[3][0] = { embed::EmbedStates::INPLACE_ACTIVE
,
105 embed::EmbedStates::RUNNING
};
107 tmp
[3][1] = { embed::EmbedStates::INPLACE_ACTIVE
};
109 tmp
[4][0] = { embed::EmbedStates::RUNNING
};
117 const css::uno::Sequence
< sal_Int32
> & getAcceptedStates()
119 static const css::uno::Sequence
< sal_Int32
> states
{
120 /* [0] */ embed::EmbedStates::LOADED
,
121 /* [1] */ embed::EmbedStates::RUNNING
,
122 /* [2] */ embed::EmbedStates::INPLACE_ACTIVE
,
123 /* [3] */ embed::EmbedStates::UI_ACTIVE
,
124 /* [4] */ embed::EmbedStates::ACTIVE
};
125 assert(states
.getLength() == NUM_SUPPORTED_STATES
);
131 sal_Int32
OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb
)
133 auto it
= m_aVerbTable
.find( nVerb
);
134 if (it
!= m_aVerbTable
.end())
137 throw lang::IllegalArgumentException(); // TODO: unexpected verb provided
141 void OCommonEmbeddedObject::Deactivate()
143 uno::Reference
< util::XModifiable
> xModif( m_xDocHolder
->GetComponent(), uno::UNO_QUERY
);
145 // no need to lock for the initialization
146 uno::Reference
< embed::XEmbeddedClient
> xClientSite
= m_xClientSite
;
147 if ( !xClientSite
.is() )
148 throw embed::WrongStateException(); //TODO: client site is not set!
150 // tdf#131146 close frame before saving of the document
151 // (during CloseFrame() call some changes could be detected not registered in util::XModifiable)
152 m_xDocHolder
->CloseFrame();
154 // store document if it is modified
155 if ( xModif
.is() && xModif
->isModified() )
158 xClientSite
->saveObject();
160 // tdf#141529 take note that an eventually used linked file
161 // got changed/saved/written and that we need to copy it back if the
162 // hosting file/document gets saved
163 if(m_aLinkTempFile
.is())
164 m_bLinkTempFileChanged
= true;
166 catch( const embed::ObjectSaveVetoException
& )
169 catch( const uno::Exception
& )
171 css::uno::Any anyEx
= cppu::getCaughtException();
172 throw embed::StorageWrappedTargetException(
173 u
"The client could not store the object!"_ustr
,
174 static_cast< ::cppu::OWeakObject
* >( this ),
179 xClientSite
->visibilityChanged( false );
183 void OCommonEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange
, sal_Int32 nOldState
, sal_Int32 nNewState
,::osl::ResettableMutexGuard
& rGuard
)
185 if ( !m_pInterfaceContainer
)
188 comphelper::OInterfaceContainerHelper2
* pContainer
= m_pInterfaceContainer
->getContainer(
189 cppu::UnoType
<embed::XStateChangeListener
>::get());
190 if ( pContainer
== nullptr )
193 lang::EventObject
aSource( static_cast< ::cppu::OWeakObject
* >( this ) );
194 comphelper::OInterfaceIteratorHelper2
pIterator(*pContainer
);
196 // should be locked after the method is finished successfully
199 while (pIterator
.hasMoreElements())
204 static_cast<embed::XStateChangeListener
*>(pIterator
.next())->changingState( aSource
, nOldState
, nNewState
);
206 static_cast<embed::XStateChangeListener
*>(pIterator
.next())->stateChanged( aSource
, nOldState
, nNewState
);
208 catch( const uno::Exception
& )
210 // even if the listener complains ignore it for now
220 void OCommonEmbeddedObject::SetInplaceActiveState()
222 if ( !m_xClientSite
.is() )
223 throw embed::WrongStateException( u
"client site not set, yet"_ustr
, *this );
225 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY
);
226 if ( !xInplaceClient
.is() || !xInplaceClient
->canInplaceActivate() )
227 throw embed::WrongStateException(); //TODO: can't activate inplace
228 xInplaceClient
->activatingInplace();
230 uno::Reference
< embed::XWindowSupplier
> xClientWindowSupplier( xInplaceClient
, uno::UNO_QUERY_THROW
);
232 m_xClientWindow
= xClientWindowSupplier
->getWindow();
233 m_aOwnRectangle
= xInplaceClient
->getPlacement();
234 m_aClipRectangle
= xInplaceClient
->getClipRectangle();
235 awt::Rectangle aRectangleToShow
= GetRectangleInterception( m_aOwnRectangle
, m_aClipRectangle
);
237 // create own window based on the client window
238 // place and resize the window according to the rectangles
239 uno::Reference
< awt::XWindowPeer
> xClientWindowPeer( m_xClientWindow
, uno::UNO_QUERY_THROW
);
241 // dispatch provider may not be provided
242 uno::Reference
< frame::XDispatchProvider
> xContainerDP
= xInplaceClient
->getInplaceDispatchProvider();
243 bool bOk
= m_xDocHolder
->ShowInplace( xClientWindowPeer
, aRectangleToShow
, xContainerDP
);
244 m_nObjectState
= embed::EmbedStates::INPLACE_ACTIVE
;
247 SwitchStateTo_Impl( embed::EmbedStates::RUNNING
);
248 throw embed::WrongStateException(); //TODO: can't activate inplace
252 void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState
)
254 // TODO: may be needs interaction handler to detect whether the object state
255 // can be changed even after errors
257 if ( m_nObjectState
== embed::EmbedStates::LOADED
)
259 if ( nNextState
== embed::EmbedStates::RUNNING
)
261 // after the object reaches the running state the cloned size is not necessary any more
262 m_bHasClonedSize
= false;
266 m_xDocHolder
->SetComponent( LoadLink_Impl(), m_bReadOnly
);
270 if ( !dynamic_cast<OSpecialEmbeddedObject
*>(this) )
272 // in case embedded object is in loaded state the contents must
273 // be stored in the related storage and the storage
274 // must be created already
275 if ( !m_xObjectStorage
.is() )
276 throw io::IOException(); //TODO: access denied
278 m_xDocHolder
->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly
);
282 // objects without persistence will be initialized internally
283 uno::Sequence
< uno::Any
> aArgs
{ uno::Any(
284 uno::Reference
< embed::XEmbeddedObject
>( this )) };
285 uno::Reference
< util::XCloseable
> xDocument(
286 m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext( GetDocumentServiceName(), aArgs
, m_xContext
),
289 uno::Reference
< container::XChild
> xChild( xDocument
, uno::UNO_QUERY
);
291 xChild
->setParent( m_xParent
);
293 m_xDocHolder
->SetComponent( xDocument
, m_bReadOnly
);
297 if ( !m_xDocHolder
->GetComponent().is() )
298 throw embed::UnreachableStateException(); //TODO: can't open document
300 m_nObjectState
= nNextState
;
304 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
305 throw uno::RuntimeException(u
"invalid next state, only RUNNING state allowed"_ustr
); // TODO
308 else if ( m_nObjectState
== embed::EmbedStates::RUNNING
)
310 if ( nNextState
== embed::EmbedStates::LOADED
)
312 m_nClonedMapUnit
= m_xDocHolder
->GetMapUnit( embed::Aspects::MSOLE_CONTENT
);
313 m_bHasClonedSize
= m_xDocHolder
->GetExtent( embed::Aspects::MSOLE_CONTENT
, &m_aClonedSize
);
315 // actually frame should not exist at this point
316 m_xDocHolder
->CloseDocument( false, false );
318 m_nObjectState
= nNextState
;
322 if ( nNextState
== embed::EmbedStates::INPLACE_ACTIVE
)
324 SetInplaceActiveState();
326 else if ( nNextState
== embed::EmbedStates::ACTIVE
)
328 if ( !m_xClientSite
.is() )
329 throw embed::WrongStateException(); //TODO: client site is not set!
331 // create frame and load document in the frame
332 m_xDocHolder
->Show();
334 m_xClientSite
->visibilityChanged( true );
335 m_nObjectState
= nNextState
;
339 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
340 throw uno::RuntimeException(u
"invalid next state,only LOADED/INPLACE_ACTIVE/ACTIVE allowed"_ustr
); // TODO
344 else if ( m_nObjectState
== embed::EmbedStates::INPLACE_ACTIVE
)
346 if ( nNextState
== embed::EmbedStates::RUNNING
)
348 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY_THROW
);
350 m_xClientSite
->visibilityChanged( true );
352 xInplaceClient
->deactivatedInplace();
354 m_nObjectState
= nNextState
;
356 else if ( nNextState
== embed::EmbedStates::UI_ACTIVE
)
358 if ( !(m_nMiscStatus
& embed::EmbedMisc::MS_EMBED_NOUIACTIVATE
) )
360 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY_THROW
);
362 uno::Reference
< css::frame::XLayoutManager
> xContainerLM
=
363 xInplaceClient
->getLayoutManager();
364 if ( !xContainerLM
.is() )
365 throw embed::WrongStateException(); //TODO: can't activate UI
366 // dispatch provider may not be provided
367 uno::Reference
< frame::XDispatchProvider
> xContainerDP
= xInplaceClient
->getInplaceDispatchProvider();
369 // get the container module name
370 OUString aModuleName
;
373 uno::Reference
< embed::XComponentSupplier
> xCompSupl( m_xClientSite
, uno::UNO_QUERY_THROW
);
374 uno::Reference
< uno::XInterface
> xContDoc( xCompSupl
->getComponent(), uno::UNO_QUERY_THROW
);
376 uno::Reference
< frame::XModuleManager2
> xManager( frame::ModuleManager::create( m_xContext
) );
378 aModuleName
= xManager
->identify( xContDoc
);
380 catch( const uno::Exception
& )
383 if (!comphelper::LibreOfficeKit::isActive())
385 // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
386 // the container. Locking the LM will prevent flicker.
387 xContainerLM
->lock();
388 xInplaceClient
->activatingUI();
389 bool bOk
= m_xDocHolder
->ShowUI( xContainerLM
, xContainerDP
, aModuleName
);
390 xContainerLM
->unlock();
394 m_nObjectState
= nNextState
;
395 m_xDocHolder
->ResizeHatchWindow();
399 xInplaceClient
->deactivatedUI();
400 throw embed::WrongStateException(); //TODO: can't activate UI
407 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
408 throw uno::RuntimeException(u
"invalid next state,only RUNNING/UI_ACTIVE allowed"_ustr
); // TODO
411 else if ( m_nObjectState
== embed::EmbedStates::ACTIVE
)
413 if ( nNextState
== embed::EmbedStates::RUNNING
)
416 m_nObjectState
= nNextState
;
420 SAL_WARN( "embeddedobj.common", "Unacceptable state switch!" );
421 throw uno::RuntimeException(u
"invalid next state, only RUNNING state allowed"_ustr
); // TODO
424 else if ( m_nObjectState
== embed::EmbedStates::UI_ACTIVE
)
426 if ( nNextState
== embed::EmbedStates::INPLACE_ACTIVE
)
428 uno::Reference
< embed::XInplaceClient
> xInplaceClient( m_xClientSite
, uno::UNO_QUERY_THROW
);
429 uno::Reference
< css::frame::XLayoutManager
> xContainerLM
=
430 xInplaceClient
->getLayoutManager();
433 if ( xContainerLM
.is() )
434 bOk
= m_xDocHolder
->HideUI( xContainerLM
);
437 throw embed::WrongStateException(); //TODO: can't activate UI
438 m_nObjectState
= nNextState
;
439 m_xDocHolder
->ResizeHatchWindow();
440 xInplaceClient
->deactivatedUI();
444 throw embed::WrongStateException( u
"The object is in unacceptable state!"_ustr
,
445 static_cast< ::cppu::OWeakObject
* >(this) );
449 uno::Sequence
< sal_Int32
> const & OCommonEmbeddedObject::GetIntermediateStatesSequence_Impl( sal_Int32 nNewState
)
451 sal_Int32 nCurInd
= 0;
452 auto & rAcceptedStates
= getAcceptedStates();
453 for ( nCurInd
= 0; nCurInd
< rAcceptedStates
.getLength(); nCurInd
++ )
454 if ( rAcceptedStates
[nCurInd
] == m_nObjectState
)
457 if ( nCurInd
== rAcceptedStates
.getLength() )
458 throw embed::WrongStateException( u
"The object is in unacceptable state!"_ustr
,
459 static_cast< ::cppu::OWeakObject
* >(this) );
461 sal_Int32 nDestInd
= 0;
462 for ( nDestInd
= 0; nDestInd
< rAcceptedStates
.getLength(); nDestInd
++ )
463 if ( rAcceptedStates
[nDestInd
] == nNewState
)
466 if ( nDestInd
== rAcceptedStates
.getLength() )
467 throw embed::UnreachableStateException(
468 u
"The state either not reachable, or the object allows the state only as an intermediate one!"_ustr
,
469 static_cast< ::cppu::OWeakObject
* >(this),
473 return getIntermediateStatesMap()[nCurInd
][nDestInd
];
477 void SAL_CALL
OCommonEmbeddedObject::changeState( sal_Int32 nNewState
)
479 if ( officecfg::Office::Common::Security::Scripting::DisableActiveContent::get()
480 && nNewState
!= embed::EmbedStates::LOADED
)
481 throw embed::UnreachableStateException();
482 ::osl::ResettableMutexGuard
aGuard( m_aMutex
);
484 throw lang::DisposedException(); // TODO
486 if ( m_nObjectState
== -1 )
487 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
488 static_cast< ::cppu::OWeakObject
* >(this) );
490 sal_Int32 nOldState
= m_nObjectState
;
492 if ( m_nTargetState
!= -1 )
494 // means that the object is currently trying to reach the target state
495 throw embed::StateChangeInProgressException( OUString(),
496 uno::Reference
< uno::XInterface
>(),
501 TargetStateControl_Impl
aControl( m_nTargetState
, nNewState
);
503 // in case the object is already in requested state
504 if ( m_nObjectState
== nNewState
)
506 // if active object is activated again, bring its window to top
507 if ( m_nObjectState
== embed::EmbedStates::ACTIVE
)
508 m_xDocHolder
->Show();
513 // retrieve sequence of states that should be passed to reach desired state
514 uno::Sequence
< sal_Int32
> aIntermediateStates
= GetIntermediateStatesSequence_Impl( nNewState
);
516 // notify listeners that the object is going to change the state
517 StateChangeNotification_Impl( true, nOldState
, nNewState
,aGuard
);
520 for (sal_Int32 state
: aIntermediateStates
)
521 SwitchStateTo_Impl( state
);
523 SwitchStateTo_Impl( nNewState
);
525 catch( const uno::Exception
& )
527 if ( nOldState
!= m_nObjectState
)
528 // notify listeners that the object has changed the state
529 StateChangeNotification_Impl( false, nOldState
, m_nObjectState
, aGuard
);
535 // notify listeners that the object has changed the state
536 StateChangeNotification_Impl( false, nOldState
, nNewState
, aGuard
);
538 // let the object window be shown
539 if ( nNewState
== embed::EmbedStates::UI_ACTIVE
|| nNewState
== embed::EmbedStates::INPLACE_ACTIVE
)
540 PostEvent_Impl( u
"OnVisAreaChanged"_ustr
);
544 uno::Sequence
< sal_Int32
> SAL_CALL
OCommonEmbeddedObject::getReachableStates()
547 throw lang::DisposedException(); // TODO
549 if ( m_nObjectState
== -1 )
550 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
551 static_cast< ::cppu::OWeakObject
* >(this) );
553 return getAcceptedStates();
557 sal_Int32 SAL_CALL
OCommonEmbeddedObject::getCurrentState()
560 throw lang::DisposedException(); // TODO
562 if ( m_nObjectState
== -1 )
563 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
564 static_cast< ::cppu::OWeakObject
* >(this) );
566 return m_nObjectState
;
570 void SAL_CALL
OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID
)
572 SolarMutexGuard aSolarGuard
;
573 //TODO: a gross hack to avoid deadlocks when this is called from the
574 // outside and OCommonEmbeddedObject::changeState, with m_aMutex locked,
575 // calls into framework code that tries to lock the solar mutex, while
576 // another thread (through Window::ImplCallPaint, say) calls
577 // OCommonEmbeddedObject::getComponent with the solar mutex locked and
578 // then tries to lock m_aMutex (see fdo#56818); the alternative would be
579 // to get locking done right in this class, but that looks like a
582 osl::ClearableMutexGuard
aGuard( m_aMutex
);
584 throw lang::DisposedException(); // TODO
586 if ( m_nObjectState
== -1 )
587 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
588 static_cast< ::cppu::OWeakObject
* >(this) );
590 // for internal documents this call is just a duplicate of changeState
591 sal_Int32 nNewState
= -1;
594 nNewState
= ConvertVerbToState_Impl( nVerbID
);
596 catch( const uno::Exception
& )
599 if ( nNewState
== -1 )
601 // TODO/LATER: Save Copy as... verb ( -8 ) is implemented by container
602 // TODO/LATER: check if the verb is a supported one and if it is produce related operation
607 changeState( nNewState
);
612 uno::Sequence
< embed::VerbDescriptor
> SAL_CALL
OCommonEmbeddedObject::getSupportedVerbs()
615 throw lang::DisposedException(); // TODO
617 if ( m_nObjectState
== -1 )
618 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
619 static_cast< ::cppu::OWeakObject
* >(this) );
621 return m_aObjectVerbs
;
625 void SAL_CALL
OCommonEmbeddedObject::setClientSite(
626 const uno::Reference
< embed::XEmbeddedClient
>& xClient
)
628 ::osl::MutexGuard
aGuard( m_aMutex
);
630 throw lang::DisposedException(); // TODO
632 if ( m_xClientSite
!= xClient
)
634 if ( m_nObjectState
!= embed::EmbedStates::LOADED
&& m_nObjectState
!= embed::EmbedStates::RUNNING
)
635 throw embed::WrongStateException(
636 u
"The client site can not be set currently!"_ustr
,
637 static_cast< ::cppu::OWeakObject
* >(this) );
639 m_xClientSite
= xClient
;
644 uno::Reference
< embed::XEmbeddedClient
> SAL_CALL
OCommonEmbeddedObject::getClientSite()
647 throw lang::DisposedException(); // TODO
649 if ( m_nObjectState
== -1 )
650 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
651 static_cast< ::cppu::OWeakObject
* >(this) );
653 return m_xClientSite
;
657 void SAL_CALL
OCommonEmbeddedObject::update()
659 ::osl::MutexGuard
aGuard( m_aMutex
);
661 throw lang::DisposedException(); // TODO
663 if ( m_nObjectState
== -1 )
664 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
665 static_cast< ::cppu::OWeakObject
* >(this) );
667 PostEvent_Impl( u
"OnVisAreaChanged"_ustr
);
671 void SAL_CALL
OCommonEmbeddedObject::setUpdateMode( sal_Int32 nMode
)
673 ::osl::MutexGuard
aGuard( m_aMutex
);
675 throw lang::DisposedException(); // TODO
677 if ( m_nObjectState
== -1 )
678 throw embed::WrongStateException( u
"The object has no persistence!"_ustr
,
679 static_cast< ::cppu::OWeakObject
* >(this) );
681 OSL_ENSURE( nMode
== embed::EmbedUpdateModes::ALWAYS_UPDATE
682 || nMode
== embed::EmbedUpdateModes::EXPLICIT_UPDATE
,
683 "Unknown update mode!" );
684 m_nUpdateMode
= nMode
;
688 sal_Int64 SAL_CALL
OCommonEmbeddedObject::getStatus( sal_Int64
)
691 throw lang::DisposedException(); // TODO
693 return m_nMiscStatus
;
697 void SAL_CALL
OCommonEmbeddedObject::setContainerName( const OUString
& sName
)
699 ::osl::MutexGuard
aGuard( m_aMutex
);
701 throw lang::DisposedException(); // TODO
703 m_aContainerName
= sName
;
706 void OCommonEmbeddedObject::SetOleState(bool bIsOleUpdate
)
708 ::osl::MutexGuard
aGuard( m_aMutex
);
710 m_bOleUpdate
= bIsOleUpdate
;
713 css::uno::Reference
< css::uno::XInterface
> SAL_CALL
OCommonEmbeddedObject::getParent()
718 void SAL_CALL
OCommonEmbeddedObject::setParent( const css::uno::Reference
< css::uno::XInterface
>& xParent
)
721 if ( m_nObjectState
!= -1 && m_nObjectState
!= embed::EmbedStates::LOADED
)
723 uno::Reference
< container::XChild
> xChild( m_xDocHolder
->GetComponent(), uno::UNO_QUERY
);
725 xChild
->setParent( xParent
);
729 // XDefaultSizeTransmitter
730 void SAL_CALL
OCommonEmbeddedObject::setDefaultSize( const css::awt::Size
& rSize_100TH_MM
)
732 //#i103460# charts do not necessarily 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
733 m_aDefaultSizeForChart_In_100TH_MM
= rSize_100TH_MM
;
736 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */