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

the TimeEventHandler stuff is dead

ever since
    commit c760d61b
    Date:   Fri Jul 27 15:28:44 2018 +0200
    remove SdrGrafObj::IsSwappedOut

Change-Id: I68c98449b98a3ac5da3bf26917ad2a76226f470c
Reviewed-on: https://gerrit.libreoffice.org/58707
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c83a8071
......@@ -30,10 +30,6 @@ namespace tools { class Rectangle; }
class SdrPageView;
class OutputDevice;
namespace sdr { namespace event {
class TimerEventHandler;
}}
namespace basegfx {
class B2DRange;
class B2DHomMatrix;
......@@ -67,9 +63,6 @@ private:
// support animatedSwitchPrimitives
sdr::animation::primitiveAnimator maPrimitiveAnimator;
// the EventHandler for e.g. asynchronious loading of graphics
std::unique_ptr<sdr::event::TimerEventHandler> mpEventHandler;
// The redirector. If set it is used to pipe all supported calls
// to the redirector
ViewObjectContactRedirector* mpViewObjectContactRedirector;
......@@ -129,13 +122,6 @@ public:
// method to get the primitiveAnimator
sdr::animation::primitiveAnimator& getPrimitiveAnimator() { return maPrimitiveAnimator; }
// method to get the EventHandler. It will
// return a existing one or create a new one using CreateEventHandler().
sdr::event::TimerEventHandler& GetEventHandler() const;
// test if there is an EventHandler without creating one on demand
bool HasEventHandler() const;
// check if text animation is allowed. Default is sal_true.
virtual bool IsTextAnimationAllowed() const;
......
......@@ -26,68 +26,6 @@
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
namespace sdr
{
namespace event
{
class BaseEvent;
class TimerEventHandler;
} // end of namespace event
} // end of namespace sdr
namespace sdr
{
namespace event
{
class BaseEvent
{
// the EventHandler this event is registered at
TimerEventHandler& mrEventHandler;
public:
BaseEvent(TimerEventHandler& rEventHandler);
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
{
class TimerEventHandler : public Idle
{
::std::vector< BaseEvent* > maVector;
// 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:
TimerEventHandler();
~TimerEventHandler() override;
bool IsEmpty() const;
// The timer when it is triggered; from class Timer
virtual void Invoke() override;
// reset the timer
void Restart();
};
} // end of namespace event
} // end of namespace sdr
#endif // INCLUDED_SVX_SOURCE_INC_EVENTHANDLER_HXX
......
......@@ -34,7 +34,6 @@ namespace sdr { namespace contact {
ObjectContact::ObjectContact()
: maViewObjectContactVector(),
maPrimitiveAnimator(),
mpEventHandler(nullptr),
mpViewObjectContactRedirector(nullptr),
maViewInformation2D(uno::Sequence< beans::PropertyValue >()),
mbIsPreviewRenderer(false)
......@@ -64,10 +63,6 @@ ObjectContact::~ObjectContact() COVERITY_NOEXCEPT_FALSE
// assert when there were new entries added during deletion
DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)");
// delete the EventHandler. This will destroy all still contained events.
mpEventHandler.reset();
// If there are still Events registered, something has went wrong
}
// LazyInvalidate request. Default implementation directly handles
......@@ -139,25 +134,6 @@ bool ObjectContact::AreGluePointsVisible() const
return false;
}
// method to get the primitiveAnimator
// method to get the EventHandler. It will
// return a existing one or create a new one using CreateEventHandler().
sdr::event::TimerEventHandler& ObjectContact::GetEventHandler() const
{
if(!HasEventHandler())
{
const_cast< ObjectContact* >(this)->mpEventHandler.reset( new sdr::event::TimerEventHandler() );
}
return *mpEventHandler;
}
// test if there is an EventHandler without creating one on demand
bool ObjectContact::HasEventHandler() const
{
return (nullptr != mpEventHandler);
}
// check if text animation is allowed. Default is sal_true.
bool ObjectContact::IsTextAnimationAllowed() const
{
......
......@@ -126,19 +126,6 @@ namespace sdr
DoProcessDisplay(rDisplayInfo);
}
}
// after paint take care of the evtl. scheduled asynchronious commands.
// Do this by resetting the timer contained there. Thus, after the paint
// that timer will be triggered and the events will be executed.
if(HasEventHandler())
{
sdr::event::TimerEventHandler& rEventHandler = GetEventHandler();
if(!rEventHandler.IsEmpty())
{
rEventHandler.Restart();
}
}
}
// Process the whole displaying. Only use given DisplayInfo, do not access other
......
......@@ -26,99 +26,6 @@ namespace sdr
{
namespace event
{
BaseEvent::BaseEvent(TimerEventHandler& rEventHandler)
: mrEventHandler(rEventHandler)
{
mrEventHandler.AddEvent(*this);
}
BaseEvent::~BaseEvent()
{
mrEventHandler.RemoveEvent(*this);
}
} // end of namespace mixer
} // end of namespace sdr
namespace sdr
{
namespace event
{
void TimerEventHandler::AddEvent(BaseEvent& rBaseEvent)
{
maVector.push_back(&rBaseEvent);
}
void TimerEventHandler::RemoveEvent(BaseEvent& rBaseEvent)
{
if(maVector.back() == &rBaseEvent)
{
// the one to remove is the last, pop
maVector.pop_back();
}
else
{
const auto aFindResult = ::std::find(
maVector.begin(), maVector.end(), &rBaseEvent);
DBG_ASSERT(aFindResult != maVector.end(),
"EventHandler::RemoveEvent: Event to be removed not found (!)");
maVector.erase(aFindResult);
}
}
BaseEvent* TimerEventHandler::GetEvent()
{
if(!maVector.empty())
{
// get the last event, that one is fastest to be removed
return maVector.back();
}
else
{
return nullptr;
}
}
TimerEventHandler::TimerEventHandler()
{
SetPriority(TaskPriority::HIGH_IDLE);
Stop();
}
TimerEventHandler::~TimerEventHandler()
{
Stop();
while(!maVector.empty())
{
delete GetEvent();
}
}
// for control
bool TimerEventHandler::IsEmpty() const
{
return (0 == maVector.size());
}
// The timer when it is triggered; from class Timer
void TimerEventHandler::Invoke()
{
// Trigger and consume the events
for(;;)
{
BaseEvent* pEvent = GetEvent();
if(pEvent == nullptr)
break;
pEvent->ExecuteEvent();
delete pEvent;
}
}
// reset the timer
void TimerEventHandler::Restart()
{
Start();
}
} // end of namespace mixer
} // end of namespace sdr
......
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