Kaydet (Commit) 52e4ba4b authored tarafından Noel Grandin's avatar Noel Grandin

convert MediaState to scoped enum

Change-Id: Idf14f7d344be6c690cdd721cd5f7eb7c328b590c
üst 758916a8
...@@ -318,7 +318,7 @@ void MediaControl::implUpdateToolboxes() ...@@ -318,7 +318,7 @@ void MediaControl::implUpdateToolboxes()
maPlayToolBox->Enable(); maPlayToolBox->Enable();
maMuteToolBox->Enable(); maMuteToolBox->Enable();
if( MEDIASTATE_PLAY == maItem.getState() ) if( MediaState::Play == maItem.getState() )
{ {
maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true ); maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true );
maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); maPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
...@@ -498,7 +498,7 @@ IMPL_LINK_TYPED( MediaControl, implSelectHdl, ToolBox*, p, void ) ...@@ -498,7 +498,7 @@ IMPL_LINK_TYPED( MediaControl, implSelectHdl, ToolBox*, p, void )
else else
{ {
aExecItem.setURL( aURL, "", ""/*TODO?*/ ); aExecItem.setURL( aURL, "", ""/*TODO?*/ );
aExecItem.setState( MEDIASTATE_PLAY ); aExecItem.setState( MediaState::Play );
} }
} }
} }
...@@ -515,7 +515,7 @@ IMPL_LINK_TYPED( MediaControl, implSelectHdl, ToolBox*, p, void ) ...@@ -515,7 +515,7 @@ IMPL_LINK_TYPED( MediaControl, implSelectHdl, ToolBox*, p, void )
case( AVMEDIA_TOOLBOXITEM_PLAY ): case( AVMEDIA_TOOLBOXITEM_PLAY ):
{ {
aExecItem.setState( MEDIASTATE_PLAY ); aExecItem.setState( MediaState::Play );
if( maItem.getTime() == maItem.getDuration() ) if( maItem.getTime() == maItem.getDuration() )
aExecItem.setTime( 0.0 ); aExecItem.setTime( 0.0 );
...@@ -526,13 +526,13 @@ IMPL_LINK_TYPED( MediaControl, implSelectHdl, ToolBox*, p, void ) ...@@ -526,13 +526,13 @@ IMPL_LINK_TYPED( MediaControl, implSelectHdl, ToolBox*, p, void )
case( AVMEDIA_TOOLBOXITEM_PAUSE ): case( AVMEDIA_TOOLBOXITEM_PAUSE ):
{ {
aExecItem.setState( MEDIASTATE_PAUSE ); aExecItem.setState( MediaState::Pause );
} }
break; break;
case( AVMEDIA_TOOLBOXITEM_STOP ): case( AVMEDIA_TOOLBOXITEM_STOP ):
{ {
aExecItem.setState( MEDIASTATE_STOP ); aExecItem.setState( MediaState::Stop );
aExecItem.setTime( 0.0 ); aExecItem.setTime( 0.0 );
} }
break; break;
......
...@@ -63,7 +63,7 @@ struct MediaItem::Impl ...@@ -63,7 +63,7 @@ struct MediaItem::Impl
explicit Impl(AVMediaSetMask nMaskSet) explicit Impl(AVMediaSetMask nMaskSet)
: m_nMaskSet( nMaskSet ) : m_nMaskSet( nMaskSet )
, m_eState( MEDIASTATE_STOP ) , m_eState( MediaState::Stop )
, m_fTime( 0.0 ) , m_fTime( 0.0 )
, m_fDuration( 0.0 ) , m_fDuration( 0.0 )
, m_nVolumeDB( 0 ) , m_nVolumeDB( 0 )
......
...@@ -325,9 +325,9 @@ bool MediaWindowImpl::start() ...@@ -325,9 +325,9 @@ bool MediaWindowImpl::start()
void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const
{ {
if( isPlaying() ) if( isPlaying() )
rItem.setState( MEDIASTATE_PLAY ); rItem.setState( MediaState::Play );
else else
rItem.setState( ( 0.0 == getMediaTime() ) ? MEDIASTATE_STOP : MEDIASTATE_PAUSE ); rItem.setState( ( 0.0 == getMediaTime() ) ? MediaState::Stop : MediaState::Pause );
rItem.setDuration( getDuration() ); rItem.setDuration( getDuration() );
rItem.setTime( getMediaTime() ); rItem.setTime( getMediaTime() );
...@@ -370,21 +370,21 @@ void MediaWindowImpl::executeMediaItem( const MediaItem& rItem ) ...@@ -370,21 +370,21 @@ void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
{ {
switch (rItem.getState()) switch (rItem.getState())
{ {
case MEDIASTATE_PLAY: case MediaState::Play:
{ {
if (!isPlaying()) if (!isPlaying())
start(); start();
} }
break; break;
case MEDIASTATE_PAUSE: case MediaState::Pause:
{ {
if (isPlaying()) if (isPlaying())
stop(); stop();
} }
break; break;
case MEDIASTATE_STOP: case MediaState::Stop:
{ {
if (isPlaying()) if (isPlaying())
{ {
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <memory> #include <memory>
#include <o3tl/typed_flags_set.hxx> #include <o3tl/typed_flags_set.hxx>
class SvStream;
enum class AVMediaSetMask enum class AVMediaSetMask
{ {
NONE = 0x000, NONE = 0x000,
...@@ -48,26 +50,17 @@ namespace o3tl ...@@ -48,26 +50,17 @@ namespace o3tl
template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x1ff> {}; template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x1ff> {};
} }
class SvStream;
namespace avmedia namespace avmedia
{ {
// - MediaState - enum class MediaState
enum MediaState
{ {
MEDIASTATE_STOP = 0, Stop, Play, Pause
MEDIASTATE_PLAY = 1,
MEDIASTATE_PAUSE = 2
}; };
// - MediaItem -
class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem
{ {
public: public:
...@@ -80,13 +73,13 @@ public: ...@@ -80,13 +73,13 @@ public:
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE; virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE; virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
virtual bool GetPresentation( SfxItemPresentation ePres, virtual bool GetPresentation( SfxItemPresentation ePres,
SfxMapUnit eCoreUnit, SfxMapUnit eCoreUnit,
SfxMapUnit ePresUnit, SfxMapUnit ePresUnit,
OUString& rText, OUString& rText,
const IntlWrapper *pIntl ) const SAL_OVERRIDE; const IntlWrapper *pIntl ) const SAL_OVERRIDE;
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
void merge( const MediaItem& rMediaItem ); void merge( const MediaItem& rMediaItem );
...@@ -110,19 +103,19 @@ public: ...@@ -110,19 +103,19 @@ public:
void setVolumeDB( sal_Int16 nDB ); void setVolumeDB( sal_Int16 nDB );
sal_Int16 getVolumeDB() const; sal_Int16 getVolumeDB() const;
void setZoom( ::com::sun::star::media::ZoomLevel eZoom ); void setZoom( ::css::media::ZoomLevel eZoom );
::com::sun::star::media::ZoomLevel getZoom() const; ::css::media::ZoomLevel getZoom() const;
void setURL( const OUString& rURL, void setURL( const OUString& rURL,
const OUString& rTempURL, const OUString& rTempURL,
const OUString& rReferer); const OUString& rReferer);
const OUString& getURL() const; const OUString& getURL() const;
void setMimeType( const OUString& rMimeType ); void setMimeType( const OUString& rMimeType );
OUString getMimeType() const; OUString getMimeType() const;
const OUString& getTempURL() const; const OUString& getTempURL() const;
const OUString& getReferer() const; const OUString& getReferer() const;
private: private:
...@@ -133,15 +126,14 @@ private: ...@@ -133,15 +126,14 @@ private:
typedef ::avmedia::MediaItem avmedia_MediaItem; typedef ::avmedia::MediaItem avmedia_MediaItem;
bool AVMEDIA_DLLPUBLIC EmbedMedia( bool AVMEDIA_DLLPUBLIC EmbedMedia(
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> const ::css::uno::Reference< ::css::frame::XModel>& xModel,
const& xModel, const OUString& rSourceURL,
OUString const& rSourceURL,
OUString & o_rEmbeddedURL); OUString & o_rEmbeddedURL);
OUString GetFilename(OUString const& rSourceURL); OUString GetFilename(OUString const& rSourceURL);
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream> CreateStream( ::css::uno::Reference< ::css::io::XStream> CreateStream(
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> const& xStorage, OUString const& rFilename); const ::css::uno::Reference< ::css::embed::XStorage>& xStorage, const OUString& rFilename);
} }
#endif #endif
......
...@@ -97,7 +97,7 @@ void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rIte ...@@ -97,7 +97,7 @@ void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rIte
mpMediaWindow->updateMediaItem( rItem ); mpMediaWindow->updateMediaItem( rItem );
// show/hide is now dependent of play state // show/hide is now dependent of play state
if(avmedia::MEDIASTATE_STOP == rItem.getState()) if(avmedia::MediaState::Stop == rItem.getState())
{ {
mpMediaWindow->hide(); mpMediaWindow->hide();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment