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 .
22 #include <svl/poolitem.hxx>
23 #include <com/sun/star/media/ZoomLevel.hpp>
24 #include <avmedia/avmediadllapi.h>
26 #include <string_view>
28 #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
; }
35 namespace com::sun::star::text
{ struct GraphicCrop
; }
38 enum class AVMediaSetMask
56 template<> struct typed_flags
<AVMediaSetMask
> : is_typed_flags
<AVMediaSetMask
, 0x7ff> {};
70 class AVMEDIA_DLLPUBLIC MediaItem final
: public SfxPoolItem
73 static SfxPoolItem
* CreateDefault();
75 explicit MediaItem( sal_uInt16 i_nWhich
= 0,
76 AVMediaSetMask nMaskSet
= AVMediaSetMask::NONE
);
77 MediaItem( const MediaItem
& rMediaItem
);
78 virtual ~MediaItem() override
;
80 virtual bool operator==( const SfxPoolItem
& ) const override
;
81 virtual MediaItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
82 virtual bool GetPresentation( SfxItemPresentation ePres
,
86 const IntlWrapper
& rIntl
) const override
;
87 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
88 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
90 bool merge(const MediaItem
& rMediaItem
);
92 AVMediaSetMask
getMaskSet() const;
94 bool setState(MediaState eState
);
95 MediaState
getState() const;
97 bool setDuration(double fDuration
);
98 double getDuration() const;
100 bool setTime(double fTime
);
101 double getTime() const;
103 bool setLoop(bool bLoop
);
106 bool setMute(bool bMute
);
109 bool setVolumeDB(sal_Int16 nDB
);
110 sal_Int16
getVolumeDB() const;
112 bool setZoom(css::media::ZoomLevel eZoom
);
113 ::css::media::ZoomLevel
getZoom() const;
115 bool setURL(const OUString
& rURL
,
116 const OUString
& rTempURL
,
117 const OUString
& rReferer
);
118 const OUString
& getURL() const;
120 bool setMimeType(const OUString
& rMimeType
);
121 OUString
getMimeType() const;
122 bool setGraphic(const Graphic
& rGraphic
);
123 const Graphic
& getGraphic() const;
124 bool setCrop(const css::text::GraphicCrop
& rCrop
);
125 const css::text::GraphicCrop
& getCrop() const;
126 const OUString
& getTempURL() const;
128 const OUString
& getReferer() const;
133 std::unique_ptr
<Impl
> m_pImpl
;
136 typedef ::avmedia::MediaItem avmedia_MediaItem
;
138 bool AVMEDIA_DLLPUBLIC
EmbedMedia(
139 const ::css::uno::Reference
< ::css::frame::XModel
>& xModel
,
140 const OUString
& rSourceURL
,
141 OUString
& o_rEmbeddedURL
,
142 ::css::uno::Reference
<::css::io::XInputStream
> const& xInputStream
=
143 ::css::uno::Reference
<::css::io::XInputStream
>());
145 bool AVMEDIA_DLLPUBLIC
CreateMediaTempFile(
146 ::css::uno::Reference
<::css::io::XInputStream
> const& xInStream
,
147 OUString
& o_rTempFileURL
,
148 std::u16string_view rDesiredExtension
);
150 OUString
GetFilename(OUString
const& rSourceURL
);
152 ::css::uno::Reference
< ::css::io::XStream
> CreateStream(
153 const ::css::uno::Reference
< ::css::embed::XStorage
>& xStorage
, const OUString
& rFilename
);
155 struct AVMEDIA_DLLPUBLIC MediaTempFile
157 OUString
const m_TempFileURL
;
158 MediaTempFile(OUString aURL
)
159 : m_TempFileURL(std::move(aURL
))
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */