diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 12:53:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-23 09:02:58 +0200 |
commit | a8622c77d26ca7a635afc95bba9a5054dc31eb7c (patch) | |
tree | ecb1ce71272291515dec10fc5fe94061f7231b78 /sdext | |
parent | 2684aefcf5d2804351bda01a2d2fe7bbbd351451 (diff) |
loplugin:flatten in sdext..stoc
Change-Id: I460e813e20a691c53738373376d3363f553bbab2
Reviewed-on: https://gerrit.libreoffice.org/42636
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/presenter/PresenterPaneBase.cxx | 144 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterProtocolHandler.cxx | 54 |
2 files changed, 95 insertions, 103 deletions
diff --git a/sdext/source/presenter/PresenterPaneBase.cxx b/sdext/source/presenter/PresenterPaneBase.cxx index 7e034ee30551..c7bfa0b02fa0 100644 --- a/sdext/source/presenter/PresenterPaneBase.cxx +++ b/sdext/source/presenter/PresenterPaneBase.cxx @@ -143,86 +143,84 @@ void SAL_CALL PresenterPaneBase::initialize (const Sequence<Any>& rArguments) static_cast<XWeak*>(this)); } - if (rArguments.getLength() == 5 || rArguments.getLength() == 6) + if (rArguments.getLength() != 5 && rArguments.getLength() != 6) { - try + throw RuntimeException( + "PresenterSpritePane: invalid number of arguments", + static_cast<XWeak*>(this)); + } + + try + { + // Get the resource id from the first argument. + if ( ! (rArguments[0] >>= mxPaneId)) { - // Get the resource id from the first argument. - if ( ! (rArguments[0] >>= mxPaneId)) - { - throw lang::IllegalArgumentException( - "PresenterPane: invalid pane id", - static_cast<XWeak*>(this), - 0); - } - - if ( ! (rArguments[1] >>= mxParentWindow)) - { - throw lang::IllegalArgumentException( - "PresenterPane: invalid parent window", - static_cast<XWeak*>(this), - 1); - } - - Reference<rendering::XSpriteCanvas> xParentCanvas; - if ( ! (rArguments[2] >>= xParentCanvas)) - { - throw lang::IllegalArgumentException( - "PresenterPane: invalid parent canvas", - static_cast<XWeak*>(this), - 2); - } - - if ( ! (rArguments[3] >>= msTitle)) - { - throw lang::IllegalArgumentException( - "PresenterPane: invalid title", - static_cast<XWeak*>(this), - 3); - } - - if ( ! (rArguments[4] >>= mxBorderPainter)) - { - throw lang::IllegalArgumentException( - "PresenterPane: invalid border painter", - static_cast<XWeak*>(this), - 4); - } - - bool bIsWindowVisibleOnCreation (true); - if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation)) - { - throw lang::IllegalArgumentException( - "PresenterPane: invalid window visibility flag", - static_cast<XWeak*>(this), - 5); - } - - CreateWindows(mxParentWindow, bIsWindowVisibleOnCreation); - - if (mxBorderWindow.is()) - { - mxBorderWindow->addWindowListener(this); - mxBorderWindow->addPaintListener(this); - } - - CreateCanvases(mxParentWindow, xParentCanvas); - - // Raise new windows. - ToTop(); + throw lang::IllegalArgumentException( + "PresenterPane: invalid pane id", + static_cast<XWeak*>(this), + 0); } - catch (Exception&) + + if ( ! (rArguments[1] >>= mxParentWindow)) { - mxContentWindow = nullptr; - mxComponentContext = nullptr; - throw; + throw lang::IllegalArgumentException( + "PresenterPane: invalid parent window", + static_cast<XWeak*>(this), + 1); } + + Reference<rendering::XSpriteCanvas> xParentCanvas; + if ( ! (rArguments[2] >>= xParentCanvas)) + { + throw lang::IllegalArgumentException( + "PresenterPane: invalid parent canvas", + static_cast<XWeak*>(this), + 2); + } + + if ( ! (rArguments[3] >>= msTitle)) + { + throw lang::IllegalArgumentException( + "PresenterPane: invalid title", + static_cast<XWeak*>(this), + 3); + } + + if ( ! (rArguments[4] >>= mxBorderPainter)) + { + throw lang::IllegalArgumentException( + "PresenterPane: invalid border painter", + static_cast<XWeak*>(this), + 4); + } + + bool bIsWindowVisibleOnCreation (true); + if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation)) + { + throw lang::IllegalArgumentException( + "PresenterPane: invalid window visibility flag", + static_cast<XWeak*>(this), + 5); + } + + CreateWindows(mxParentWindow, bIsWindowVisibleOnCreation); + + if (mxBorderWindow.is()) + { + mxBorderWindow->addWindowListener(this); + mxBorderWindow->addPaintListener(this); + } + + CreateCanvases(mxParentWindow, xParentCanvas); + + // Raise new windows. + ToTop(); } - else + catch (Exception&) { - throw RuntimeException( - "PresenterSpritePane: invalid number of arguments", - static_cast<XWeak*>(this)); + mxContentWindow = nullptr; + mxComponentContext = nullptr; + throw; } } diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx index f1aceb54f8d1..b7ca0c08a4b2 100644 --- a/sdext/source/presenter/PresenterProtocolHandler.cxx +++ b/sdext/source/presenter/PresenterProtocolHandler.cxx @@ -430,54 +430,48 @@ void SAL_CALL PresenterProtocolHandler::Dispatch::dispatch( static_cast<uno::XWeak*>(this)); } - if (rURL.Protocol == "vnd.org.libreoffice.presenterscreen:" - && rURL.Path == msURLPath) - { - if (mpCommand.get() != nullptr) - mpCommand->Execute(); - } - else + if (rURL.Protocol != "vnd.org.libreoffice.presenterscreen:" + || rURL.Path != msURLPath) { // We can not throw an IllegalArgumentException throw RuntimeException(); } + + if (mpCommand.get() != nullptr) + mpCommand->Execute(); } void SAL_CALL PresenterProtocolHandler::Dispatch::addStatusListener( const css::uno::Reference<css::frame::XStatusListener>& rxListener, const css::util::URL& rURL) { - if (rURL.Path == msURLPath) - { - maStatusListenerContainer.push_back(rxListener); - - frame::FeatureStateEvent aEvent; - aEvent.FeatureURL = rURL; - aEvent.IsEnabled = mpCommand->IsEnabled(); - aEvent.Requery = false; - aEvent.State = mpCommand->GetState(); - rxListener->statusChanged(aEvent); - } - else + if (rURL.Path != msURLPath) throw RuntimeException(); + + maStatusListenerContainer.push_back(rxListener); + + frame::FeatureStateEvent aEvent; + aEvent.FeatureURL = rURL; + aEvent.IsEnabled = mpCommand->IsEnabled(); + aEvent.Requery = false; + aEvent.State = mpCommand->GetState(); + rxListener->statusChanged(aEvent); } void SAL_CALL PresenterProtocolHandler::Dispatch::removeStatusListener ( const css::uno::Reference<css::frame::XStatusListener>& rxListener, const css::util::URL& rURL) { - if (rURL.Path == msURLPath) - { - StatusListenerContainer::iterator iListener ( - ::std::find( - maStatusListenerContainer.begin(), - maStatusListenerContainer.end(), - rxListener)); - if (iListener != maStatusListenerContainer.end()) - maStatusListenerContainer.erase(iListener); - } - else + if (rURL.Path != msURLPath) throw RuntimeException(); + + StatusListenerContainer::iterator iListener ( + ::std::find( + maStatusListenerContainer.begin(), + maStatusListenerContainer.end(), + rxListener)); + if (iListener != maStatusListenerContainer.end()) + maStatusListenerContainer.erase(iListener); } //----- document::XEventListener ---------------------------------------------- |