Kaydet (Commit) ef62f7bd authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:returnconstant in PresenterFrameworkObserver

the Predicate stuff is effectively unused

Change-Id: Icdba9872f9915f1c7bae89548343580e97ff5de2
Reviewed-on: https://gerrit.libreoffice.org/59129
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0025cb72
...@@ -29,11 +29,9 @@ namespace sdext { namespace presenter { ...@@ -29,11 +29,9 @@ namespace sdext { namespace presenter {
PresenterFrameworkObserver::PresenterFrameworkObserver ( PresenterFrameworkObserver::PresenterFrameworkObserver (
const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController, const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController,
const Predicate& rPredicate,
const Action& rAction) const Action& rAction)
: PresenterFrameworkObserverInterfaceBase(m_aMutex), : PresenterFrameworkObserverInterfaceBase(m_aMutex),
mxConfigurationController(rxController), mxConfigurationController(rxController),
maPredicate(rPredicate),
maAction(rAction) maAction(rAction)
{ {
if ( ! mxConfigurationController.is()) if ( ! mxConfigurationController.is())
...@@ -48,7 +46,7 @@ PresenterFrameworkObserver::PresenterFrameworkObserver ( ...@@ -48,7 +46,7 @@ PresenterFrameworkObserver::PresenterFrameworkObserver (
} }
else else
{ {
rAction(maPredicate()); rAction(true);
} }
} }
...@@ -62,15 +60,9 @@ void PresenterFrameworkObserver::RunOnUpdateEnd ( ...@@ -62,15 +60,9 @@ void PresenterFrameworkObserver::RunOnUpdateEnd (
{ {
new PresenterFrameworkObserver( new PresenterFrameworkObserver(
rxController, rxController,
&PresenterFrameworkObserver::True,
rAction); rAction);
} }
bool PresenterFrameworkObserver::True()
{
return true;
}
void SAL_CALL PresenterFrameworkObserver::disposing() void SAL_CALL PresenterFrameworkObserver::disposing()
{ {
if (maAction) if (maAction)
...@@ -81,8 +73,6 @@ void SAL_CALL PresenterFrameworkObserver::disposing() ...@@ -81,8 +73,6 @@ void SAL_CALL PresenterFrameworkObserver::disposing()
void PresenterFrameworkObserver::Shutdown() void PresenterFrameworkObserver::Shutdown()
{ {
maAction = Action(); maAction = Action();
maPredicate = Predicate();
if (mxConfigurationController != nullptr) if (mxConfigurationController != nullptr)
{ {
mxConfigurationController->removeConfigurationChangeListener(this); mxConfigurationController->removeConfigurationChangeListener(this);
...@@ -109,14 +99,13 @@ void SAL_CALL PresenterFrameworkObserver::notifyConfigurationChange ( ...@@ -109,14 +99,13 @@ void SAL_CALL PresenterFrameworkObserver::notifyConfigurationChange (
bool bDispose(false); bool bDispose(false);
Action aAction (maAction); Action aAction (maAction);
Predicate aPredicate (maPredicate);
if (rEvent.Type == "ConfigurationUpdateEnd") if (rEvent.Type == "ConfigurationUpdateEnd")
{ {
Shutdown(); Shutdown();
aAction(aPredicate()); aAction(true);
bDispose = true; bDispose = true;
} }
else if (aPredicate()) else
{ {
Shutdown(); Shutdown();
aAction(true); aAction(true);
......
...@@ -41,7 +41,6 @@ class PresenterFrameworkObserver ...@@ -41,7 +41,6 @@ class PresenterFrameworkObserver
public PresenterFrameworkObserverInterfaceBase public PresenterFrameworkObserverInterfaceBase
{ {
public: public:
typedef ::std::function<bool ()> Predicate;
typedef ::std::function<void (bool)> Action; typedef ::std::function<void (bool)> Action;
PresenterFrameworkObserver(const PresenterFrameworkObserver&) = delete; PresenterFrameworkObserver(const PresenterFrameworkObserver&) = delete;
...@@ -58,7 +57,6 @@ public: ...@@ -58,7 +57,6 @@ public:
private: private:
css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController; css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
Predicate maPredicate;
Action maAction; Action maAction;
/** Create a new PresenterFrameworkObserver object. /** Create a new PresenterFrameworkObserver object.
...@@ -70,15 +68,10 @@ private: ...@@ -70,15 +68,10 @@ private:
*/ */
PresenterFrameworkObserver ( PresenterFrameworkObserver (
const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController, const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController,
const Predicate& rPredicate,
const Action& rAction); const Action& rAction);
virtual ~PresenterFrameworkObserver() override; virtual ~PresenterFrameworkObserver() override;
void Shutdown(); void Shutdown();
/** Predicate that always returns true.
*/
static bool True();
}; };
} } // end of namespace ::sdext::presenter } } // end of namespace ::sdext::presenter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment