1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterCurrentSlideObserver.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sdext.hxx"
35 #include "PresenterCurrentSlideObserver.hxx"
37 using namespace ::com::sun::star
;
38 using namespace ::com::sun::star::uno
;
39 using ::rtl::OUString
;
41 namespace sdext
{ namespace presenter
{
43 //===== PresenterCurrentSlideObserver =========================================
45 PresenterCurrentSlideObserver::PresenterCurrentSlideObserver (
46 const ::rtl::Reference
<PresenterController
>& rxPresenterController
,
47 const Reference
<presentation::XSlideShowController
>& rxSlideShowController
)
48 : PresenterCurrentSlideObserverInterfaceBase(m_aMutex
),
49 mpPresenterController(rxPresenterController
),
50 mxSlideShowController(rxSlideShowController
)
52 if( mpPresenterController
.is() )
54 mpPresenterController
->addEventListener(this);
57 if( mxSlideShowController
.is() )
59 // Listen for events from the slide show controller.
60 mxSlideShowController
->addSlideShowListener(static_cast<XSlideShowListener
*>(this));
64 PresenterCurrentSlideObserver::~PresenterCurrentSlideObserver (void)
68 void SAL_CALL
PresenterCurrentSlideObserver::disposing (void)
70 // Disconnect form the slide show controller.
71 if(mxSlideShowController
.is())
73 mxSlideShowController
->removeSlideShowListener(static_cast<XSlideShowListener
*>(this));
74 mxSlideShowController
= NULL
;
78 //----- XSlideShowListener ----------------------------------------------------
80 void SAL_CALL
PresenterCurrentSlideObserver::beginEvent (
81 const Reference
<animations::XAnimationNode
>& rNode
)
82 throw (css::uno::RuntimeException
)
87 void SAL_CALL
PresenterCurrentSlideObserver::endEvent (
88 const Reference
<animations::XAnimationNode
>& rNode
)
89 throw(css::uno::RuntimeException
)
94 void SAL_CALL
PresenterCurrentSlideObserver::repeat (
95 const css::uno::Reference
<css::animations::XAnimationNode
>& rNode
,
97 throw (com::sun::star::uno::RuntimeException
)
102 void SAL_CALL
PresenterCurrentSlideObserver::paused (void)
103 throw (com::sun::star::uno::RuntimeException
)
107 void SAL_CALL
PresenterCurrentSlideObserver::resumed (void)
108 throw (css::uno::RuntimeException
)
112 void SAL_CALL
PresenterCurrentSlideObserver::slideEnded (sal_Bool bReverse
)
113 throw (css::uno::RuntimeException
)
115 // Determine whether the new current slide (the one after the one that
116 // just ended) is the slide past the last slide in the presentation,
117 // i.e. the one that says something like "click to end presentation...".
118 if (mxSlideShowController
.is() && !bReverse
)
119 if (mxSlideShowController
->getNextSlideIndex() < 0)
120 if( mpPresenterController
.is() )
121 mpPresenterController
->UpdateCurrentSlide(+1);
124 void SAL_CALL
PresenterCurrentSlideObserver::hyperLinkClicked (const rtl::OUString
&)
125 throw (css::uno::RuntimeException
)
129 void SAL_CALL
PresenterCurrentSlideObserver::slideTransitionStarted (void)
130 throw (css::uno::RuntimeException
)
132 if( mpPresenterController
.is() )
133 mpPresenterController
->UpdateCurrentSlide(0);
136 void SAL_CALL
PresenterCurrentSlideObserver::slideTransitionEnded (void)
137 throw (css::uno::RuntimeException
)
141 void SAL_CALL
PresenterCurrentSlideObserver::slideAnimationsEnded (void)
142 throw (css::uno::RuntimeException
)
146 //----- XEventListener --------------------------------------------------------
148 void SAL_CALL
PresenterCurrentSlideObserver::disposing (
149 const lang::EventObject
& rEvent
)
150 throw (RuntimeException
)
152 if (rEvent
.Source
== Reference
<XInterface
>(static_cast<XWeak
*>(mpPresenterController
.get())))
154 else if (rEvent
.Source
== mxSlideShowController
)
155 mxSlideShowController
= NULL
;
158 } } // end of namespace ::sdext::presenter