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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sdext.hxx"
26
27 #include "PresenterCurrentSlideObserver.hxx"
28
29 using namespace ::com::sun::star;
30 using namespace ::com::sun::star::uno;
31 using ::rtl::OUString;
32
33 namespace sdext { namespace presenter {
34
35 //===== PresenterCurrentSlideObserver =========================================
36
PresenterCurrentSlideObserver(const::rtl::Reference<PresenterController> & rxPresenterController,const Reference<presentation::XSlideShowController> & rxSlideShowController)37 PresenterCurrentSlideObserver::PresenterCurrentSlideObserver (
38 const ::rtl::Reference<PresenterController>& rxPresenterController,
39 const Reference<presentation::XSlideShowController>& rxSlideShowController)
40 : PresenterCurrentSlideObserverInterfaceBase(m_aMutex),
41 mpPresenterController(rxPresenterController),
42 mxSlideShowController(rxSlideShowController)
43 {
44 if( mpPresenterController.is() )
45 {
46 mpPresenterController->addEventListener(this);
47 }
48
49 if( mxSlideShowController.is() )
50 {
51 // Listen for events from the slide show controller.
52 mxSlideShowController->addSlideShowListener(static_cast<XSlideShowListener*>(this));
53 }
54 }
55
~PresenterCurrentSlideObserver(void)56 PresenterCurrentSlideObserver::~PresenterCurrentSlideObserver (void)
57 {
58 }
59
disposing(void)60 void SAL_CALL PresenterCurrentSlideObserver::disposing (void)
61 {
62 // Disconnect form the slide show controller.
63 if(mxSlideShowController.is())
64 {
65 mxSlideShowController->removeSlideShowListener(static_cast<XSlideShowListener*>(this));
66 mxSlideShowController = NULL;
67 }
68 }
69
70 //----- XSlideShowListener ----------------------------------------------------
71
beginEvent(const Reference<animations::XAnimationNode> & rNode)72 void SAL_CALL PresenterCurrentSlideObserver::beginEvent (
73 const Reference<animations::XAnimationNode>& rNode)
74 throw (css::uno::RuntimeException)
75 {
76 (void)rNode;
77 }
78
endEvent(const Reference<animations::XAnimationNode> & rNode)79 void SAL_CALL PresenterCurrentSlideObserver::endEvent (
80 const Reference<animations::XAnimationNode>& rNode)
81 throw(css::uno::RuntimeException)
82 {
83 (void)rNode;
84 }
85
repeat(const css::uno::Reference<css::animations::XAnimationNode> & rNode,sal_Int32)86 void SAL_CALL PresenterCurrentSlideObserver::repeat (
87 const css::uno::Reference<css::animations::XAnimationNode>& rNode,
88 sal_Int32)
89 throw (com::sun::star::uno::RuntimeException)
90 {
91 (void)rNode;
92 }
93
paused(void)94 void SAL_CALL PresenterCurrentSlideObserver::paused (void)
95 throw (com::sun::star::uno::RuntimeException)
96 {
97 }
98
resumed(void)99 void SAL_CALL PresenterCurrentSlideObserver::resumed (void)
100 throw (css::uno::RuntimeException)
101 {
102 }
103
slideEnded(sal_Bool bReverse)104 void SAL_CALL PresenterCurrentSlideObserver::slideEnded (sal_Bool bReverse)
105 throw (css::uno::RuntimeException)
106 {
107 // Determine whether the new current slide (the one after the one that
108 // just ended) is the slide past the last slide in the presentation,
109 // i.e. the one that says something like "click to end presentation...".
110 if (mxSlideShowController.is() && !bReverse)
111 if (mxSlideShowController->getNextSlideIndex() < 0)
112 if( mpPresenterController.is() )
113 mpPresenterController->UpdateCurrentSlide(+1);
114 }
115
hyperLinkClicked(const rtl::OUString &)116 void SAL_CALL PresenterCurrentSlideObserver::hyperLinkClicked (const rtl::OUString &)
117 throw (css::uno::RuntimeException)
118 {
119 }
120
slideTransitionStarted(void)121 void SAL_CALL PresenterCurrentSlideObserver::slideTransitionStarted (void)
122 throw (css::uno::RuntimeException)
123 {
124 if( mpPresenterController.is() )
125 mpPresenterController->UpdateCurrentSlide(0);
126 }
127
slideTransitionEnded(void)128 void SAL_CALL PresenterCurrentSlideObserver::slideTransitionEnded (void)
129 throw (css::uno::RuntimeException)
130 {
131 }
132
slideAnimationsEnded(void)133 void SAL_CALL PresenterCurrentSlideObserver::slideAnimationsEnded (void)
134 throw (css::uno::RuntimeException)
135 {
136 }
137
138 //----- XEventListener --------------------------------------------------------
139
disposing(const lang::EventObject & rEvent)140 void SAL_CALL PresenterCurrentSlideObserver::disposing (
141 const lang::EventObject& rEvent)
142 throw (RuntimeException)
143 {
144 if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpPresenterController.get())))
145 dispose();
146 else if (rEvent.Source == mxSlideShowController)
147 mxSlideShowController = NULL;
148 }
149
150 } } // end of namespace ::sdext::presenter
151