diff options
Diffstat (limited to 'include/avmedia')
-rw-r--r-- | include/avmedia/avmediadllapi.h | 34 | ||||
-rw-r--r-- | include/avmedia/mediaitem.hxx | 132 | ||||
-rw-r--r-- | include/avmedia/mediaplayer.hxx | 76 | ||||
-rw-r--r-- | include/avmedia/mediatoolbox.hxx | 60 | ||||
-rw-r--r-- | include/avmedia/mediawindow.hxx | 123 |
5 files changed, 425 insertions, 0 deletions
diff --git a/include/avmedia/avmediadllapi.h b/include/avmedia/avmediadllapi.h new file mode 100644 index 000000000000..351b82854a7f --- /dev/null +++ b/include/avmedia/avmediadllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_AVMEDIADLLAPI_H +#define INCLUDED_AVMEDIADLLAPI_H + +#include "sal/types.h" + +#if defined(AVMEDIA_DLLIMPLEMENTATION) +#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define AVMEDIA_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_AVMEDIADLLAPI_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx new file mode 100644 index 000000000000..f14281999307 --- /dev/null +++ b/include/avmedia/mediaitem.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef AVMEDIA_MEDIAITEM_HXX +#define AVMEDIA_MEDIAITEM_HXX + +#include <boost/scoped_ptr.hpp> + +#include <tools/rtti.hxx> +#include <svl/poolitem.hxx> +#include <com/sun/star/media/ZoomLevel.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <avmedia/avmediadllapi.h> + +#define AVMEDIA_SETMASK_NONE ((sal_uInt32)(0x00000000)) +#define AVMEDIA_SETMASK_STATE ((sal_uInt32)(0x00000001)) +#define AVMEDIA_SETMASK_DURATION ((sal_uInt32)(0x00000002)) +#define AVMEDIA_SETMASK_TIME ((sal_uInt32)(0x00000004)) +#define AVMEDIA_SETMASK_LOOP ((sal_uInt32)(0x00000008)) +#define AVMEDIA_SETMASK_MUTE ((sal_uInt32)(0x00000010)) +#define AVMEDIA_SETMASK_VOLUMEDB ((sal_uInt32)(0x00000020)) +#define AVMEDIA_SETMASK_ZOOM ((sal_uInt32)(0x00000040)) +#define AVMEDIA_SETMASK_URL ((sal_uInt32)(0x00000080)) +#define AVMEDIA_SETMASK_ALL ((sal_uInt32)(0xffffffff)) + +class SvStream; + +namespace avmedia +{ + +//--------------- +// - MediaState - +// -------------- + +enum MediaState +{ + MEDIASTATE_STOP = 0, + MEDIASTATE_PLAY = 1, + MEDIASTATE_PLAYFFW = 2, + MEDIASTATE_PAUSE = 3 +}; + +// ------------- +// - MediaItem - +// ------------- + +class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + explicit MediaItem( sal_uInt16 const i_nWhich = 0, + sal_uInt32 const nMaskSet = AVMEDIA_SETMASK_NONE ); + MediaItem( const MediaItem& rMediaItem ); + virtual ~MediaItem(); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreUnit, + SfxMapUnit ePresUnit, + OUString& rText, + const IntlWrapper *pIntl ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + void merge( const MediaItem& rMediaItem ); + + sal_uInt32 getMaskSet() const; + + void setState( MediaState eState ); + MediaState getState() const; + + void setDuration( double fDuration ); + double getDuration() const; + + void setTime( double fTime ); + double getTime() const; + + void setLoop( bool bLoop ); + bool isLoop() const; + + void setMute( bool bMute ); + bool isMute() const; + + void setVolumeDB( sal_Int16 nDB ); + sal_Int16 getVolumeDB() const; + + void setZoom( ::com::sun::star::media::ZoomLevel eZoom ); + ::com::sun::star::media::ZoomLevel getZoom() const; + + void setURL( const OUString& rURL, + OUString const*const pTempURL); + const OUString& getURL() const; + + const OUString& getTempURL() const; + +private: + + struct Impl; + ::boost::scoped_ptr<Impl> m_pImpl; +}; + +typedef ::avmedia::MediaItem avmedia_MediaItem; + +bool AVMEDIA_DLLPUBLIC EmbedMedia( + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> + const& xModel, + OUString const& rSourceURL, + OUString & o_rEmbeddedURL); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx new file mode 100644 index 000000000000..b823f7c63b67 --- /dev/null +++ b/include/avmedia/mediaplayer.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _AVMEDIA_MEDIACHILD_HXX +#define _AVMEDIA_MEDIACHILD_HXX + +#include <sfx2/ctrlitem.hxx> +#include <sfx2/dockwin.hxx> +#include <avmedia/avmediadllapi.h> + +#define AVMEDIA_MEDIAWINDOW() \ +(static_cast< ::avmedia::MediaFloater* >( ( \ +SfxViewFrame::Current() && SfxViewFrame::Current()->GetChildWindow(::avmedia::MediaPlayer::GetChildWindowId())) ? \ +SfxViewFrame::Current()->GetChildWindow(::avmedia::MediaPlayer::GetChildWindowId())->GetWindow() : \ +NULL)) + +namespace avmedia +{ + +class AVMEDIA_DLLPUBLIC MediaPlayer : public SfxChildWindow +{ +public: + MediaPlayer( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); + ~MediaPlayer(); + + SFX_DECL_CHILDWINDOW_WITHID( MediaPlayer ); +}; + +class MediaWindow; + +class AVMEDIA_DLLPUBLIC MediaFloater : public SfxDockingWindow +{ +public: + + MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, Window* pParent ); + ~MediaFloater(); + + void setURL( const OUString& rURL, bool bPlayImmediately ); + const OUString& getURL() const; + + void dispatchCurrentURL(); + +protected: + + virtual void Resize(); + virtual void ToggleFloatingMode(); + +private: + + MediaWindow* mpMediaWindow; + Size maLastSize; + + AVMEDIA_DLLPRIVATE void implInit(); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx new file mode 100644 index 000000000000..570167024aff --- /dev/null +++ b/include/avmedia/mediatoolbox.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _AVMEDIA_MEDIATOOLBOX_HXX +#define _AVMEDIA_MEDIATOOLBOX_HXX + +#include <svl/lstner.hxx> +#include <sfx2/tbxctrl.hxx> +#include <avmedia/avmediadllapi.h> + +namespace avmedia +{ + +// ------------------------------- +// - SvxGrafFilterToolBoxControl - +// ------------------------------- + +class MediaItem; + +class AVMEDIA_DLLPUBLIC MediaToolBoxControl : public SfxToolBoxControl +{ + friend class MediaToolBoxControl_Impl; + +public: + + SFX_DECL_TOOLBOX_CONTROL(); + + MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX ); + ~MediaToolBoxControl(); + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual Window* CreateItemWindow( Window* pParent ); + +private: + + AVMEDIA_DLLPRIVATE void implUpdateMediaControl(); + AVMEDIA_DLLPRIVATE void implExecuteMediaControl( const MediaItem& rItem ); +}; + +} + +#endif // _AVMEDIA_MEDIATOOLBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx new file mode 100644 index 000000000000..a5cb5dc8e7a8 --- /dev/null +++ b/include/avmedia/mediawindow.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _AVMEDIA_MEDIAWINDOW_HXX +#define _AVMEDIA_MEDIAWINDOW_HXX + +#include <memory> +#include <vector> +#include <tools/gen.hxx> +#include <com/sun/star/media/ZoomLevel.hpp> +#include <com/sun/star/media/XPlayer.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <avmedia/avmediadllapi.h> + +#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0 + +class Window; +class KeyEvent; +class MouseEvent; +class CommandEvent; +class PopupMenu; +class Pointer; +struct AcceptDropEvent; +struct ExecuteDropEvent; + + +namespace avmedia +{ + typedef ::std::vector< ::std::pair< OUString, OUString > > FilterNameVector; + + class MediaItem; + + namespace priv { class MediaWindowImpl; } + + class AVMEDIA_DLLPUBLIC MediaWindow + { + public: + MediaWindow( Window* parent, bool bInternalMediaControl ); + virtual ~MediaWindow(); + + void setURL( const OUString& rURL ); + const OUString& getURL() const; + + bool isValid() const; + Size getPreferredSize() const; + + Window* getWindow() const; + + void setPosSize( const Rectangle& rNewRect ); + + void setPointer( const Pointer& rPointer ); + + bool start(); + + void updateMediaItem( MediaItem& rItem ) const; + void executeMediaItem( const MediaItem& rItem ); + + void show(); + void hide(); + + public: + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyUp( const KeyEvent& rKEvt ); + + virtual void Command( const CommandEvent& rCEvt ); + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); + + public: + + static void getMediaFilters( FilterNameVector& rFilterNameVector ); + /// @param o_pbLink if not 0, this is an "insert" dialog: display link + /// checkbox and store its state in *o_pbLink + static bool executeMediaURLDialog( Window* pParent, + OUString& rURL, bool *const o_pbLink ); + static void executeFormatErrorBox( Window* pParent ); + static bool isMediaURL( const OUString& rURL, bool bDeep = false, Size* pPreferredSizePixel = NULL ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL, + bool bAllowToCreateReplacementGraphic = false, + double fMediaTime = AVMEDIA_FRAMEGRABBER_DEFAULTFRAME ); + + private: + + // default: disabled copy/assignment + AVMEDIA_DLLPRIVATE MediaWindow(const MediaWindow&); + AVMEDIA_DLLPRIVATE MediaWindow& operator =( const MediaWindow& ); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxIFace; + priv::MediaWindowImpl* mpImpl; + }; +} + +#endif // _AVMEDIA_MEDIAWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |