xref: /AOO41X/main/avmedia/inc/avmedia/mediaitem.hxx (revision 9ea84ac54d7ea9ebcfae551950dfc30154280364)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _AVMEDIA_MEDIAITEM_HXX
25 #define _AVMEDIA_MEDIAITEM_HXX
26 
27 #include <tools/rtti.hxx>
28 #ifndef _POOLITEM_HXX
29 #include <svl/poolitem.hxx>
30 #endif
31 #include <com/sun/star/media/ZoomLevel.hpp>
32 
33 #define AVMEDIA_SETMASK_NONE        ((sal_uInt32)(0x00000000))
34 #define AVMEDIA_SETMASK_STATE       ((sal_uInt32)(0x00000001))
35 #define AVMEDIA_SETMASK_DURATION    ((sal_uInt32)(0x00000002))
36 #define AVMEDIA_SETMASK_TIME        ((sal_uInt32)(0x00000004))
37 #define AVMEDIA_SETMASK_LOOP        ((sal_uInt32)(0x00000008))
38 #define AVMEDIA_SETMASK_MUTE        ((sal_uInt32)(0x00000010))
39 #define AVMEDIA_SETMASK_VOLUMEDB    ((sal_uInt32)(0x00000020))
40 #define AVMEDIA_SETMASK_ZOOM        ((sal_uInt32)(0x00000040))
41 #define AVMEDIA_SETMASK_URL         ((sal_uInt32)(0x00000080))
42 #define AVMEDIA_SETMASK_ALL         ((sal_uInt32)(0xffffffff))
43 
44 class SvStream;
45 
46 namespace avmedia
47 {
48 
49 //---------------
50 // - MediaState -
51 // --------------
52 
53 enum MediaState
54 {
55     MEDIASTATE_STOP = 0,
56     MEDIASTATE_PLAY = 1,
57     MEDIASTATE_PLAYFFW = 2,
58     MEDIASTATE_PAUSE = 3
59 };
60 
61 // -------------
62 // - MediaItem -
63 // -------------
64 
65 class MediaItem : public SfxPoolItem
66 {
67 public:
68                             TYPEINFO();
69 
70                             MediaItem( sal_uInt16 nWhich = 0, sal_uInt32 nMaskSet = AVMEDIA_SETMASK_NONE );
71                             MediaItem( const MediaItem& rMediaItem );
72     virtual                 ~MediaItem();
73 
74     virtual int             operator==( const SfxPoolItem& ) const;
75     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
76     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
77                                                  SfxMapUnit eCoreUnit,
78                                                  SfxMapUnit ePresUnit,
79                                                  XubString& rText,
80                                                  const IntlWrapper *pIntl ) const;
81     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
82     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
83 
84     void                    merge( const MediaItem& rMediaItem );
85 
86     sal_uInt32              getMaskSet() const;
87 
88     void                    setState( MediaState eState );
89     MediaState              getState() const;
90 
91     void                    setDuration( double fDuration );
92     double                  getDuration() const;
93 
94     void                    setTime( double fTime );
95     double                  getTime() const;
96 
97     void                    setLoop( sal_Bool bLoop );
98     sal_Bool                isLoop() const;
99 
100     void                    setMute( sal_Bool bMute );
101     sal_Bool                isMute() const;
102 
103     void                    setVolumeDB( sal_Int16 nDB );
104     sal_Int16               getVolumeDB() const;
105 
106     void                    setZoom( ::com::sun::star::media::ZoomLevel eZoom );
107     ::com::sun::star::media::ZoomLevel  getZoom() const;
108 
109     void                    setURL( const ::rtl::OUString& rURL );
110     const ::rtl::OUString&  getURL() const;
111 
112 private:
113 
114     ::rtl::OUString         maURL;
115     sal_uInt32              mnMaskSet;
116     MediaState              meState;
117     double                  mfTime;
118     double                  mfDuration;
119     sal_Int16               mnVolumeDB;
120     sal_Bool                mbLoop;
121     sal_Bool                mbMute;
122     ::com::sun::star::media::ZoomLevel meZoom;
123 };
124 
125 typedef ::avmedia::MediaItem avmedia_MediaItem;
126 
127 }
128 
129 #endif
130