diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-14 09:10:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-15 07:48:24 +0100 |
commit | fcdfb94ac11cd4832ad68c896c706fb3cb376ce4 (patch) | |
tree | f1cbab12af9b0003432e5928573b23d5646ed9f3 /sd/source/ui/unoidl/DrawController.cxx | |
parent | c2429e3e95a4298f43c468f36a1a2832992dd40e (diff) |
loplugin:flatten in sd/source/ui/[t-u]*
Change-Id: I6db7c26c9534b249a38cec96f3875f808702a598
Reviewed-on: https://gerrit.libreoffice.org/67829
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/unoidl/DrawController.cxx')
-rw-r--r-- | sd/source/ui/unoidl/DrawController.cxx | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 8f7cd937efa4..2085e77b2d74 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -126,42 +126,42 @@ IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController); void SAL_CALL DrawController::dispose() { - if( !mbDisposing ) + if( mbDisposing ) + return; + + SolarMutexGuard aGuard; + + if( mbDisposing ) + return; + + mbDisposing = true; + + std::shared_ptr<ViewShell> pViewShell; + if (mpBase) + pViewShell = mpBase->GetMainViewShell(); + if ( pViewShell ) { - SolarMutexGuard aGuard; + pViewShell->DeactivateCurrentFunction(); + DrawDocShell* pDocShell = pViewShell->GetDocSh(); + if ( pDocShell != nullptr ) + pDocShell->SetDocShellFunction(nullptr); + } + pViewShell.reset(); - if( !mbDisposing ) - { - mbDisposing = true; - - std::shared_ptr<ViewShell> pViewShell; - if (mpBase) - pViewShell = mpBase->GetMainViewShell(); - if ( pViewShell ) - { - pViewShell->DeactivateCurrentFunction(); - DrawDocShell* pDocShell = pViewShell->GetDocSh(); - if ( pDocShell != nullptr ) - pDocShell->SetDocShellFunction(nullptr); - } - pViewShell.reset(); - - // When the controller has not been detached from its view - // shell, i.e. mpViewShell is not NULL, then tell PaneManager - // and ViewShellManager to clear the shell stack. - if (mxSubController.is() && mpBase!=nullptr) - { - mpBase->DisconnectAllClients(); - mpBase->GetViewShellManager()->Shutdown(); - } - - OPropertySetHelper::disposing(); - - DisposeFrameworkControllers(); - - SfxBaseController::dispose(); - } + // When the controller has not been detached from its view + // shell, i.e. mpViewShell is not NULL, then tell PaneManager + // and ViewShellManager to clear the shell stack. + if (mxSubController.is() && mpBase!=nullptr) + { + mpBase->DisconnectAllClients(); + mpBase->GetViewShellManager()->Shutdown(); } + + OPropertySetHelper::disposing(); + + DisposeFrameworkControllers(); + + SfxBaseController::dispose(); } void SAL_CALL DrawController::addEventListener( @@ -276,23 +276,23 @@ void SAL_CALL // Have to forward the event to our selection change listeners. OInterfaceContainerHelper* pListeners = BroadcastHelperOwner::maBroadcastHelper.getContainer( cppu::UnoType<view::XSelectionChangeListener>::get()); - if (pListeners) + if (!pListeners) + return; + + // Re-send the event to all of our listeners. + OInterfaceIteratorHelper aIterator (*pListeners); + while (aIterator.hasMoreElements()) { - // Re-send the event to all of our listeners. - OInterfaceIteratorHelper aIterator (*pListeners); - while (aIterator.hasMoreElements()) + try + { + view::XSelectionChangeListener* pListener = + static_cast<view::XSelectionChangeListener*>( + aIterator.next()); + if (pListener != nullptr) + pListener->selectionChanged (rEvent); + } + catch (const RuntimeException&) { - try - { - view::XSelectionChangeListener* pListener = - static_cast<view::XSelectionChangeListener*>( - aIterator.next()); - if (pListener != nullptr) - pListener->selectionChanged (rEvent); - } - catch (const RuntimeException&) - { - } } } } @@ -328,51 +328,51 @@ Reference< drawing::XDrawPage > SAL_CALL DrawController::getCurrentPage() void DrawController::FireVisAreaChanged (const ::tools::Rectangle& rVisArea) throw() { - if( maLastVisArea != rVisArea ) - { - Any aNewValue; - aNewValue <<= awt::Rectangle( - rVisArea.Left(), - rVisArea.Top(), - rVisArea.GetWidth(), - rVisArea.GetHeight() ); + if( maLastVisArea == rVisArea ) + return; - Any aOldValue; - aOldValue <<= awt::Rectangle( - maLastVisArea.Left(), - maLastVisArea.Top(), - maLastVisArea.GetWidth(), - maLastVisArea.GetHeight() ); + Any aNewValue; + aNewValue <<= awt::Rectangle( + rVisArea.Left(), + rVisArea.Top(), + rVisArea.GetWidth(), + rVisArea.GetHeight() ); - FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue); + Any aOldValue; + aOldValue <<= awt::Rectangle( + maLastVisArea.Left(), + maLastVisArea.Top(), + maLastVisArea.GetWidth(), + maLastVisArea.GetHeight() ); - maLastVisArea = rVisArea; - } + FirePropertyChange (PROPERTY_WORKAREA, aNewValue, aOldValue); + + maLastVisArea = rVisArea; } void DrawController::FireSelectionChangeListener() throw() { OInterfaceContainerHelper * pLC = BroadcastHelperOwner::maBroadcastHelper.getContainer( m_aSelectionTypeIdentifier); - if( pLC ) - { - Reference< XInterface > xSource( static_cast<XWeak*>(this) ); - const lang::EventObject aEvent( xSource ); + if( !pLC ) + return; - // iterate over all listeners and send events - OInterfaceIteratorHelper aIt( *pLC); - while( aIt.hasMoreElements() ) + Reference< XInterface > xSource( static_cast<XWeak*>(this) ); + const lang::EventObject aEvent( xSource ); + + // iterate over all listeners and send events + OInterfaceIteratorHelper aIt( *pLC); + while( aIt.hasMoreElements() ) + { + try + { + view::XSelectionChangeListener * pL = + static_cast<view::XSelectionChangeListener*>(aIt.next()); + if (pL != nullptr) + pL->selectionChanged( aEvent ); + } + catch (const RuntimeException&) { - try - { - view::XSelectionChangeListener * pL = - static_cast<view::XSelectionChangeListener*>(aIt.next()); - if (pL != nullptr) - pL->selectionChanged( aEvent ); - } - catch (const RuntimeException&) - { - } } } } @@ -406,28 +406,28 @@ void DrawController::FireChangeLayerMode (bool bLayerMode) throw() void DrawController::FireSwitchCurrentPage (SdPage* pNewCurrentPage) throw() { SdrPage* pCurrentPage = mpCurrentPage.get(); - if (pNewCurrentPage != pCurrentPage) - { - try - { - Any aNewValue ( - makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY))); - - Any aOldValue; - if (pCurrentPage != nullptr) - { - Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY); - aOldValue <<= xOldPage; - } + if (pNewCurrentPage == pCurrentPage) + return; - FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue); + try + { + Any aNewValue ( + makeAny(Reference<drawing::XDrawPage>(pNewCurrentPage->getUnoPage(), UNO_QUERY))); - mpCurrentPage.reset(pNewCurrentPage); - } - catch (const uno::Exception& e) + Any aOldValue; + if (pCurrentPage != nullptr) { - SAL_WARN("sd", "sd::SdUnoDrawView::FireSwitchCurrentPage(), exception caught: " << e); + Reference<drawing::XDrawPage> xOldPage (pCurrentPage->getUnoPage(), UNO_QUERY); + aOldValue <<= xOldPage; } + + FirePropertyChange(PROPERTY_CURRENTPAGE, aNewValue, aOldValue); + + mpCurrentPage.reset(pNewCurrentPage); + } + catch (const uno::Exception& e) + { + SAL_WARN("sd", "sd::SdUnoDrawView::FireSwitchCurrentPage(), exception caught: " << e); } } |