xref: /trunk/main/avmedia/inc/avmedia/mediaitem.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
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 #include <avmedia/avmediadllapi.h>
33 
34 #define AVMEDIA_SETMASK_NONE        ((sal_uInt32)(0x00000000))
35 #define AVMEDIA_SETMASK_STATE       ((sal_uInt32)(0x00000001))
36 #define AVMEDIA_SETMASK_DURATION    ((sal_uInt32)(0x00000002))
37 #define AVMEDIA_SETMASK_TIME        ((sal_uInt32)(0x00000004))
38 #define AVMEDIA_SETMASK_LOOP        ((sal_uInt32)(0x00000008))
39 #define AVMEDIA_SETMASK_MUTE        ((sal_uInt32)(0x00000010))
40 #define AVMEDIA_SETMASK_VOLUMEDB    ((sal_uInt32)(0x00000020))
41 #define AVMEDIA_SETMASK_ZOOM        ((sal_uInt32)(0x00000040))
42 #define AVMEDIA_SETMASK_URL         ((sal_uInt32)(0x00000080))
43 #define AVMEDIA_SETMASK_ALL         ((sal_uInt32)(0xffffffff))
44 
45 class SvStream;
46 
47 namespace avmedia
48 {
49 
50 //---------------
51 // - MediaState -
52 // --------------
53 
54 enum MediaState
55 {
56     MEDIASTATE_STOP = 0,
57     MEDIASTATE_PLAY = 1,
58     MEDIASTATE_PLAYFFW = 2,
59     MEDIASTATE_PAUSE = 3
60 };
61 
62 // -------------
63 // - MediaItem -
64 // -------------
65 
66 class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem
67 {
68 public:
69                             TYPEINFO();
70 
71                             MediaItem( sal_uInt16 nWhich = 0, sal_uInt32 nMaskSet = AVMEDIA_SETMASK_NONE );
72                             MediaItem( const MediaItem& rMediaItem );
73     virtual                 ~MediaItem();
74 
75     virtual int             operator==( const SfxPoolItem& ) const;
76     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
77     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
78                                                  SfxMapUnit eCoreUnit,
79                                                  SfxMapUnit ePresUnit,
80                                                  XubString& rText,
81                                                  const IntlWrapper *pIntl ) const;
82     virtual sal_Bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
83     virtual sal_Bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
84 
85     void                    merge( const MediaItem& rMediaItem );
86 
87     sal_uInt32              getMaskSet() const;
88 
89     void                    setState( MediaState eState );
90     MediaState              getState() const;
91 
92     void                    setDuration( double fDuration );
93     double                  getDuration() const;
94 
95     void                    setTime( double fTime );
96     double                  getTime() const;
97 
98     void                    setLoop( sal_Bool bLoop );
99     sal_Bool                isLoop() const;
100 
101     void                    setMute( sal_Bool bMute );
102     sal_Bool                isMute() const;
103 
104     void                    setVolumeDB( sal_Int16 nDB );
105     sal_Int16               getVolumeDB() const;
106 
107     void                    setZoom( ::com::sun::star::media::ZoomLevel eZoom );
108     ::com::sun::star::media::ZoomLevel  getZoom() const;
109 
110     void                    setURL( const ::rtl::OUString& rURL );
111     const ::rtl::OUString&  getURL() const;
112 
113 private:
114 
115     ::rtl::OUString         maURL;
116     sal_uInt32              mnMaskSet;
117     MediaState              meState;
118     double                  mfTime;
119     double                  mfDuration;
120     sal_Int16               mnVolumeDB;
121     sal_Bool                mbLoop;
122     sal_Bool                mbMute;
123     ::com::sun::star::media::ZoomLevel meZoom;
124 };
125 
126 typedef ::avmedia::MediaItem avmedia_MediaItem;
127 
128 }
129 
130 #endif
131