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 {
PresenterFrameworkObserver::PresenterFrameworkObserver (
const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController,
const Predicate& rPredicate,
const Action& rAction)
: PresenterFrameworkObserverInterfaceBase(m_aMutex),
mxConfigurationController(rxController),
maPredicate(rPredicate),
maAction(rAction)
{
if ( ! mxConfigurationController.is())
......@@ -48,7 +46,7 @@ PresenterFrameworkObserver::PresenterFrameworkObserver (
}
else
{
rAction(maPredicate());
rAction(true);
}
}
......@@ -62,15 +60,9 @@ void PresenterFrameworkObserver::RunOnUpdateEnd (
{
new PresenterFrameworkObserver(
rxController,
&PresenterFrameworkObserver::True,
rAction);
}
bool PresenterFrameworkObserver::True()
{
return true;
}
void SAL_CALL PresenterFrameworkObserver::disposing()
{
if (maAction)
......@@ -81,8 +73,6 @@ void SAL_CALL PresenterFrameworkObserver::disposing()
void PresenterFrameworkObserver::Shutdown()
{
maAction = Action();
maPredicate = Predicate();
if (mxConfigurationController != nullptr)
{
mxConfigurationController->removeConfigurationChangeListener(this);
......@@ -109,14 +99,13 @@ void SAL_CALL PresenterFrameworkObserver::notifyConfigurationChange (
bool bDispose(false);
Action aAction (maAction);
Predicate aPredicate (maPredicate);
if (rEvent.Type == "ConfigurationUpdateEnd")
{
Shutdown();
aAction(aPredicate());
aAction(true);
bDispose = true;
}
else if (aPredicate())
else
{
Shutdown();
aAction(true);
......
......@@ -41,7 +41,6 @@ class PresenterFrameworkObserver
public PresenterFrameworkObserverInterfaceBase
{
public:
typedef ::std::function<bool ()> Predicate;
typedef ::std::function<void (bool)> Action;
PresenterFrameworkObserver(const PresenterFrameworkObserver&) = delete;
......@@ -58,7 +57,6 @@ public:
private:
css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
Predicate maPredicate;
Action maAction;
/** Create a new PresenterFrameworkObserver object.
......@@ -70,15 +68,10 @@ private:
*/
PresenterFrameworkObserver (
const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController,
const Predicate& rPredicate,
const Action& rAction);
virtual ~PresenterFrameworkObserver() override;
void Shutdown();
/** Predicate that always returns true.
*/
static bool True();
};
} } // 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