Files
libreoffice/slideshow/source/inc/soundplayer.hxx
Vladimir Glazounov 3fc2b1a3d5 INTEGRATION: CWS presfixes01 (1.2.6); FILE MERGED
2005/02/02 22:47:01 dbo 1.2.6.2: #i37777#
- timing changes for activities queue
- minor fixes
Issue number:
Submitted by:
Reviewed by:
2005/01/30 15:49:48 dbo 1.2.6.1: #i39662# sound pausing
Issue number:
Submitted by:
Reviewed by:
2005-03-10 12:56:41 +00:00

158 lines
5.3 KiB
C++

/*************************************************************************
*
* $RCSfile: soundplayer.hxx,v $
*
* $Revision: 1.3 $
*
* last change: $Author: vg $ $Date: 2005-03-10 13:56:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _SLIDESHOW_SOUNDPLAYER_HXX
#define _SLIDESHOW_SOUNDPLAYER_HXX
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HXX_
#include <com/sun/star/uno/XComponentContext.hpp>
#endif
#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HPP_
#include <com/sun/star/media/XManager.hpp>
#endif
#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HPP_
#include <com/sun/star/media/XPlayer.hpp>
#endif
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <boost/shared_ptr.hpp>
#endif
#include "pauseeventhandler.hxx"
#include "eventmultiplexer.hxx"
/* Definition of SoundPlayer class */
namespace presentation
{
namespace internal
{
/** Little class that plays a sound from a URL.
TODO:
Must be explicitly disposed (as long as enable_shared_ptr_from_this
isn't available)!
*/
class SoundPlayer : public PauseEventHandler
{
public:
/** Create a sound player object.
@param rSoundURL
URL to a sound file.
@param rComponentContext
Reference to a component context, used to create the
needed services
@throws ::com::sun::star::lang::NoSupportException, if
the sound file is invalid, or not supported by the
player service.
*/
static ::boost::shared_ptr<SoundPlayer> create(
EventMultiplexer & rEventMultiplexer,
const ::rtl::OUString& rSoundURL,
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext>& rComponentContext );
virtual ~SoundPlayer();
/** Query duration of sound playback.
If the sound is already playing, this method
returns the remaining playback time.
@return the playback duration in seconds.
*/
double getDuration() const;
bool startPlayback();
bool stopPlayback();
// PauseEventHandler:
virtual bool handlePause( bool bPauseShow );
// Disposable:
virtual void dispose();
private:
SoundPlayer(
EventMultiplexer & rEventMultiplexer,
const ::rtl::OUString& rSoundURL,
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext>& rComponentContext );
EventMultiplexer & mrEventMultiplexer;
// TODO(Q3): obsolete when boost::enable_shared_ptr_from_this
// is available
::boost::shared_ptr<SoundPlayer> mThis;
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
};
typedef ::boost::shared_ptr< SoundPlayer > SoundPlayerSharedPtr;
}
}
#endif /* _SLIDESHOW_SOUNDPLAYER_HXX */