summaryrefslogtreecommitdiff
path: root/slideshow/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'slideshow/source/inc')
-rw-r--r--slideshow/source/inc/debug.hxx80
-rw-r--r--slideshow/source/inc/delayevent.hxx61
-rw-r--r--slideshow/source/inc/event.hxx14
-rw-r--r--slideshow/source/inc/eventqueue.hxx8
-rw-r--r--slideshow/source/inc/interruptabledelayevent.hxx5
-rw-r--r--slideshow/source/inc/screenupdater.hxx21
-rw-r--r--slideshow/source/inc/unoview.hxx10
-rw-r--r--slideshow/source/inc/usereventqueue.hxx16
8 files changed, 189 insertions, 26 deletions
diff --git a/slideshow/source/inc/debug.hxx b/slideshow/source/inc/debug.hxx
new file mode 100644
index 000000000000..53c031231370
--- /dev/null
+++ b/slideshow/source/inc/debug.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: layer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_DEBUG_HXX
+#define INCLUDED_SLIDESHOW_DEBUG_HXX
+
+#include <osl/diagnose.h>
+
+#if OSL_DEBUG_LEVEL > 1
+
+#include "animationnode.hxx"
+
+
+namespace slideshow { namespace internal {
+
+void Debug_ShowNodeTree (const AnimationNodeSharedPtr& rpNode);
+
+// Change this to a valid filename. The file is created anew with every
+// office start (and execution of at least one TRACE... command.)
+#define TRACE_LOG_FILE_NAME "d:\\tmp\\log.txt"
+
+class DebugTraceScope
+{
+public:
+ DebugTraceScope (const sal_Char* sFormat, ...);
+ ~DebugTraceScope (void);
+private:
+ static const sal_Int32 mnBufferSize = 512;
+ sal_Char* msMessage;
+};
+
+void SAL_CALL DebugTraceBegin (const sal_Char* sFormat, ...);
+void SAL_CALL DebugTraceEnd (const sal_Char* sFormat, ...);
+void SAL_CALL DebugTraceMessage (const sal_Char* sFormat, ...);
+
+} } // end of namespace ::slideshow::internal
+
+
+#define TRACE_BEGIN DebugTraceBegin
+#define TRACE_END DebugTraceEnd
+#define TRACE DebugTraceMessage
+#define TRACE_SCOPE DebugTraceScope aTraceScope
+
+#else // OSL_DEBUG_LEVEL > 1
+
+#define TRACE_BEGIN 1 ? ((void)0) : DebugTraceBegin
+#define TRACE_END 1 ? ((void)0) : DebugTraceEnd
+#define TRACE 1 ? ((void)0) : DebugTraceMessage
+#define TRACE_SCOPE
+
+#endif // OSL_DEBUG_LEVEL > 1
+
+#endif
diff --git a/slideshow/source/inc/delayevent.hxx b/slideshow/source/inc/delayevent.hxx
index 29ef713f6550..1c4e09faa7da 100644
--- a/slideshow/source/inc/delayevent.hxx
+++ b/slideshow/source/inc/delayevent.hxx
@@ -30,12 +30,11 @@
#ifndef INCLUDED_SLIDESHOW_DELAYEVENT_HXX
#define INCLUDED_SLIDESHOW_DELAYEVENT_HXX
+#include <boost/function.hpp>
+
#include "event.hxx"
+#include "debug.hxx"
#include <boost/noncopyable.hpp>
-#include <boost/function.hpp>
-#if defined(VERBOSE) && defined(DBG_UTIL)
-#include "boost/current_function.hpp"
-#endif
namespace slideshow {
namespace internal {
@@ -48,16 +47,23 @@ public:
typedef ::boost::function0<void> FunctorT;
template <typename FuncT>
- Delay( FuncT const& func, double nTimeout )
- : mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {}
+ Delay( FuncT const& func,
+ double nTimeout
+#if OSL_DEBUG_LEVEL > 1
+ , const ::rtl::OUString& rsDescription
+ ) : Event(rsDescription),
+#else
+ ) :
+#endif
+ mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {}
-#if defined(VERBOSE) && defined(DBG_UTIL)
Delay( const boost::function0<void>& func,
- double nTimeout,
- char const* const ) :
+ double nTimeout
+#if OSL_DEBUG_LEVEL > 1
+ , const ::rtl::OUString& rsDescription
+ ) : Event(rsDescription),
#else
- Delay( const boost::function0<void>& func,
- double nTimeout ) :
+ ) :
#endif
mnTimeout(nTimeout),
maFunc(func),
@@ -76,7 +82,7 @@ private:
bool mbWasFired;
};
-#if OSL_DEBUG_LEVEL < 1
+#if OSL_DEBUG_LEVEL <= 1
/** Generate delay event
@@ -89,7 +95,7 @@ private:
@return generated delay event
*/
template <typename FuncT>
-inline EventSharedPtr makeDelay( FuncT const& func, double nTimeout )
+inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout )
{
return EventSharedPtr( new Delay( func, nTimeout ) );
}
@@ -102,19 +108,25 @@ inline EventSharedPtr makeDelay( FuncT const& func, double nTimeout )
@return generated immediate event.
*/
template <typename FuncT>
-inline EventSharedPtr makeEvent( FuncT const& func )
+inline EventSharedPtr makeEvent_( FuncT const& func )
{
return EventSharedPtr( new Delay( func, 0.0 ) );
}
+
+// Strip away description.
+#define makeDelay(f, t, d) makeDelay_(f, t)
+#define makeEvent(f, d) makeEvent_(f)
+
#else // OSL_DEBUG_LEVEL > 1
class Delay_ : public Delay {
public:
template <typename FuncT>
Delay_( FuncT const& func, double nTimeout,
- char const* from_function, char const* from_file, int from_line )
- : Delay(func, nTimeout),
+ char const* from_function, char const* from_file, int from_line,
+ const ::rtl::OUString& rsDescription)
+ : Delay(func, nTimeout, rsDescription),
FROM_FUNCTION(from_function),
FROM_FILE(from_file), FROM_LINE(from_line) {}
@@ -126,18 +138,21 @@ public:
template <typename FuncT>
inline EventSharedPtr makeDelay_(
FuncT const& func, double nTimeout,
- char const* from_function, char const* from_file, int from_line )
+ char const* from_function, char const* from_file, int from_line,
+ const ::rtl::OUString& rsDescription)
{
return EventSharedPtr( new Delay_( func, nTimeout,
- from_function, from_file, from_line ) );
+ from_function, from_file, from_line, rsDescription) );
}
-#define makeDelay(f, t) makeDelay_(f, t, \
-BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)
-#define makeEvent(f) makeDelay_(f, 0.0, \
-BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)
+#define makeDelay(f, t, d) makeDelay_(f, t, \
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d)))
+#define makeEvent(f, d) makeDelay_(f, 0.0, \
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d)))
-#endif // OSL_DEBUG_LEVEL < 1
+#endif // OSL_DEBUG_LEVEL <= 1
} // namespace internal
} // namespace presentation
diff --git a/slideshow/source/inc/event.hxx b/slideshow/source/inc/event.hxx
index 80e825cc8049..6e41e5c30123 100644
--- a/slideshow/source/inc/event.hxx
+++ b/slideshow/source/inc/event.hxx
@@ -31,7 +31,8 @@
#define INCLUDED_SLIDESHOW_EVENT_HXX
#include "disposable.hxx"
-
+#include "debug.hxx"
+#include <rtl/ustring.hxx>
#include <boost/shared_ptr.hpp>
#include <vector>
@@ -43,6 +44,10 @@ namespace internal {
class Event : public Disposable
{
public:
+#if OSL_DEBUG_LEVEL > 1
+ Event (const ::rtl::OUString& rsDescription) : msDescription(rsDescription) {};
+#endif
+
/** Execute the event.
@return true, if event was successfully executed.
@@ -72,6 +77,13 @@ public:
event is to be fired.
*/
virtual double getActivationTime( double nCurrentTime ) const = 0;
+
+#if OSL_DEBUG_LEVEL > 1
+ ::rtl::OUString GetDescription (void) const { return msDescription; }
+
+private:
+ const ::rtl::OUString msDescription;
+#endif
};
typedef ::boost::shared_ptr< Event > EventSharedPtr;
diff --git a/slideshow/source/inc/eventqueue.hxx b/slideshow/source/inc/eventqueue.hxx
index 5963552d9c60..35adcf69c068 100644
--- a/slideshow/source/inc/eventqueue.hxx
+++ b/slideshow/source/inc/eventqueue.hxx
@@ -72,6 +72,13 @@ namespace slideshow
*/
bool addEventForNextRound( const EventSharedPtr& event );
+ /** Another way to control the order of asynchronous event
+ exeqution. Use this method to schedule events that are to
+ be executed after all regular events that have no delay,
+ even when they schedule new regular events without delay.
+ */
+ bool addEventWhenQueueIsEmpty (const EventSharedPtr& rpEvent);
+
/** Process the event queue.
This method executes all events whose timeout has
@@ -138,6 +145,7 @@ namespace slideshow
ImplQueueType maEvents;
typedef ::std::vector<EventEntry> EventEntryVector;
EventEntryVector maNextEvents;
+ ImplQueueType maNextNextEvents;
void process_( bool bFireAllEvents );
// perform timing of events via relative time
diff --git a/slideshow/source/inc/interruptabledelayevent.hxx b/slideshow/source/inc/interruptabledelayevent.hxx
index 96795dfa51d4..485c96bc8c2c 100644
--- a/slideshow/source/inc/interruptabledelayevent.hxx
+++ b/slideshow/source/inc/interruptabledelayevent.hxx
@@ -49,6 +49,9 @@ namespace slideshow
public:
DelayFacade( const EventSharedPtr& rEvent,
double nTimeout ) :
+#if OSL_DEBUG_LEVEL > 1
+ Event(::rtl::OUString::createFromAscii("DelayFacade")),
+#endif
mpEvent( rEvent ),
mnTimeout( nTimeout )
{
@@ -138,7 +141,7 @@ namespace slideshow
{
InterruptableEventPair aRes;
- aRes.mpImmediateEvent = makeEvent( rFunctor );
+ aRes.mpImmediateEvent = makeEvent( rFunctor, "makeInterruptableDelay");
aRes.mpTimeoutEvent.reset( new DelayFacade( aRes.mpImmediateEvent,
nTimeout ) );
diff --git a/slideshow/source/inc/screenupdater.hxx b/slideshow/source/inc/screenupdater.hxx
index 07837d6bfc4c..33d6c5d7263f 100644
--- a/slideshow/source/inc/screenupdater.hxx
+++ b/slideshow/source/inc/screenupdater.hxx
@@ -111,9 +111,30 @@ namespace slideshow
*/
void requestImmediateUpdate();
+ class UpdateLock {public: virtual void Activate (void) = 0; };
+
+ /** Call this method to create a lock instead of calling
+ lockUpdates() and unlockUpdates() directly.
+ @param bStartLocked
+ When <TRUE/> then the UpdateLock is created already
+ locked. When <FALSE/> then Activate() has to be called in order
+ to lock the lock.
+ */
+ ::boost::shared_ptr<UpdateLock> createLock (const bool bStartLocked);
+
+ /** Lock updates to prevent intermediate repaints.
+ */
+ void lockUpdates (void);
+
+ /** When called as often as lockUpdates() then commitUpdates()
+ is called.
+ */
+ void unlockUpdates (void);
+
private:
struct ImplScreenUpdater;
boost::scoped_ptr<ImplScreenUpdater> mpImpl;
+
};
}
}
diff --git a/slideshow/source/inc/unoview.hxx b/slideshow/source/inc/unoview.hxx
index 471cdae98a70..6dfc99da5a65 100644
--- a/slideshow/source/inc/unoview.hxx
+++ b/slideshow/source/inc/unoview.hxx
@@ -68,6 +68,16 @@ namespace slideshow
with a different calling convention under Windows).
*/
virtual void _dispose() = 0;
+
+ /** Return whether the sound play back is enabled.
+ */
+ virtual bool isSoundEnabled (void) const = 0;
+
+ /** Tell the view whether it may play sounds. Disabling this
+ can be used to prevent different views to play the same
+ sounds at the same time.
+ */
+ virtual void setIsSoundEnabled (const bool bValue) = 0;
};
typedef ::boost::shared_ptr< UnoView > UnoViewSharedPtr;
diff --git a/slideshow/source/inc/usereventqueue.hxx b/slideshow/source/inc/usereventqueue.hxx
index d0ab3b8c1ce5..26be68e1ffa0 100644
--- a/slideshow/source/inc/usereventqueue.hxx
+++ b/slideshow/source/inc/usereventqueue.hxx
@@ -188,8 +188,16 @@ public:
Then, all registered events are fired and removed from this
queue. After firing, a next effect event is issued to this
queue to start the next effect.
+ @param pEvent
+ The event to execute when skipping the current effect.
+ @param bSkipTriggersNextEffect
+ When <TRUE/> then after skipping the current effect the next
+ effect is triggered. When <FALSE/> then the next effect is not
+ triggered.
*/
- void registerSkipEffectEvent( EventSharedPtr const& pEvent );
+ void registerSkipEffectEvent(
+ EventSharedPtr const& pEvent,
+ const bool bSkipTriggersNextEffect);
/** Registes an event that is fired when the current effects(s)
are rewound, .e.g. when the right mouse button is pressed.
@@ -263,6 +271,12 @@ public:
void registerMouseLeaveEvent( const EventSharedPtr& rEvent,
const ShapeSharedPtr& rShape );
+ /** Typically skipping the current effect is triggered by mouse clicks
+ or key presses that trigger the next effect. This method allows the
+ skipping of effects to be triggered programatically.
+ */
+ void callSkipEffectEventHandler (void);
+
private:
/** Generically register an event on one of the handlers.