2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2003-11-24 15:28:14 +00:00
|
|
|
|
2014-03-31 16:19:33 +03:00
|
|
|
#ifndef INCLUDED_SVX_SOURCE_INC_EVENTHANDLER_HXX
|
|
|
|
#define INCLUDED_SVX_SOURCE_INC_EVENTHANDLER_HXX
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
#include <sal/types.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <vcl/timer.hxx>
|
2015-01-14 13:11:28 +00:00
|
|
|
#include <vcl/idle.hxx>
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
namespace sdr
|
|
|
|
{
|
|
|
|
namespace event
|
|
|
|
{
|
|
|
|
class BaseEvent;
|
2016-07-04 13:35:04 +02:00
|
|
|
class TimerEventHandler;
|
2003-11-24 15:28:14 +00:00
|
|
|
} // end of namespace event
|
|
|
|
} // end of namespace sdr
|
|
|
|
|
|
|
|
namespace sdr
|
|
|
|
{
|
|
|
|
namespace event
|
|
|
|
{
|
|
|
|
class BaseEvent
|
|
|
|
{
|
|
|
|
// the EventHandler this event is registered at
|
2016-07-04 13:35:04 +02:00
|
|
|
TimerEventHandler& mrEventHandler;
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
public:
|
2016-07-04 13:35:04 +02:00
|
|
|
BaseEvent(TimerEventHandler& rEventHandler);
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
virtual ~BaseEvent();
|
|
|
|
|
|
|
|
// the called method if the event is triggered
|
|
|
|
virtual void ExecuteEvent() = 0;
|
|
|
|
};
|
|
|
|
} // end of namespace event
|
|
|
|
} // end of namespace sdr
|
|
|
|
|
|
|
|
namespace sdr
|
|
|
|
{
|
|
|
|
namespace event
|
|
|
|
{
|
2016-07-04 13:35:04 +02:00
|
|
|
class TimerEventHandler : public Idle
|
2003-11-24 15:28:14 +00:00
|
|
|
{
|
2016-07-04 13:35:04 +02:00
|
|
|
::std::vector< BaseEvent* > maVector;
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
// to allow BaseEvents to use the add/remove functionality
|
|
|
|
friend class BaseEvent;
|
|
|
|
|
|
|
|
// methods to add/remove events. These are private since
|
|
|
|
// they are used from BaseEvent only.
|
|
|
|
void AddEvent(BaseEvent& rBaseEvent);
|
|
|
|
void RemoveEvent(BaseEvent& rBaseEvent);
|
|
|
|
|
|
|
|
// access to a event, 0L when no more events
|
|
|
|
BaseEvent* GetEvent();
|
|
|
|
|
|
|
|
public:
|
2016-07-04 13:35:04 +02:00
|
|
|
TimerEventHandler();
|
|
|
|
~TimerEventHandler() override;
|
2003-11-24 15:28:14 +00:00
|
|
|
|
2013-03-25 10:51:15 +09:00
|
|
|
bool IsEmpty() const;
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
// The timer when it is triggered; from class Timer
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Invoke() override;
|
2003-11-24 15:28:14 +00:00
|
|
|
|
|
|
|
// reset the timer
|
|
|
|
void Restart();
|
|
|
|
};
|
|
|
|
} // end of namespace event
|
|
|
|
} // end of namespace sdr
|
|
|
|
|
2014-03-31 16:19:33 +03:00
|
|
|
#endif // INCLUDED_SVX_SOURCE_INC_EVENTHANDLER_HXX
|
2003-11-24 15:28:14 +00:00
|
|
|
|
2010-10-27 13:11:31 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|