Bump version to 6.4-15
[LibreOffice.git] / include / avmedia / mediaitem.hxx
blobe309b0b29ce2e30af6d8bfee5cf1e9328e8bfdb6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_AVMEDIA_MEDIAITEM_HXX
21 #define INCLUDED_AVMEDIA_MEDIAITEM_HXX
23 #include <svl/poolitem.hxx>
24 #include <com/sun/star/media/ZoomLevel.hpp>
25 #include <avmedia/avmediadllapi.h>
26 #include <memory>
27 #include <o3tl/typed_flags_set.hxx>
29 namespace com::sun::star::embed { class XStorage; }
30 namespace com::sun::star::frame { class XModel; }
31 namespace com::sun::star::io { class XInputStream; }
32 namespace com::sun::star::io { class XStream; }
34 enum class AVMediaSetMask
36 NONE = 0x000,
37 STATE = 0x001,
38 DURATION = 0x002,
39 TIME = 0x004,
40 LOOP = 0x008,
41 MUTE = 0x010,
42 VOLUMEDB = 0x020,
43 ZOOM = 0x040,
44 URL = 0x080,
45 MIME_TYPE = 0x100,
46 ALL = 0x1ff,
48 namespace o3tl
50 template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x1ff> {};
54 namespace avmedia
58 enum class MediaState
60 Stop, Play, Pause
64 class AVMEDIA_DLLPUBLIC MediaItem final : public SfxPoolItem
66 public:
67 static SfxPoolItem* CreateDefault();
69 explicit MediaItem( sal_uInt16 i_nWhich = 0,
70 AVMediaSetMask nMaskSet = AVMediaSetMask::NONE );
71 MediaItem( const MediaItem& rMediaItem );
72 virtual ~MediaItem() override;
74 virtual bool operator==( const SfxPoolItem& ) const override;
75 virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
76 virtual bool GetPresentation( SfxItemPresentation ePres,
77 MapUnit eCoreUnit,
78 MapUnit ePresUnit,
79 OUString& rText,
80 const IntlWrapper& rIntl ) const override;
81 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
82 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
84 void merge( const MediaItem& rMediaItem );
86 AVMediaSetMask getMaskSet() const;
88 void setState( MediaState eState );
89 MediaState getState() const;
91 void setDuration( double fDuration );
92 double getDuration() const;
94 void setTime( double fTime );
95 double getTime() const;
97 void setLoop( bool bLoop );
98 bool isLoop() const;
100 void setMute( bool bMute );
101 bool isMute() const;
103 void setVolumeDB( sal_Int16 nDB );
104 sal_Int16 getVolumeDB() const;
106 void setZoom( ::css::media::ZoomLevel eZoom );
107 ::css::media::ZoomLevel getZoom() const;
109 void setURL( const OUString& rURL,
110 const OUString& rTempURL,
111 const OUString& rReferer);
112 const OUString& getURL() const;
114 void setMimeType( const OUString& rMimeType );
115 OUString getMimeType() const;
116 const OUString& getTempURL() const;
118 const OUString& getReferer() const;
120 private:
122 struct Impl;
123 std::unique_ptr<Impl> m_pImpl;
126 typedef ::avmedia::MediaItem avmedia_MediaItem;
128 bool AVMEDIA_DLLPUBLIC EmbedMedia(
129 const ::css::uno::Reference< ::css::frame::XModel>& xModel,
130 const OUString& rSourceURL,
131 OUString & o_rEmbeddedURL,
132 ::css::uno::Reference<::css::io::XInputStream> const& xInputStream =
133 ::css::uno::Reference<::css::io::XInputStream>());
135 bool AVMEDIA_DLLPUBLIC CreateMediaTempFile(
136 ::css::uno::Reference<::css::io::XInputStream> const& xInStream,
137 OUString& o_rTempFileURL,
138 const OUString& rDesiredExtension);
140 OUString GetFilename(OUString const& rSourceURL);
142 ::css::uno::Reference< ::css::io::XStream> CreateStream(
143 const ::css::uno::Reference< ::css::embed::XStorage>& xStorage, const OUString& rFilename);
145 struct AVMEDIA_DLLPUBLIC MediaTempFile
147 OUString const m_TempFileURL;
148 MediaTempFile(OUString const& rURL)
149 : m_TempFileURL(rURL)
151 ~MediaTempFile();
156 #endif
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */