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 <string_view>
29 #include <o3tl/typed_flags_set.hxx>
31 namespace com::sun::star::embed
{ class XStorage
; }
32 namespace com::sun::star::frame
{ class XModel
; }
33 namespace com::sun::star::io
{ class XInputStream
; }
34 namespace com::sun::star::io
{ class XStream
; }
37 enum class AVMediaSetMask
54 template<> struct typed_flags
<AVMediaSetMask
> : is_typed_flags
<AVMediaSetMask
, 0x3ff> {};
68 class AVMEDIA_DLLPUBLIC MediaItem final
: public SfxPoolItem
71 static SfxPoolItem
* CreateDefault();
73 explicit MediaItem( sal_uInt16 i_nWhich
= 0,
74 AVMediaSetMask nMaskSet
= AVMediaSetMask::NONE
);
75 MediaItem( const MediaItem
& rMediaItem
);
76 virtual ~MediaItem() override
;
78 virtual bool operator==( const SfxPoolItem
& ) const override
;
79 virtual MediaItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
80 virtual bool GetPresentation( SfxItemPresentation ePres
,
84 const IntlWrapper
& rIntl
) const override
;
85 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
86 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
88 void merge( const MediaItem
& rMediaItem
);
90 AVMediaSetMask
getMaskSet() const;
92 void setState( MediaState eState
);
93 MediaState
getState() const;
95 void setDuration( double fDuration
);
96 double getDuration() const;
98 void setTime( double fTime
);
99 double getTime() const;
101 void setLoop( bool bLoop
);
104 void setMute( bool bMute
);
107 void setVolumeDB( sal_Int16 nDB
);
108 sal_Int16
getVolumeDB() const;
110 void setZoom( ::css::media::ZoomLevel eZoom
);
111 ::css::media::ZoomLevel
getZoom() const;
113 void setURL( const OUString
& rURL
,
114 const OUString
& rTempURL
,
115 const OUString
& rReferer
);
116 const OUString
& getURL() const;
118 void setMimeType( const OUString
& rMimeType
);
119 OUString
getMimeType() const;
120 void setGraphic(const Graphic
& rGraphic
);
121 Graphic
getGraphic() const;
122 const OUString
& getTempURL() const;
124 const OUString
& getReferer() const;
129 std::unique_ptr
<Impl
> m_pImpl
;
132 typedef ::avmedia::MediaItem avmedia_MediaItem
;
134 bool AVMEDIA_DLLPUBLIC
EmbedMedia(
135 const ::css::uno::Reference
< ::css::frame::XModel
>& xModel
,
136 const OUString
& rSourceURL
,
137 OUString
& o_rEmbeddedURL
,
138 ::css::uno::Reference
<::css::io::XInputStream
> const& xInputStream
=
139 ::css::uno::Reference
<::css::io::XInputStream
>());
141 bool AVMEDIA_DLLPUBLIC
CreateMediaTempFile(
142 ::css::uno::Reference
<::css::io::XInputStream
> const& xInStream
,
143 OUString
& o_rTempFileURL
,
144 std::u16string_view rDesiredExtension
);
146 OUString
GetFilename(OUString
const& rSourceURL
);
148 ::css::uno::Reference
< ::css::io::XStream
> CreateStream(
149 const ::css::uno::Reference
< ::css::embed::XStorage
>& xStorage
, const OUString
& rFilename
);
151 struct AVMEDIA_DLLPUBLIC MediaTempFile
153 OUString
const m_TempFileURL
;
154 MediaTempFile(OUString
const& rURL
)
155 : m_TempFileURL(rURL
)
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */