summaryrefslogtreecommitdiff
path: root/embeddedobj/source/commonembedding/miscobj.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 15:48:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 20:39:00 +0200
commit1c3929a0a1645e802ee18f9c3d3d380375500c72 (patch)
tree842d6867a8c67837b15d2ff666e1ad1dd694b401 /embeddedobj/source/commonembedding/miscobj.cxx
parent9693b491295336955f7ce8359284b67a82ecf28f (diff)
loplugin:flatten in embeddedobj,emfio
Change-Id: Ibaf5e1a4db1088322cf8c5e127d328b140406197 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92196 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'embeddedobj/source/commonembedding/miscobj.cxx')
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx124
1 files changed, 62 insertions, 62 deletions
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index 5947fef7aca0..71f79fabd96d 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -256,34 +256,34 @@ void OCommonEmbeddedObject::LinkInit_Impl(
OCommonEmbeddedObject::~OCommonEmbeddedObject()
{
- if ( m_pInterfaceContainer || m_xDocHolder.is() )
- {
- osl_atomic_increment(&m_refCount);
- try {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ if ( !(m_pInterfaceContainer || m_xDocHolder.is()) )
+ return;
- if ( m_pInterfaceContainer )
- {
- m_pInterfaceContainer->disposeAndClear( aSource );
+ osl_atomic_increment(&m_refCount);
+ try {
+ lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
- delete m_pInterfaceContainer;
- m_pInterfaceContainer = nullptr;
- }
- } catch( const uno::Exception& ) {}
+ if ( m_pInterfaceContainer )
+ {
+ m_pInterfaceContainer->disposeAndClear( aSource );
- try {
- if ( m_xDocHolder.is() )
- {
- m_xDocHolder->CloseFrame();
- try {
- m_xDocHolder->CloseDocument( true, true );
- } catch ( const uno::Exception& ) {}
- m_xDocHolder->FreeOffice();
+ delete m_pInterfaceContainer;
+ m_pInterfaceContainer = nullptr;
+ }
+ } catch( const uno::Exception& ) {}
- m_xDocHolder.clear();
- }
- } catch( const uno::Exception& ) {}
- }
+ try {
+ if ( m_xDocHolder.is() )
+ {
+ m_xDocHolder->CloseFrame();
+ try {
+ m_xDocHolder->CloseDocument( true, true );
+ } catch ( const uno::Exception& ) {}
+ m_xDocHolder->FreeOffice();
+
+ m_xDocHolder.clear();
+ }
+ } catch( const uno::Exception& ) {}
}
@@ -292,20 +292,20 @@ void OCommonEmbeddedObject::requestPositioning( const awt::Rectangle& aRect )
// the method is called in case object is inplace active and the object window was resized
OSL_ENSURE( m_xClientSite.is(), "The client site must be set for inplace active object!" );
- if ( m_xClientSite.is() )
- {
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
+ if ( !m_xClientSite.is() )
+ return;
+
+ uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
- OSL_ENSURE( xInplaceClient.is(), "The client site must support XInplaceClient to allow inplace activation!" );
- if ( xInplaceClient.is() )
+ OSL_ENSURE( xInplaceClient.is(), "The client site must support XInplaceClient to allow inplace activation!" );
+ if ( xInplaceClient.is() )
+ {
+ try {
+ xInplaceClient->changedPlacement( aRect );
+ }
+ catch( const uno::Exception& )
{
- try {
- xInplaceClient->changedPlacement( aRect );
- }
- catch( const uno::Exception& )
- {
- OSL_FAIL( "Exception on request to resize!" );
- }
+ OSL_FAIL( "Exception on request to resize!" );
}
}
}
@@ -313,35 +313,35 @@ void OCommonEmbeddedObject::requestPositioning( const awt::Rectangle& aRect )
void OCommonEmbeddedObject::PostEvent_Impl( const OUString& aEventName )
{
- if ( m_pInterfaceContainer )
+ if ( !m_pInterfaceContainer )
+ return;
+
+ ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
+ cppu::UnoType<document::XEventListener>::get());
+ if( !pIC )
+ return;
+
+ document::EventObject aEvent;
+ aEvent.EventName = aEventName;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ // For now all the events are sent as object events
+ // aEvent.Source = ( xSource.is() ? xSource
+ // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
+ ::cppu::OInterfaceIteratorHelper aIt( *pIC );
+ while( aIt.hasMoreElements() )
{
- ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
- cppu::UnoType<document::XEventListener>::get());
- if( pIC )
+ try
{
- document::EventObject aEvent;
- aEvent.EventName = aEventName;
- aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
- // For now all the events are sent as object events
- // aEvent.Source = ( xSource.is() ? xSource
- // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- try
- {
- static_cast<document::XEventListener *>(aIt.next())->notifyEvent( aEvent );
- }
- catch( const uno::RuntimeException& )
- {
- aIt.remove();
- }
-
- // the listener could dispose the object.
- if ( m_bDisposed )
- return;
- }
+ static_cast<document::XEventListener *>(aIt.next())->notifyEvent( aEvent );
+ }
+ catch( const uno::RuntimeException& )
+ {
+ aIt.remove();
}
+
+ // the listener could dispose the object.
+ if ( m_bDisposed )
+ return;
}
}