1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX
28 #define INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX
29 
30 #include "basecontainernode.hxx"
31 #include "soundplayer.hxx"
32 #include "com/sun/star/animations/XAnimationNode.hpp"
33 #include "com/sun/star/animations/XAudio.hpp"
34 
35 namespace slideshow {
36 namespace internal {
37 
38 /** Audio node.
39 
40     This animation node contains an audio effect. Duration and
41     start/stop behaviour is affected by the referenced audio
42     file.
43 */
44 class AnimationAudioNode : public BaseNode, public AnimationEventHandler
45 {
46 public:
47     AnimationAudioNode(
48         ::com::sun::star::uno::Reference<
49         ::com::sun::star::animations::XAnimationNode> const& xNode,
50         ::boost::shared_ptr<BaseContainerNode> const& pParent,
51         NodeContext const& rContext );
52 
53 protected:
54     virtual void dispose();
55 
56 private:
57     virtual void activate_st();
58     virtual void deactivate_st( NodeState eDestState );
59     virtual bool hasPendingAnimation() const;
60 
61     /// overriden, because we need to deal with STOPAUDIO commands
62     virtual bool handleAnimationEvent( const AnimationNodeSharedPtr& rNode );
63 
64 private:
65     ::com::sun::star::uno::Reference<
66         ::com::sun::star::animations::XAudio >  mxAudioNode;
67     ::rtl::OUString                             maSoundURL;
68     mutable SoundPlayerSharedPtr                mpPlayer;
69 
70     void createPlayer() const;
71     void resetPlayer() const;
72 };
73 
74 } // namespace internal
75 } // namespace slideshow
76 
77 #endif /* INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX */
78