1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SDEXT_PRESENTER_CURRENT_SLIDE_OBSERVER
29 #define SDEXT_PRESENTER_CURRENT_SLIDE_OBSERVER
30 
31 #include "PresenterController.hxx"
32 #include <com/sun/star/presentation/XSlideShow.hpp>
33 #include <com/sun/star/presentation/XSlideShowController.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <cppuhelper/compbase1.hxx>
36 #include <cppuhelper/basemutex.hxx>
37 #include <rtl/ref.hxx>
38 #include <vos/timer.hxx>
39 
40 namespace css = ::com::sun::star;
41 
42 namespace sdext { namespace presenter {
43 
44 namespace {
45     typedef ::cppu::WeakComponentImplHelper1 <
46         css::presentation::XSlideShowListener
47     > PresenterCurrentSlideObserverInterfaceBase;
48 }
49 
50 /** Check periodically the slide show controller and the
51     frame::XController whether the current slide has changed.  If so,
52     then inform the presenter controller about it.
53 
54     Objects of this class have their own lifetime control and destroy
55     themselves when the presenter controller is diposed.
56 */
57 class PresenterCurrentSlideObserver
58     : protected ::cppu::BaseMutex,
59       public PresenterCurrentSlideObserverInterfaceBase
60 {
61 public:
62     PresenterCurrentSlideObserver (
63         const ::rtl::Reference<PresenterController>& rxPresenterController,
64         const css::uno::Reference<css::presentation::XSlideShowController>& rxSlideShowController);
65     virtual ~PresenterCurrentSlideObserver (void);
66 
67     virtual void SAL_CALL disposing (void);
68 
69     // XSlideShowListener
70     virtual void SAL_CALL paused(  ) throw (::com::sun::star::uno::RuntimeException);
71     virtual void SAL_CALL resumed(  ) throw (::com::sun::star::uno::RuntimeException);
72     virtual void SAL_CALL slideTransitionStarted(  ) throw (::com::sun::star::uno::RuntimeException);
73     virtual void SAL_CALL slideTransitionEnded(  ) throw (::com::sun::star::uno::RuntimeException);
74     virtual void SAL_CALL slideAnimationsEnded(  ) throw (::com::sun::star::uno::RuntimeException);
75     virtual void SAL_CALL slideEnded(sal_Bool bReverse) throw (::com::sun::star::uno::RuntimeException);
76     virtual void SAL_CALL hyperLinkClicked( const ::rtl::OUString& hyperLink ) throw (::com::sun::star::uno::RuntimeException);
77 
78 	// XAnimationListener
79     virtual void SAL_CALL beginEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& Node ) throw (::com::sun::star::uno::RuntimeException);
80     virtual void SAL_CALL endEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& Node ) throw (::com::sun::star::uno::RuntimeException);
81     virtual void SAL_CALL repeat( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& Node, ::sal_Int32 Repeat ) throw (::com::sun::star::uno::RuntimeException);
82 
83     // XEventListener
84     virtual void SAL_CALL disposing (
85         const com::sun::star::lang::EventObject& rEvent)
86         throw (com::sun::star::uno::RuntimeException);
87 
88 private:
89     ::rtl::Reference<PresenterController> mpPresenterController;
90     css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
91 };
92 
93 } } // end of namespace ::sdext::presenter
94 
95 #endif
96