tdf#133718 Add accelerator keys to Hyperlink dialog tabs
[LibreOffice.git] / include / avmedia / mediaitem.hxx
blob7246c9e7e2a1b87ae57bb8d6601d712151f4dc8d
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 <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; }
36 enum class AVMediaSetMask
38 NONE = 0x000,
39 STATE = 0x001,
40 DURATION = 0x002,
41 TIME = 0x004,
42 LOOP = 0x008,
43 MUTE = 0x010,
44 VOLUMEDB = 0x020,
45 ZOOM = 0x040,
46 URL = 0x080,
47 MIME_TYPE = 0x100,
48 ALL = 0x1ff,
50 namespace o3tl
52 template<> struct typed_flags<AVMediaSetMask> : is_typed_flags<AVMediaSetMask, 0x1ff> {};
56 namespace avmedia
60 enum class MediaState
62 Stop, Play, Pause
66 class AVMEDIA_DLLPUBLIC MediaItem final : public SfxPoolItem
68 public:
69 static SfxPoolItem* CreateDefault();
71 explicit MediaItem( sal_uInt16 i_nWhich = 0,
72 AVMediaSetMask nMaskSet = AVMediaSetMask::NONE );
73 MediaItem( const MediaItem& rMediaItem );
74 virtual ~MediaItem() override;
76 virtual bool operator==( const SfxPoolItem& ) const override;
77 virtual MediaItem* Clone( SfxItemPool* pPool = nullptr ) const override;
78 virtual bool GetPresentation( SfxItemPresentation ePres,
79 MapUnit eCoreUnit,
80 MapUnit ePresUnit,
81 OUString& rText,
82 const IntlWrapper& rIntl ) const override;
83 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
84 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
86 void merge( const MediaItem& rMediaItem );
88 AVMediaSetMask getMaskSet() const;
90 void setState( MediaState eState );
91 MediaState getState() const;
93 void setDuration( double fDuration );
94 double getDuration() const;
96 void setTime( double fTime );
97 double getTime() const;
99 void setLoop( bool bLoop );
100 bool isLoop() const;
102 void setMute( bool bMute );
103 bool isMute() const;
105 void setVolumeDB( sal_Int16 nDB );
106 sal_Int16 getVolumeDB() const;
108 void setZoom( ::css::media::ZoomLevel eZoom );
109 ::css::media::ZoomLevel getZoom() const;
111 void setURL( const OUString& rURL,
112 const OUString& rTempURL,
113 const OUString& rReferer);
114 const OUString& getURL() const;
116 void setMimeType( const OUString& rMimeType );
117 OUString getMimeType() const;
118 const OUString& getTempURL() const;
120 const OUString& getReferer() const;
122 private:
124 struct Impl;
125 std::unique_ptr<Impl> m_pImpl;
128 typedef ::avmedia::MediaItem avmedia_MediaItem;
130 bool AVMEDIA_DLLPUBLIC EmbedMedia(
131 const ::css::uno::Reference< ::css::frame::XModel>& xModel,
132 const OUString& rSourceURL,
133 OUString & o_rEmbeddedURL,
134 ::css::uno::Reference<::css::io::XInputStream> const& xInputStream =
135 ::css::uno::Reference<::css::io::XInputStream>());
137 bool AVMEDIA_DLLPUBLIC CreateMediaTempFile(
138 ::css::uno::Reference<::css::io::XInputStream> const& xInStream,
139 OUString& o_rTempFileURL,
140 std::u16string_view rDesiredExtension);
142 OUString GetFilename(OUString const& rSourceURL);
144 ::css::uno::Reference< ::css::io::XStream> CreateStream(
145 const ::css::uno::Reference< ::css::embed::XStorage>& xStorage, const OUString& rFilename);
147 struct AVMEDIA_DLLPUBLIC MediaTempFile
149 OUString const m_TempFileURL;
150 MediaTempFile(OUString const& rURL)
151 : m_TempFileURL(rURL)
153 ~MediaTempFile();
158 #endif
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */