1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
50 template<> struct typed_flags
<AVMediaSetMask
> : is_typed_flags
<AVMediaSetMask
, 0x1ff> {};
64 class AVMEDIA_DLLPUBLIC MediaItem final
: public SfxPoolItem
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
,
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
);
100 void setMute( bool bMute
);
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;
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
)
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */