summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-30 19:35:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-03 08:41:11 +0200
commitd3971ec256450e6783920b46f672048b29719949 (patch)
treef4722d0e2bc321cf71b49b7573cf38640e9b28fc /embeddedobj
parentf50bf3c5225b49b3c6f77f882e35305e5dc5ccd3 (diff)
new loplugin:blockblock
Change-Id: I7b68b70fa4c7234e8882f7627026959a596968fd Reviewed-on: https://gerrit.libreoffice.org/43025 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx94
1 files changed, 46 insertions, 48 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index d24533a63146..c107cb1a416b 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -404,67 +404,65 @@ uno::Sequence< sal_Int32 > const & OCommonEmbeddedObject::GetIntermediateStatesS
void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
{
- {
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
+ ::osl::ResettableMutexGuard aGuard( m_aMutex );
+ if ( m_bDisposed )
+ throw lang::DisposedException(); // TODO
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( "The object has no persistence!",
- static_cast< ::cppu::OWeakObject* >(this) );
+ if ( m_nObjectState == -1 )
+ throw embed::WrongStateException( "The object has no persistence!",
+ static_cast< ::cppu::OWeakObject* >(this) );
- sal_Int32 nOldState = m_nObjectState;
+ sal_Int32 nOldState = m_nObjectState;
- if ( m_nTargetState != -1 )
- {
- // means that the object is currently trying to reach the target state
- throw embed::StateChangeInProgressException( OUString(),
- uno::Reference< uno::XInterface >(),
- m_nTargetState );
- }
- else
- {
- TargetStateControl_Impl aControl( m_nTargetState, nNewState );
+ if ( m_nTargetState != -1 )
+ {
+ // means that the object is currently trying to reach the target state
+ throw embed::StateChangeInProgressException( OUString(),
+ uno::Reference< uno::XInterface >(),
+ m_nTargetState );
+ }
+ else
+ {
+ TargetStateControl_Impl aControl( m_nTargetState, nNewState );
- // in case the object is already in requested state
- if ( m_nObjectState == nNewState )
- {
- // if active object is activated again, bring its window to top
- if ( m_nObjectState == embed::EmbedStates::ACTIVE )
- m_xDocHolder->Show();
+ // in case the object is already in requested state
+ if ( m_nObjectState == nNewState )
+ {
+ // if active object is activated again, bring its window to top
+ if ( m_nObjectState == embed::EmbedStates::ACTIVE )
+ m_xDocHolder->Show();
- return;
- }
+ return;
+ }
- // retrieve sequence of states that should be passed to reach desired state
- uno::Sequence< sal_Int32 > aIntermediateStates = GetIntermediateStatesSequence_Impl( nNewState );
+ // retrieve sequence of states that should be passed to reach desired state
+ uno::Sequence< sal_Int32 > aIntermediateStates = GetIntermediateStatesSequence_Impl( nNewState );
- // notify listeners that the object is going to change the state
- StateChangeNotification_Impl( true, nOldState, nNewState,aGuard );
+ // notify listeners that the object is going to change the state
+ StateChangeNotification_Impl( true, nOldState, nNewState,aGuard );
- try {
- for ( sal_Int32 nInd = 0; nInd < aIntermediateStates.getLength(); nInd++ )
- SwitchStateTo_Impl( aIntermediateStates[nInd] );
+ try {
+ for ( sal_Int32 nInd = 0; nInd < aIntermediateStates.getLength(); nInd++ )
+ SwitchStateTo_Impl( aIntermediateStates[nInd] );
- SwitchStateTo_Impl( nNewState );
- }
- catch( const uno::Exception& )
- {
- if ( nOldState != m_nObjectState )
- // notify listeners that the object has changed the state
- StateChangeNotification_Impl( false, nOldState, m_nObjectState, aGuard );
+ SwitchStateTo_Impl( nNewState );
+ }
+ catch( const uno::Exception& )
+ {
+ if ( nOldState != m_nObjectState )
+ // notify listeners that the object has changed the state
+ StateChangeNotification_Impl( false, nOldState, m_nObjectState, aGuard );
- throw;
- }
+ throw;
}
+ }
- // notify listeners that the object has changed the state
- StateChangeNotification_Impl( false, nOldState, nNewState, aGuard );
+ // notify listeners that the object has changed the state
+ StateChangeNotification_Impl( false, nOldState, nNewState, aGuard );
- // let the object window be shown
- if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE )
- PostEvent_Impl( "OnVisAreaChanged" );
- }
+ // let the object window be shown
+ if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE )
+ PostEvent_Impl( "OnVisAreaChanged" );
}