2010-10-12 15:51:52 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-11 09:51:50 +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 .
|
|
|
|
*/
|
2004-03-18 09:44:39 +00:00
|
|
|
|
2006-09-17 07:25:30 +00:00
|
|
|
|
2008-06-24 11:02:19 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2006-12-13 14:15:23 +00:00
|
|
|
|
2005-03-30 06:54:16 +00:00
|
|
|
#include <comphelper/anytostring.hxx>
|
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
|
|
|
|
|
|
|
#include <event.hxx>
|
|
|
|
#include <eventqueue.hxx>
|
|
|
|
#include <slideshowexceptions.hxx>
|
2004-03-18 09:44:39 +00:00
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
#include <limits>
|
2015-09-14 09:21:33 +01:00
|
|
|
#include <memory>
|
2004-11-26 17:53:02 +00:00
|
|
|
|
2004-03-18 09:44:39 +00:00
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
using namespace ::com::sun::star;
|
2004-03-18 09:44:39 +00:00
|
|
|
|
2006-12-13 14:15:23 +00:00
|
|
|
namespace slideshow
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
bool EventQueue::EventEntry::operator<( const EventEntry& rEvent ) const
|
|
|
|
{
|
|
|
|
// negate comparison, we want priority queue to be sorted
|
|
|
|
// in increasing order of activation times
|
|
|
|
return this->nTime > rEvent.nTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-10 12:41:56 +00:00
|
|
|
EventQueue::EventQueue(
|
2015-09-14 09:21:33 +01:00
|
|
|
std::shared_ptr<canvas::tools::ElapsedTime> const & pPresTimer )
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
: maMutex(),
|
|
|
|
maEvents(),
|
2006-07-26 06:25:33 +00:00
|
|
|
maNextEvents(),
|
2009-03-04 13:41:44 +00:00
|
|
|
maNextNextEvents(),
|
2005-03-10 12:41:56 +00:00
|
|
|
mpTimer( pPresTimer )
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
EventQueue::~EventQueue()
|
|
|
|
{
|
2006-07-26 06:25:33 +00:00
|
|
|
// add in all that have been added explicitly for this round:
|
|
|
|
EventEntryVector::const_iterator const iEnd( maNextEvents.end() );
|
|
|
|
for ( EventEntryVector::const_iterator iPos( maNextEvents.begin() );
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
iPos != iEnd; ++iPos )
|
|
|
|
{
|
2006-07-26 06:25:33 +00:00
|
|
|
maEvents.push(*iPos);
|
|
|
|
}
|
|
|
|
EventEntryVector().swap( maNextEvents );
|
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
// dispose event queue
|
|
|
|
while( !maEvents.empty() )
|
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
try
|
|
|
|
{
|
2005-03-30 06:54:16 +00:00
|
|
|
maEvents.top().pEvent->dispose();
|
|
|
|
}
|
2017-03-09 20:57:31 +00:00
|
|
|
catch (const uno::Exception&)
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
{
|
2017-03-09 20:57:31 +00:00
|
|
|
SAL_WARN( "slideshow", "" << comphelper::anyToString(cppu::getCaughtException() ) );
|
2005-03-30 06:54:16 +00:00
|
|
|
}
|
2004-11-26 17:53:02 +00:00
|
|
|
maEvents.pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-18 09:44:39 +00:00
|
|
|
bool EventQueue::addEvent( const EventSharedPtr& rEvent )
|
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2012-09-11 09:16:16 +02:00
|
|
|
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
|
|
|
|
<< "\" [" << rEvent.get()
|
|
|
|
<< "] at " << mpTimer->getElapsedTime()
|
|
|
|
<< " with delay " << rEvent->getActivationTime(0.0)
|
|
|
|
);
|
2010-01-29 08:49:42 +01:00
|
|
|
ENSURE_OR_RETURN_FALSE( rEvent,
|
2005-04-22 12:28:48 +00:00
|
|
|
"EventQueue::addEvent: event ptr NULL" );
|
2004-03-18 09:44:39 +00:00
|
|
|
|
|
|
|
// prepare entry
|
2004-11-26 17:53:02 +00:00
|
|
|
|
|
|
|
// A seemingly obvious optimization cannot be used here,
|
|
|
|
// because it breaks assumed order of notification: zero
|
|
|
|
// timeout events could be fired() immediately, but that
|
|
|
|
// would not unwind the stack and furthermore changes
|
|
|
|
// order of notification
|
2004-03-18 09:44:39 +00:00
|
|
|
|
|
|
|
// add entry
|
2006-07-26 06:25:33 +00:00
|
|
|
maEvents.push( EventEntry( rEvent, rEvent->getActivationTime(
|
|
|
|
mpTimer->getElapsedTime()) ) );
|
|
|
|
return true;
|
|
|
|
}
|
2004-03-18 09:44:39 +00:00
|
|
|
|
2006-07-26 06:25:33 +00:00
|
|
|
bool EventQueue::addEventForNextRound( EventSharedPtr const& rEvent )
|
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2012-09-11 09:16:16 +02:00
|
|
|
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
|
|
|
|
<< "\" [" << rEvent.get()
|
|
|
|
<< "] for the next round at " << mpTimer->getElapsedTime()
|
|
|
|
<< " with delay " << rEvent->getActivationTime(0.0)
|
|
|
|
);
|
2009-04-27 11:42:05 +00:00
|
|
|
|
2015-11-10 10:23:52 +01:00
|
|
|
ENSURE_OR_RETURN_FALSE( rEvent.get() != nullptr,
|
2006-07-26 06:25:33 +00:00
|
|
|
"EventQueue::addEvent: event ptr NULL" );
|
|
|
|
maNextEvents.push_back(
|
|
|
|
EventEntry( rEvent, rEvent->getActivationTime(
|
|
|
|
mpTimer->getElapsedTime()) ) );
|
2004-03-18 09:44:39 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-03-04 13:41:44 +00:00
|
|
|
bool EventQueue::addEventWhenQueueIsEmpty (const EventSharedPtr& rpEvent)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2012-09-11 09:16:16 +02:00
|
|
|
SAL_INFO("slideshow.eventqueue", "adding event \"" << rpEvent->GetDescription()
|
|
|
|
<< "\" [" << rpEvent.get()
|
|
|
|
<< "] for execution when the queue is empty at " << mpTimer->getElapsedTime()
|
|
|
|
<< " with delay " << rpEvent->getActivationTime(0.0)
|
|
|
|
);
|
2009-04-27 11:42:05 +00:00
|
|
|
|
2010-01-29 08:49:42 +01:00
|
|
|
ENSURE_OR_RETURN_FALSE(
|
2015-11-10 10:23:52 +01:00
|
|
|
rpEvent.get() != nullptr,
|
2009-03-04 13:41:44 +00:00
|
|
|
"EventQueue::addEvent: event ptr NULL");
|
|
|
|
|
|
|
|
maNextNextEvents.push(
|
|
|
|
EventEntry(
|
|
|
|
rpEvent,
|
|
|
|
rpEvent->getActivationTime(mpTimer->getElapsedTime())));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-07-26 06:25:33 +00:00
|
|
|
void EventQueue::forceEmpty()
|
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2006-07-26 06:25:33 +00:00
|
|
|
process_(true);
|
|
|
|
}
|
|
|
|
|
2006-02-09 13:48:22 +00:00
|
|
|
void EventQueue::process()
|
2006-07-26 06:25:33 +00:00
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2006-07-26 06:25:33 +00:00
|
|
|
process_(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventQueue::process_( bool bFireAllEvents )
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
2015-08-10 14:01:33 -05:00
|
|
|
SAL_INFO("slideshow.verbose", "EventQueue: heartbeat" );
|
2004-03-18 09:44:39 +00:00
|
|
|
|
2006-07-26 06:25:33 +00:00
|
|
|
// add in all that have been added explicitly for this round:
|
|
|
|
EventEntryVector::const_iterator const iEnd( maNextEvents.end() );
|
|
|
|
for ( EventEntryVector::const_iterator iPos( maNextEvents.begin() );
|
|
|
|
iPos != iEnd; ++iPos ) {
|
|
|
|
maEvents.push(*iPos);
|
|
|
|
}
|
|
|
|
EventEntryVector().swap( maNextEvents );
|
|
|
|
|
2004-03-18 09:44:39 +00:00
|
|
|
// perform topmost, ready-to-execute event
|
|
|
|
// =======================================
|
|
|
|
|
2005-03-10 12:41:56 +00:00
|
|
|
const double nCurrTime( mpTimer->getElapsedTime() );
|
2004-11-26 17:53:02 +00:00
|
|
|
|
2009-03-04 13:41:44 +00:00
|
|
|
// When maEvents does not contain any events that are due now
|
|
|
|
// then process one event from maNextNextEvents.
|
|
|
|
if (!maNextNextEvents.empty()
|
|
|
|
&& !bFireAllEvents
|
|
|
|
&& (maEvents.empty() || maEvents.top().nTime > nCurrTime))
|
|
|
|
{
|
|
|
|
const EventEntry aEvent (maNextNextEvents.top());
|
|
|
|
maNextNextEvents.pop();
|
|
|
|
maEvents.push(aEvent);
|
|
|
|
}
|
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
// process ready/elapsed events. Note that the 'perceived'
|
|
|
|
// current time remains constant for this loop, thus we're
|
|
|
|
// processing only those events which where ready when we
|
|
|
|
// entered this method.
|
|
|
|
while( !maEvents.empty() &&
|
2006-07-26 06:25:33 +00:00
|
|
|
(bFireAllEvents || maEvents.top().nTime <= nCurrTime) )
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
|
|
|
EventEntry event( maEvents.top() );
|
|
|
|
maEvents.pop();
|
|
|
|
|
2005-04-22 12:28:48 +00:00
|
|
|
// only process event, if it is still 'charged',
|
|
|
|
// i.e. the fire() call effects something. This is
|
|
|
|
// used when e.g. having events registered at multiple
|
|
|
|
// places, which should fire only once: after the
|
|
|
|
// initial fire() call, those events become inactive
|
|
|
|
// and return false on isCharged. This frees us from
|
|
|
|
// the need to prune queues of those inactive shells.
|
|
|
|
if( event.pEvent->isCharged() )
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
2005-04-22 12:28:48 +00:00
|
|
|
try
|
|
|
|
{
|
2012-09-11 09:16:16 +02:00
|
|
|
SAL_INFO("slideshow.eventqueue", "firing event \""
|
|
|
|
<< event.pEvent->GetDescription()
|
|
|
|
<< "\" [" << event.pEvent.get()
|
|
|
|
<< "] at " << mpTimer->getElapsedTime()
|
|
|
|
<< " with delay " << event.pEvent->getActivationTime(0.0)
|
|
|
|
);
|
2005-04-22 12:28:48 +00:00
|
|
|
event.pEvent->fire();
|
2012-09-11 09:16:16 +02:00
|
|
|
SAL_INFO("slideshow.eventqueue", "event \""
|
|
|
|
<< event.pEvent->GetDescription()
|
|
|
|
<< "\" [" << event.pEvent.get() << "] fired"
|
|
|
|
);
|
2005-04-22 12:28:48 +00:00
|
|
|
}
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
catch( uno::RuntimeException& )
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
}
|
2005-04-22 12:28:48 +00:00
|
|
|
catch( uno::Exception& )
|
|
|
|
{
|
|
|
|
// catch anything here, we don't want
|
|
|
|
// to leave this scope under _any_
|
|
|
|
// circumstance. Although, do _not_
|
|
|
|
// reinsert an activity that threw
|
|
|
|
// once.
|
|
|
|
|
2011-12-01 23:41:42 +02:00
|
|
|
// NOTE: we explicitly don't catch(...) here,
|
2005-04-22 12:28:48 +00:00
|
|
|
// since this will also capture segmentation
|
|
|
|
// violations and the like. In such a case, we
|
|
|
|
// still better let our clients now...
|
2013-04-07 12:06:47 +02:00
|
|
|
OSL_FAIL( OUStringToOString(
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
comphelper::anyToString( cppu::getCaughtException() ),
|
|
|
|
RTL_TEXTENCODING_UTF8 ).getStr() );
|
2005-04-22 12:28:48 +00:00
|
|
|
}
|
|
|
|
catch( SlideShowException& )
|
|
|
|
{
|
|
|
|
// catch anything here, we don't want
|
|
|
|
// to leave this scope under _any_
|
|
|
|
// circumstance. Although, do _not_
|
|
|
|
// reinsert an activity that threw
|
|
|
|
// once.
|
|
|
|
|
2011-12-01 23:41:42 +02:00
|
|
|
// NOTE: we explicitly don't catch(...) here,
|
2005-04-22 12:28:48 +00:00
|
|
|
// since this will also capture segmentation
|
|
|
|
// violations and the like. In such a case, we
|
|
|
|
// still better let our clients now...
|
2016-12-14 09:49:39 +02:00
|
|
|
SAL_WARN("slideshow.eventqueue", "::presentation::internal::EventQueue: Event threw a SlideShowException, action might not have been fully performed" );
|
2005-04-22 12:28:48 +00:00
|
|
|
}
|
2004-11-26 17:53:02 +00:00
|
|
|
}
|
2005-04-22 12:28:48 +00:00
|
|
|
else
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
2015-03-13 10:50:28 +01:00
|
|
|
SAL_INFO(
|
|
|
|
"slideshow.eventqueue",
|
|
|
|
"Ignoring discharged event: unknown ("
|
|
|
|
<< event.pEvent.get() << "), timeout was: "
|
|
|
|
<< event.pEvent->getActivationTime(0.0));
|
2004-11-26 17:53:02 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-18 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
2006-02-09 13:48:22 +00:00
|
|
|
bool EventQueue::isEmpty() const
|
2004-03-18 09:44:39 +00:00
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2009-03-04 13:41:44 +00:00
|
|
|
return maEvents.empty() && maNextEvents.empty() && maNextNextEvents.empty();
|
2004-03-18 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
2006-02-09 13:48:22 +00:00
|
|
|
double EventQueue::nextTimeout() const
|
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2006-02-09 13:48:22 +00:00
|
|
|
// return time for next entry (if any)
|
2009-03-04 13:41:44 +00:00
|
|
|
double nTimeout (::std::numeric_limits<double>::max());
|
|
|
|
const double nCurrentTime (mpTimer->getElapsedTime());
|
|
|
|
if ( ! maEvents.empty())
|
|
|
|
nTimeout = maEvents.top().nTime - nCurrentTime;
|
|
|
|
if ( ! maNextEvents.empty())
|
|
|
|
nTimeout = ::std::min(nTimeout, maNextEvents.front().nTime - nCurrentTime);
|
|
|
|
if ( ! maNextNextEvents.empty())
|
|
|
|
nTimeout = ::std::min(nTimeout, maNextNextEvents.top().nTime - nCurrentTime);
|
|
|
|
|
|
|
|
return nTimeout;
|
2006-02-09 13:48:22 +00:00
|
|
|
}
|
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
void EventQueue::clear()
|
|
|
|
{
|
INTEGRATION: CWS presfixes12 (1.12.12); FILE MERGED
2007/02/25 01:10:23 thb 1.12.12.3: #i37778# Cleared up error handling a lot: no longer quenching RuntimeExceptions; reporting assertions in the debug case; ViewLayer now reports resized sprite (which needs re-render from all shapes); fixed missing subset area reduction for glyph-level animations; added return of resize state from Layer::commitLayerBounds(); adapted unit tests to corrected behaviour
2007/02/06 17:18:03 thb 1.12.12.2: #i37778# Moved clear() method from View to ViewLayer (also sprites need to be cleared); fixed a few more cases of local code style violations; removed redundant inline keywords; finished Layer/LayerManager rework (Layer now represents ViewLayers, shapes and rendering are fully under LayerManager control); made shape comparator reusable
2007/01/29 14:01:53 thb 1.12.12.1: Issue number: #i37778#
Larger slideshow refactoring. Wrote design and coding style manifest,
and adapted the code to actually conform to this. In detail:
- cleaned up ownership/disposable/weak_ptr story. removed hacks and
explicit Disposable implementations, where workaround were available
- removed object mutices, where superfluous
- reworked EventMultiplexer (using templatized listener class now), added
more events. EventMultiplexer now serves as a true blackboard
- reworked directory structure: disjunct parts are now physically separated
into directories, instantiation happens via factories & abstract interfaces
- added CursorManager, to make setting mouse cursor less hackish
- reworked DrawShape, to implement SeparateListener pattern
- reworked IntrinsicAnimationActivity, to avoid cyclic references
- modified hyperlink & shape cursor handling to communicate via
EventMultiplexer
- renamed & cleaned up files (presentation.cxx now named slideshowimpl.cxx,
etc.)
- added first version of the z-order fix to layer/layermanager
- cleaned up include guards and include syntax
2007-07-17 13:36:13 +00:00
|
|
|
::osl::MutexGuard aGuard( maMutex );
|
|
|
|
|
2004-11-26 17:53:02 +00:00
|
|
|
// TODO(P1): Maybe a plain vector and vector.swap will
|
|
|
|
// be faster here. Profile.
|
|
|
|
maEvents = ImplQueueType();
|
2009-10-14 12:38:02 +00:00
|
|
|
|
|
|
|
maNextEvents.clear();
|
|
|
|
maNextNextEvents = ImplQueueType();
|
2004-11-26 17:53:02 +00:00
|
|
|
}
|
2004-03-18 09:44:39 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-12 15:51:52 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|