1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SDEXT_PRESENTER_CURRENT_SLIDE_OBSERVER
25 #define SDEXT_PRESENTER_CURRENT_SLIDE_OBSERVER
26 
27 #include "PresenterController.hxx"
28 #include <com/sun/star/presentation/XSlideShow.hpp>
29 #include <com/sun/star/presentation/XSlideShowController.hpp>
30 #include <com/sun/star/frame/XController.hpp>
31 #include <cppuhelper/compbase1.hxx>
32 #include <cppuhelper/basemutex.hxx>
33 #include <rtl/ref.hxx>
34 #include <vos/timer.hxx>
35 
36 namespace css = ::com::sun::star;
37 
38 namespace sdext { namespace presenter {
39 
40 namespace {
41     typedef ::cppu::WeakComponentImplHelper1 <
42         css::presentation::XSlideShowListener
43     > PresenterCurrentSlideObserverInterfaceBase;
44 }
45 
46 /** Check periodically the slide show controller and the
47     frame::XController whether the current slide has changed.  If so,
48     then inform the presenter controller about it.
49 
50     Objects of this class have their own lifetime control and destroy
51     themselves when the presenter controller is diposed.
52 */
53 class PresenterCurrentSlideObserver
54     : protected ::cppu::BaseMutex,
55       public PresenterCurrentSlideObserverInterfaceBase
56 {
57 public:
58     PresenterCurrentSlideObserver (
59         const ::rtl::Reference<PresenterController>& rxPresenterController,
60         const css::uno::Reference<css::presentation::XSlideShowController>& rxSlideShowController);
61     virtual ~PresenterCurrentSlideObserver (void);
62 
63     virtual void SAL_CALL disposing (void);
64 
65     // XSlideShowListener
66     virtual void SAL_CALL paused(  ) throw (::com::sun::star::uno::RuntimeException);
67     virtual void SAL_CALL resumed(  ) throw (::com::sun::star::uno::RuntimeException);
68     virtual void SAL_CALL slideTransitionStarted(  ) throw (::com::sun::star::uno::RuntimeException);
69     virtual void SAL_CALL slideTransitionEnded(  ) throw (::com::sun::star::uno::RuntimeException);
70     virtual void SAL_CALL slideAnimationsEnded(  ) throw (::com::sun::star::uno::RuntimeException);
71     virtual void SAL_CALL slideEnded(sal_Bool bReverse) throw (::com::sun::star::uno::RuntimeException);
72     virtual void SAL_CALL hyperLinkClicked( const ::rtl::OUString& hyperLink ) throw (::com::sun::star::uno::RuntimeException);
73 
74 	// XAnimationListener
75     virtual void SAL_CALL beginEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& Node ) throw (::com::sun::star::uno::RuntimeException);
76     virtual void SAL_CALL endEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& Node ) throw (::com::sun::star::uno::RuntimeException);
77     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);
78 
79     // XEventListener
80     virtual void SAL_CALL disposing (
81         const com::sun::star::lang::EventObject& rEvent)
82         throw (com::sun::star::uno::RuntimeException);
83 
84 private:
85     ::rtl::Reference<PresenterController> mpPresenterController;
86     css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
87 };
88 
89 } } // end of namespace ::sdext::presenter
90 
91 #endif
92