1aaef562fSAndrew Rist /**************************************************************
2*1738ad43Smseidel  *
3aaef562fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4aaef562fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5aaef562fSAndrew Rist  * distributed with this work for additional information
6aaef562fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7aaef562fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8aaef562fSAndrew Rist  * "License"); you may not use this file except in compliance
9aaef562fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1738ad43Smseidel  *
11aaef562fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1738ad43Smseidel  *
13aaef562fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14aaef562fSAndrew Rist  * software distributed under the License is distributed on an
15aaef562fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16aaef562fSAndrew Rist  * KIND, either express or implied.  See the License for the
17aaef562fSAndrew Rist  * specific language governing permissions and limitations
18aaef562fSAndrew Rist  * under the License.
19*1738ad43Smseidel  *
20aaef562fSAndrew Rist  *************************************************************/
21aaef562fSAndrew Rist 
22aaef562fSAndrew Rist 
23*1738ad43Smseidel 
24cdf0e10cSrcweir #ifndef INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX
25cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "basecontainernode.hxx"
28cdf0e10cSrcweir #include "soundplayer.hxx"
29cdf0e10cSrcweir #include "com/sun/star/animations/XAnimationNode.hpp"
30cdf0e10cSrcweir #include "com/sun/star/animations/XAudio.hpp"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace slideshow {
33cdf0e10cSrcweir namespace internal {
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /** Audio node.
36*1738ad43Smseidel 
37cdf0e10cSrcweir     This animation node contains an audio effect. Duration and
38*1738ad43Smseidel     start/stop behavior is affected by the referenced audio
39cdf0e10cSrcweir     file.
40cdf0e10cSrcweir */
41cdf0e10cSrcweir class AnimationAudioNode : public BaseNode, public AnimationEventHandler
42cdf0e10cSrcweir {
43cdf0e10cSrcweir public:
44cdf0e10cSrcweir     AnimationAudioNode(
45cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
46*1738ad43Smseidel         ::com::sun::star::animations::XAnimationNode> const& xNode,
47cdf0e10cSrcweir         ::boost::shared_ptr<BaseContainerNode> const& pParent,
48cdf0e10cSrcweir         NodeContext const& rContext );
49*1738ad43Smseidel 
50cdf0e10cSrcweir protected:
51cdf0e10cSrcweir     virtual void dispose();
52*1738ad43Smseidel 
53cdf0e10cSrcweir private:
54cdf0e10cSrcweir     virtual void activate_st();
55cdf0e10cSrcweir     virtual void deactivate_st( NodeState eDestState );
56cdf0e10cSrcweir     virtual bool hasPendingAnimation() const;
57*1738ad43Smseidel 
58*1738ad43Smseidel     /// overridden, because we need to deal with STOPAUDIO commands
59cdf0e10cSrcweir     virtual bool handleAnimationEvent( const AnimationNodeSharedPtr& rNode );
60*1738ad43Smseidel 
61cdf0e10cSrcweir private:
62*1738ad43Smseidel     ::com::sun::star::uno::Reference<
63cdf0e10cSrcweir         ::com::sun::star::animations::XAudio >  mxAudioNode;
64cdf0e10cSrcweir     ::rtl::OUString                             maSoundURL;
65cdf0e10cSrcweir     mutable SoundPlayerSharedPtr                mpPlayer;
66*1738ad43Smseidel 
67cdf0e10cSrcweir     void createPlayer() const;
68cdf0e10cSrcweir     void resetPlayer() const;
69cdf0e10cSrcweir };
70cdf0e10cSrcweir 
71cdf0e10cSrcweir } // namespace internal
72cdf0e10cSrcweir } // namespace slideshow
73cdf0e10cSrcweir 
74cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX */
75