24#include <com/sun/star/embed/EmbedUpdateModes.hpp>
25#include <com/sun/star/embed/EmbedStates.hpp>
26#include <com/sun/star/embed/WrongStateException.hpp>
27#include <com/sun/star/lang/NoSupportException.hpp>
28#include <com/sun/star/lang/XComponent.hpp>
29#include <com/sun/star/lang/DisposedException.hpp>
34#include <osl/diagnose.h>
48 const uno::Sequence< sal_Int8 >& aClassID,
54, m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
57, m_aClassName(
std::move( aClassName ))
58, m_bWaitSaveCompleted( false )
59, m_bNewVisReplInStream( true )
60, m_bStoreLoaded( false )
61, m_bVisReplInitialized( false )
62, m_bVisReplInStream( false )
63, m_bStoreVisRepl( false )
65, m_bHasCachedSize( false )
67, m_bHasSizeToSet( false )
69, m_bGotStatus( false )
72, m_bFromClipboard( false )
73, m_bTriedConversion( false )
85, m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
87, m_bWaitSaveCompleted( false )
88, m_bNewVisReplInStream( true )
89, m_bStoreLoaded( false )
90, m_bVisReplInitialized( false )
91, m_bVisReplInStream( false )
92, m_bStoreVisRepl( false )
94, m_bHasCachedSize( false )
96, m_bHasSizeToSet( false )
98, m_bGotStatus( false )
100, m_nStatusAspect( 0 )
101, m_bFromClipboard( false )
102, m_bTriedConversion( false )
111, m_nObjectState( -1 )
112, m_nTargetState( -1 )
113, m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
115, m_bWaitSaveCompleted( false )
116, m_bNewVisReplInStream( true )
117, m_bStoreLoaded( false )
118, m_bVisReplInitialized( false )
119, m_bVisReplInStream( false )
120, m_bStoreVisRepl( false )
122, m_bHasCachedSize( false )
123, m_nCachedAspect( 0 )
124, m_bHasSizeToSet( false )
126, m_bGotStatus( false )
128, m_nStatusAspect( 0 )
129, m_bFromClipboard( true )
130, m_bTriedConversion( false )
138 "The object is not closed! DISASTER is possible!" );
146 }
catch(
const uno::Exception& ) {}
165 if ( pContainer ==
nullptr )
174 static_cast<document::XEventListener*
>(pIterator.
next())->notifyEvent(
aEvent );
176 catch(
const uno::RuntimeException& )
183void OleEmbeddedObject::StateChangeNotification_Impl(
bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
189 if ( pContainer !=
nullptr )
194 while (pIterator.hasMoreElements())
200 static_cast<embed::XStateChangeListener*
>(pIterator.next())->changingState( aSource, nOldState, nNewState );
202 catch(
const uno::Exception& )
211 static_cast<embed::XStateChangeListener*
>(pIterator.next())->stateChanged( aSource, nOldState, nNewState );
213 catch(
const uno::Exception& )
237 catch(
const uno::Exception& )
270 }
catch(
const uno::Exception& )
279 uno::Reference< lang::XComponent > xComp(
m_xObjectStream, uno::UNO_QUERY );
280 OSL_ENSURE( xComp.is(),
"Storage stream doesn't support XComponent!" );
286 }
catch(
const uno::Exception& ) {}
301 if ( xWrappedObject.is() )
304 return xWrappedObject->getClassID();
308 ::osl::MutexGuard aGuard(
m_aMutex );
310 throw lang::DisposedException();
320 if ( xWrappedObject.is() )
323 return xWrappedObject->getClassName();
327 ::osl::MutexGuard aGuard(
m_aMutex );
329 throw lang::DisposedException();
336 const uno::Sequence< sal_Int8 >& aClassID,
const OUString& aClassName )
340 if ( xWrappedObject.is() )
343 xWrappedObject->setClassInfo(
aClassID, aClassName );
349 throw lang::NoSupportException();
357 if ( xWrappedObject.is() )
360 return xWrappedObject->getComponent();
364 ::osl::MutexGuard aGuard(
m_aMutex );
366 throw lang::DisposedException();
371 throw uno::RuntimeException(
"The object is not loaded!",
384 return uno::Reference< util::XCloseable >();
400 ::osl::MutexGuard aGuard(
m_aMutex );
402 throw lang::DisposedException();
413 const uno::Reference< embed::XStateChangeListener >& xListener )
424 ::osl::MutexGuard aGuard(
m_aMutex );
435 if ( xWrappedObject.is() )
438 xWrappedObject->close( bDeliverOwnership );
443 ::osl::MutexGuard aGuard(
m_aMutex );
445 throw lang::DisposedException();
447 uno::Reference< uno::XInterface > xSelfHold(
static_cast< ::
cppu::OWeakObject*
>(
this ) );
454 if ( pContainer !=
nullptr )
461 static_cast<util::XCloseListener*
>(pIterator.
next())->queryClosing( aSource, bDeliverOwnership );
463 catch(
const uno::RuntimeException& )
472 if ( pContainer !=
nullptr )
479 static_cast<util::XCloseListener*
>(pCloseIterator.
next())->notifyClosing( aSource );
481 catch(
const uno::RuntimeException& )
497 if ( xWrappedObject.is() )
500 xWrappedObject->addCloseListener( xListener );
505 ::osl::MutexGuard aGuard(
m_aMutex );
507 throw lang::DisposedException();
520 if ( xWrappedObject.is() )
523 xWrappedObject->removeCloseListener( xListener );
528 ::osl::MutexGuard aGuard(
m_aMutex );
530 throw lang::DisposedException();
542 if ( xWrappedObject.is() )
545 xWrappedObject->addEventListener( xListener );
550 ::osl::MutexGuard aGuard(
m_aMutex );
552 throw lang::DisposedException();
562 const uno::Reference< document::XEventListener >& xListener )
566 if ( xWrappedObject.is() )
569 xWrappedObject->removeEventListener( xListener );
574 ::osl::MutexGuard aGuard(
m_aMutex );
576 throw lang::DisposedException();
586 const awt::Rectangle& aClipRect )
589 uno::Reference< embed::XInplaceObject > xWrappedObject(
m_xWrappedObject, uno::UNO_QUERY );
590 if ( xWrappedObject.is() )
593 xWrappedObject->setObjectRectangles( aPosRect, aClipRect );
598 throw embed::WrongStateException();
605 uno::Reference< embed::XInplaceObject > xWrappedObject(
m_xWrappedObject, uno::UNO_QUERY );
606 if ( xWrappedObject.is() )
609 xWrappedObject->enableModeless( bEnable );
614 throw embed::WrongStateException();
619 const uno::Sequence< awt::KeyEvent >& aKeys )
622 uno::Reference< embed::XInplaceObject > xWrappedObject(
m_xWrappedObject, uno::UNO_QUERY );
623 if ( xWrappedObject.is() )
626 xWrappedObject->translateAccelerators( aKeys );
638 uno::Reference< container::XChild > xWrappedObject(
m_xWrappedObject, uno::UNO_QUERY );
639 if ( xWrappedObject.is() )
642 return xWrappedObject->getParent();
653 uno::Reference< container::XChild > xWrappedObject(
m_xWrappedObject, uno::UNO_QUERY );
654 if ( xWrappedObject.is() )
657 xWrappedObject->setParent( xParent );
677 if (!rArguments.hasElements())
681 auto it = aValues.
find(
"StreamReadOnly");
682 if (it != aValues.
end())
688 return "com.sun.star.comp.embed.OleEmbeddedObject";
698 return {
"com.sun.star.comp.embed.OleEmbeddedObject" };
Reference< XComponentContext > m_xContext
oslInterlockedCount m_nStatus
void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
void SAL_CALL setStream(const css::uno::Reference< css::io::XStream > &xStream) override
rtl::Reference< OwnView_Impl > m_xOwnView
virtual void SAL_CALL setClassInfo(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName) override
OleEmbeddedObject(css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Sequence< sal_Int8 > &aClassID, OUString aClassName)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
css::uno::Reference< css::util::XCloseListener > m_xClosePreventer
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::document::XEventListener > &Listener) override
virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override
virtual void SAL_CALL enableModeless(sal_Bool bEnable) override
css::uno::Reference< css::embed::XStorage > m_xParentStorage
css::uno::Reference< css::io::XStream > SAL_CALL getStream() override
void MakeEventListenerNotification_Impl(const OUString &aEventName)
virtual OUString SAL_CALL getClassName() override
css::uno::Reference< css::uno::XInterface > m_xParent
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
virtual ~OleEmbeddedObject() override
css::uno::Sequence< sal_Int8 > m_aClassID
std::unique_ptr<::comphelper::OMultiTypeInterfaceContainerHelper2 > m_pInterfaceContainer
virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
virtual void SAL_CALL addStateChangeListener(const css::uno::Reference< css::embed::XStateChangeListener > &xListener) override
virtual void SAL_CALL removeStateChangeListener(const css::uno::Reference< css::embed::XStateChangeListener > &xListener) override
virtual void SAL_CALL close(sal_Bool DeliverOwnership) override
rtl::Reference< OleComponent > m_pOleComponent
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL translateAccelerators(const css::uno::Sequence< css::awt::KeyEvent > &aKeys) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::io::XStream > m_xObjectStream
OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::embed::XEmbeddedObject > m_xWrappedObject
bool m_bStreamReadOnly
If it is allowed to modify entries in the stream of the OLE storage.
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::document::XEventListener > &Listener) override
virtual void SAL_CALL setObjectRectangles(const css::awt::Rectangle &aPosRect, const css::awt::Rectangle &aClipRect) override
css::uno::XInterface * next()
bool hasMoreElements() const
iterator find(const OUString &rKey)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool KillFile_Impl(const OUString &aURL, const uno::Reference< uno::XComponentContext > &xContext)
const char *const aClassID