diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-06 10:09:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-07 08:19:14 +0100 |
commit | 536a6d6ca67d01c8470c242c6f1fd0750496eed4 (patch) | |
tree | cc2aed75621456aaeb31d26e910cc61baf3bfdd7 /sfx2/source/appl/childwin.cxx | |
parent | 53a318196859140deb4b3c317db583a90cfd604c (diff) |
loplugin:flatten in sfx2
Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421
Reviewed-on: https://gerrit.libreoffice.org/67435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/appl/childwin.cxx')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index ff4a1a1023bc..50d9371907d7 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -80,24 +80,24 @@ class DisposeListener : public ::cppu::WeakImplHelper< css::lang::XEventListener if( xComp.is() ) xComp->removeEventListener( this ); - if( m_pOwner && m_pData ) - { - m_pData->xListener.clear(); + if( !m_pOwner || !m_pData ) + return; - if ( m_pData->pWorkWin ) - { - // m_pOwner and m_pData will be killed - m_pData->xFrame.clear(); - m_pData->pWorkWin->GetBindings().Execute( m_pOwner->GetType() ); - } - else - { - delete m_pOwner; - } + m_pData->xListener.clear(); - m_pOwner = nullptr; - m_pData = nullptr; + if ( m_pData->pWorkWin ) + { + // m_pOwner and m_pData will be killed + m_pData->xFrame.clear(); + m_pData->pWorkWin->GetBindings().Execute( m_pOwner->GetType() ); } + else + { + delete m_pOwner; + } + + m_pOwner = nullptr; + m_pData = nullptr; } private: @@ -392,43 +392,43 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI OUString aWinData( aTmp ); rInfo.aWinState = OUStringToOString(xWinOpt->GetWindowState(), RTL_TEXTENCODING_UTF8); - if ( !aWinData.isEmpty() ) + if ( aWinData.isEmpty() ) + return; + + // Search for version ID + if ( aWinData[0] != 0x0056 ) // 'V' = 56h + // A version ID, so do not use + return; + + // Delete 'V' + aWinData = aWinData.copy(1); + + // Read version + char cToken = ','; + sal_Int32 nPos = aWinData.indexOf( cToken ); + sal_uInt16 nActVersion = static_cast<sal_uInt16>(aWinData.copy( 0, nPos + 1 ).toInt32()); + if ( nActVersion != nVersion ) + return; + + aWinData = aWinData.copy(nPos+1); + + // Load Visibility: is coded as a char + rInfo.bVisible = (aWinData[0] == 0x0056); // 'V' = 56h + aWinData = aWinData.copy(1); + nPos = aWinData.indexOf( cToken ); + if (nPos == -1) + return; + + sal_Int32 nNextPos = aWinData.indexOf( cToken, 2 ); + if ( nNextPos != -1 ) { - // Search for version ID - if ( aWinData[0] != 0x0056 ) // 'V' = 56h - // A version ID, so do not use - return; - - // Delete 'V' - aWinData = aWinData.copy(1); - - // Read version - char cToken = ','; - sal_Int32 nPos = aWinData.indexOf( cToken ); - sal_uInt16 nActVersion = static_cast<sal_uInt16>(aWinData.copy( 0, nPos + 1 ).toInt32()); - if ( nActVersion != nVersion ) - return; - - aWinData = aWinData.copy(nPos+1); - - // Load Visibility: is coded as a char - rInfo.bVisible = (aWinData[0] == 0x0056); // 'V' = 56h - aWinData = aWinData.copy(1); - nPos = aWinData.indexOf( cToken ); - if (nPos != -1) - { - sal_Int32 nNextPos = aWinData.indexOf( cToken, 2 ); - if ( nNextPos != -1 ) - { - // there is extra information - rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32())); - aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); - rInfo.aExtraString = aWinData; - } - else - rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 ).toInt32())); - } + // there is extra information + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32())); + aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); + rInfo.aExtraString = aWinData; } + else + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 ).toInt32())); } void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBindings ) @@ -700,24 +700,24 @@ const css::uno::Reference< css::frame::XFrame >& SfxChildWindow::GetFrame() void SfxChildWindow::SetFrame( const css::uno::Reference< css::frame::XFrame > & rFrame ) { // Do nothing if nothing will be changed ... - if( pImpl->xFrame != rFrame ) - { - // ... but stop listening on old frame, if connection exist! - if( pImpl->xFrame.is() ) - pImpl->xFrame->removeEventListener( pImpl->xListener ); - - // If new frame is not NULL -> we must guarantee valid listener for disposing events. - // Use already existing or create new one. - if( rFrame.is() ) - if( !pImpl->xListener.is() ) - pImpl->xListener.set( new DisposeListener( this, pImpl.get() ) ); - - // Set new frame in data container - // and build new listener connection, if necessary. - pImpl->xFrame = rFrame; - if( pImpl->xFrame.is() ) - pImpl->xFrame->addEventListener( pImpl->xListener ); - } + if( pImpl->xFrame == rFrame ) + return; + + // ... but stop listening on old frame, if connection exist! + if( pImpl->xFrame.is() ) + pImpl->xFrame->removeEventListener( pImpl->xListener ); + + // If new frame is not NULL -> we must guarantee valid listener for disposing events. + // Use already existing or create new one. + if( rFrame.is() ) + if( !pImpl->xListener.is() ) + pImpl->xListener.set( new DisposeListener( this, pImpl.get() ) ); + + // Set new frame in data container + // and build new listener connection, if necessary. + pImpl->xFrame = rFrame; + if( pImpl->xFrame.is() ) + pImpl->xFrame->addEventListener( pImpl->xListener ); } void SfxChildWindowContext::RegisterChildWindowContext(SfxModule* pMod, sal_uInt16 nId, std::unique_ptr<SfxChildWinContextFactory> pFact) |