diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-14 09:12:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-15 09:48:47 +0100 |
commit | 86e5ec2e5f199185dd8e9a03e72d4a2f81d9eabc (patch) | |
tree | c2b0891463a184b9f55d89caa66a02b75f8332d5 /sd/source/ui/framework/factories/BasicViewFactory.cxx | |
parent | abe047f1e8c65e65d63077923fb051b32673fddd (diff) |
loplugin:flatten in sd/source/ui/framework
Change-Id: Id1da25f6ee6ee867e93e0b4c58b6429e07b12429
Reviewed-on: https://gerrit.libreoffice.org/67834
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/framework/factories/BasicViewFactory.cxx')
-rw-r--r-- | sd/source/ui/framework/factories/BasicViewFactory.cxx | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 7537882625ea..3bc14fdfbea8 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -185,87 +185,87 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV if ( ! rxView.is()) throw lang::IllegalArgumentException(); - if (rxView.is() && mpBase!=nullptr) + if (!rxView.is() || !mpBase) + return; + + ViewShellContainer::iterator iViewShell ( + ::std::find_if( + mpViewShellContainer->begin(), + mpViewShellContainer->end(), + [&] (std::shared_ptr<ViewDescriptor> const& pVD) { + return ViewDescriptor::CompareView(pVD, rxView); + } )); + if (iViewShell == mpViewShellContainer->end()) { - ViewShellContainer::iterator iViewShell ( - ::std::find_if( - mpViewShellContainer->begin(), - mpViewShellContainer->end(), - [&] (std::shared_ptr<ViewDescriptor> const& pVD) { - return ViewDescriptor::CompareView(pVD, rxView); - } )); - if (iViewShell == mpViewShellContainer->end()) - { - throw lang::IllegalArgumentException(); - } + throw lang::IllegalArgumentException(); + } - std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell); + std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell); - if ((*iViewShell)->mxViewId->isBoundToURL( - FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT)) + if ((*iViewShell)->mxViewId->isBoundToURL( + FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT)) + { + // Obtain a pointer to and connect to the frame view of the + // view. The next view, that is created, will be + // initialized with this frame view. + if (mpFrameView == nullptr) { - // Obtain a pointer to and connect to the frame view of the - // view. The next view, that is created, will be - // initialized with this frame view. - if (mpFrameView == nullptr) - { - mpFrameView = pViewShell->GetFrameView(); - if (mpFrameView) - mpFrameView->Connect(); - } - - // With the view in the center pane the sub controller is - // released, too. - mpBase->GetDrawController().SetSubController( - Reference<drawing::XDrawSubController>()); - - SfxViewShell* pSfxViewShell = pViewShell->GetViewShell(); - if (pSfxViewShell != nullptr) - pSfxViewShell->DisconnectAllClients(); + mpFrameView = pViewShell->GetFrameView(); + if (mpFrameView) + mpFrameView->Connect(); } - ReleaseView(*iViewShell, false); + // With the view in the center pane the sub controller is + // released, too. + mpBase->GetDrawController().SetSubController( + Reference<drawing::XDrawSubController>()); - mpViewShellContainer->erase(iViewShell); + SfxViewShell* pSfxViewShell = pViewShell->GetViewShell(); + if (pSfxViewShell != nullptr) + pSfxViewShell->DisconnectAllClients(); } + + ReleaseView(*iViewShell, false); + + mpViewShellContainer->erase(iViewShell); } void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) { - if (aArguments.getLength() > 0) + if (aArguments.getLength() <= 0) + return; + + try { - try - { - // Get the XController from the first argument. - Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW); - - // Tunnel through the controller to obtain a ViewShellBase. - Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW); - ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>( - xTunnel->getSomething(sd::DrawController::getUnoTunnelId())); - if (pController != nullptr) - mpBase = pController->GetViewShellBase(); - - // Register the factory for its supported views. - Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW); - mxConfigurationController = xCM->getConfigurationController(); - if ( ! mxConfigurationController.is()) - throw RuntimeException(); - mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); - } - catch (RuntimeException&) - { - mpBase = nullptr; - if (mxConfigurationController.is()) - mxConfigurationController->removeResourceFactoryForReference(this); - throw; - } + // Get the XController from the first argument. + Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW); + + // Tunnel through the controller to obtain a ViewShellBase. + Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW); + ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>( + xTunnel->getSomething(sd::DrawController::getUnoTunnelId())); + if (pController != nullptr) + mpBase = pController->GetViewShellBase(); + + // Register the factory for its supported views. + Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW); + mxConfigurationController = xCM->getConfigurationController(); + if ( ! mxConfigurationController.is()) + throw RuntimeException(); + mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); + } + catch (RuntimeException&) + { + mpBase = nullptr; + if (mxConfigurationController.is()) + mxConfigurationController->removeResourceFactoryForReference(this); + throw; } } |