1*c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*c142477cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*c142477cSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*c142477cSAndrew Rist * distributed with this work for additional information
6*c142477cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*c142477cSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*c142477cSAndrew Rist * "License"); you may not use this file except in compliance
9*c142477cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*c142477cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*c142477cSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*c142477cSAndrew Rist * software distributed under the License is distributed on an
15*c142477cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c142477cSAndrew Rist * KIND, either express or implied. See the License for the
17*c142477cSAndrew Rist * specific language governing permissions and limitations
18*c142477cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*c142477cSAndrew Rist *************************************************************/
21*c142477cSAndrew Rist
22*c142477cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sdext.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "PresenterCurrentSlideObserver.hxx"
28cdf0e10cSrcweir
29cdf0e10cSrcweir using namespace ::com::sun::star;
30cdf0e10cSrcweir using namespace ::com::sun::star::uno;
31cdf0e10cSrcweir using ::rtl::OUString;
32cdf0e10cSrcweir
33cdf0e10cSrcweir namespace sdext { namespace presenter {
34cdf0e10cSrcweir
35cdf0e10cSrcweir //===== PresenterCurrentSlideObserver =========================================
36cdf0e10cSrcweir
PresenterCurrentSlideObserver(const::rtl::Reference<PresenterController> & rxPresenterController,const Reference<presentation::XSlideShowController> & rxSlideShowController)37cdf0e10cSrcweir PresenterCurrentSlideObserver::PresenterCurrentSlideObserver (
38cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rxPresenterController,
39cdf0e10cSrcweir const Reference<presentation::XSlideShowController>& rxSlideShowController)
40cdf0e10cSrcweir : PresenterCurrentSlideObserverInterfaceBase(m_aMutex),
41cdf0e10cSrcweir mpPresenterController(rxPresenterController),
42cdf0e10cSrcweir mxSlideShowController(rxSlideShowController)
43cdf0e10cSrcweir {
44cdf0e10cSrcweir if( mpPresenterController.is() )
45cdf0e10cSrcweir {
46cdf0e10cSrcweir mpPresenterController->addEventListener(this);
47cdf0e10cSrcweir }
48cdf0e10cSrcweir
49cdf0e10cSrcweir if( mxSlideShowController.is() )
50cdf0e10cSrcweir {
51cdf0e10cSrcweir // Listen for events from the slide show controller.
52cdf0e10cSrcweir mxSlideShowController->addSlideShowListener(static_cast<XSlideShowListener*>(this));
53cdf0e10cSrcweir }
54cdf0e10cSrcweir }
55cdf0e10cSrcweir
~PresenterCurrentSlideObserver(void)56cdf0e10cSrcweir PresenterCurrentSlideObserver::~PresenterCurrentSlideObserver (void)
57cdf0e10cSrcweir {
58cdf0e10cSrcweir }
59cdf0e10cSrcweir
disposing(void)60cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::disposing (void)
61cdf0e10cSrcweir {
62cdf0e10cSrcweir // Disconnect form the slide show controller.
63cdf0e10cSrcweir if(mxSlideShowController.is())
64cdf0e10cSrcweir {
65cdf0e10cSrcweir mxSlideShowController->removeSlideShowListener(static_cast<XSlideShowListener*>(this));
66cdf0e10cSrcweir mxSlideShowController = NULL;
67cdf0e10cSrcweir }
68cdf0e10cSrcweir }
69cdf0e10cSrcweir
70cdf0e10cSrcweir //----- XSlideShowListener ----------------------------------------------------
71cdf0e10cSrcweir
beginEvent(const Reference<animations::XAnimationNode> & rNode)72cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::beginEvent (
73cdf0e10cSrcweir const Reference<animations::XAnimationNode>& rNode)
74cdf0e10cSrcweir throw (css::uno::RuntimeException)
75cdf0e10cSrcweir {
76cdf0e10cSrcweir (void)rNode;
77cdf0e10cSrcweir }
78cdf0e10cSrcweir
endEvent(const Reference<animations::XAnimationNode> & rNode)79cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::endEvent (
80cdf0e10cSrcweir const Reference<animations::XAnimationNode>& rNode)
81cdf0e10cSrcweir throw(css::uno::RuntimeException)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir (void)rNode;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir
repeat(const css::uno::Reference<css::animations::XAnimationNode> & rNode,sal_Int32)86cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::repeat (
87cdf0e10cSrcweir const css::uno::Reference<css::animations::XAnimationNode>& rNode,
88cdf0e10cSrcweir sal_Int32)
89cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir (void)rNode;
92cdf0e10cSrcweir }
93cdf0e10cSrcweir
paused(void)94cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::paused (void)
95cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
resumed(void)99cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::resumed (void)
100cdf0e10cSrcweir throw (css::uno::RuntimeException)
101cdf0e10cSrcweir {
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
slideEnded(sal_Bool bReverse)104cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::slideEnded (sal_Bool bReverse)
105cdf0e10cSrcweir throw (css::uno::RuntimeException)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir // Determine whether the new current slide (the one after the one that
108cdf0e10cSrcweir // just ended) is the slide past the last slide in the presentation,
109cdf0e10cSrcweir // i.e. the one that says something like "click to end presentation...".
110cdf0e10cSrcweir if (mxSlideShowController.is() && !bReverse)
111cdf0e10cSrcweir if (mxSlideShowController->getNextSlideIndex() < 0)
112cdf0e10cSrcweir if( mpPresenterController.is() )
113cdf0e10cSrcweir mpPresenterController->UpdateCurrentSlide(+1);
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
hyperLinkClicked(const rtl::OUString &)116cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::hyperLinkClicked (const rtl::OUString &)
117cdf0e10cSrcweir throw (css::uno::RuntimeException)
118cdf0e10cSrcweir {
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
slideTransitionStarted(void)121cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::slideTransitionStarted (void)
122cdf0e10cSrcweir throw (css::uno::RuntimeException)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir if( mpPresenterController.is() )
125cdf0e10cSrcweir mpPresenterController->UpdateCurrentSlide(0);
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
slideTransitionEnded(void)128cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::slideTransitionEnded (void)
129cdf0e10cSrcweir throw (css::uno::RuntimeException)
130cdf0e10cSrcweir {
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
slideAnimationsEnded(void)133cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::slideAnimationsEnded (void)
134cdf0e10cSrcweir throw (css::uno::RuntimeException)
135cdf0e10cSrcweir {
136cdf0e10cSrcweir }
137cdf0e10cSrcweir
138cdf0e10cSrcweir //----- XEventListener --------------------------------------------------------
139cdf0e10cSrcweir
disposing(const lang::EventObject & rEvent)140cdf0e10cSrcweir void SAL_CALL PresenterCurrentSlideObserver::disposing (
141cdf0e10cSrcweir const lang::EventObject& rEvent)
142cdf0e10cSrcweir throw (RuntimeException)
143cdf0e10cSrcweir {
144cdf0e10cSrcweir if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpPresenterController.get())))
145cdf0e10cSrcweir dispose();
146cdf0e10cSrcweir else if (rEvent.Source == mxSlideShowController)
147cdf0e10cSrcweir mxSlideShowController = NULL;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
150cdf0e10cSrcweir } } // end of namespace ::sdext::presenter
151