LibreOffice Module avmedia (master) 1
mediaitem.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <svl/poolitem.hxx>
23#include <com/sun/star/media/ZoomLevel.hpp>
25#include <memory>
26#include <string_view>
27
29#include <utility>
30
31namespace com::sun::star::embed { class XStorage; }
32namespace com::sun::star::frame { class XModel; }
33namespace com::sun::star::io { class XInputStream; }
34namespace com::sun::star::io { class XStream; }
35namespace com::sun::star::text { struct GraphicCrop; }
36class Graphic;
37
39{
40 NONE = 0x000,
41 STATE = 0x001,
42 DURATION = 0x002,
43 TIME = 0x004,
44 LOOP = 0x008,
45 MUTE = 0x010,
46 VOLUMEDB = 0x020,
47 ZOOM = 0x040,
48 URL = 0x080,
49 MIME_TYPE = 0x100,
50 GRAPHIC = 0x200,
51 CROP = 0x400,
52 ALL = 0x7ff,
53};
54namespace o3tl
55{
56 template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x7ff> {};
57}
58
59
60namespace avmedia
61{
62
63
64enum class MediaState
65{
67};
68
69
71{
72public:
73 static SfxPoolItem* CreateDefault();
74
75 explicit MediaItem( sal_uInt16 i_nWhich = 0,
77 MediaItem( const MediaItem& rMediaItem );
78 virtual ~MediaItem() override;
79
80 virtual bool operator==( const SfxPoolItem& ) const override;
81 virtual MediaItem* Clone( SfxItemPool* pPool = nullptr ) const override;
82 virtual bool GetPresentation( SfxItemPresentation ePres,
83 MapUnit eCoreUnit,
84 MapUnit ePresUnit,
85 OUString& rText,
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;
89
90 bool merge(const MediaItem& rMediaItem);
91
92 AVMediaSetMask getMaskSet() const;
93
94 bool setState(MediaState eState);
95 MediaState getState() const;
96
97 bool setDuration(double fDuration);
98 double getDuration() const;
99
100 bool setTime(double fTime);
101 double getTime() const;
102
103 bool setLoop(bool bLoop);
104 bool isLoop() const;
105
106 bool setMute(bool bMute);
107 bool isMute() const;
108
109 bool setVolumeDB(sal_Int16 nDB);
110 sal_Int16 getVolumeDB() const;
111
112 bool setZoom(css::media::ZoomLevel eZoom);
113 ::css::media::ZoomLevel getZoom() const;
114
115 bool setURL(const OUString& rURL,
116 const OUString& rTempURL,
117 const OUString& rReferer);
118 const OUString& getURL() const;
119
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;
127
128 const OUString& getReferer() const;
129
130private:
131
132 struct Impl;
133 std::unique_ptr<Impl> m_pImpl;
134};
135
137
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>());
144
146 ::css::uno::Reference<::css::io::XInputStream> const& xInStream,
147 OUString& o_rTempFileURL,
148 std::u16string_view rDesiredExtension);
149
150OUString GetFilename(OUString const& rSourceURL);
151
152::css::uno::Reference< ::css::io::XStream> CreateStream(
153 const ::css::uno::Reference< ::css::embed::XStorage>& xStorage, const OUString& rFilename);
154
156{
157 OUString const m_TempFileURL;
158 MediaTempFile(OUString aURL)
159 : m_TempFileURL(std::move(aURL))
160 {}
162};
163
164}
165
166/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define AVMEDIA_DLLPUBLIC
Definition: avmediadllapi.h:27
std::unique_ptr< Impl > m_pImpl
Definition: mediaitem.hxx:132
URL aURL
aCursorMoveIdle Stop()
STATE
MapUnit
AVMediaSetMask
Definition: mediaitem.hxx:39
NONE
bool EmbedMedia(uno::Reference< frame::XModel > const &xModel, OUString const &rSourceURL, OUString &o_rEmbeddedURL, uno::Reference< io::XInputStream > const &xInputStream)
Definition: mediaitem.cxx:462
::avmedia::MediaItem avmedia_MediaItem
Definition: mediaitem.hxx:136
OUString GetFilename(OUString const &rSourceURL)
Definition: mediaitem.cxx:395
uno::Reference< io::XStream > CreateStream(uno::Reference< embed::XStorage > const &xStorage, OUString const &rFilename)
Definition: mediaitem.cxx:421
bool CreateMediaTempFile(uno::Reference< io::XInputStream > const &xInStream, OUString &o_rTempFileURL, std::u16string_view rDesiredExtension)
Definition: mediaitem.cxx:523
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
SfxItemPresentation
MediaTempFile(OUString aURL)
Definition: mediaitem.hxx:158
OUString const m_TempFileURL
Definition: mediaitem.hxx:157
LOOP
unsigned char sal_uInt8
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)