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_MEDIAWINDOW_HXX
21 #define INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
24 #include <tools/gen.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <vcl/vclptr.hxx>
27 #include <avmedia/avmediadllapi.h>
29 #define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
31 namespace com::sun::star::graphic
{ class XGraphic
; }
32 namespace com::sun::star::media
{ class XPlayer
; }
34 namespace vcl
{ class Window
; }
35 namespace weld
{ class Window
; }
39 struct AcceptDropEvent
;
40 struct ExecuteDropEvent
;
41 enum class PointerStyle
;
46 typedef ::std::vector
< ::std::pair
< OUString
, OUString
> > FilterNameVector
;
50 namespace priv
{ class MediaWindowImpl
; }
52 class AVMEDIA_DLLPUBLIC MediaWindow
55 MediaWindow( vcl::Window
* parent
, bool bInternalMediaControl
);
56 virtual ~MediaWindow();
58 void setURL( const OUString
& rURL
, const OUString
& rReferer
);
59 const OUString
& getURL() const;
62 Size
getPreferredSize() const;
64 vcl::Window
* getWindow() const;
66 void setPosSize( const tools::Rectangle
& rNewRect
);
68 void setPointer( PointerStyle aPointer
);
72 void updateMediaItem( MediaItem
& rItem
) const;
73 void executeMediaItem( const MediaItem
& rItem
);
80 virtual void MouseMove( const MouseEvent
& rMEvt
);
81 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
82 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
84 virtual void KeyInput( const KeyEvent
& rKEvt
);
85 virtual void KeyUp( const KeyEvent
& rKEvt
);
87 virtual void Command( const CommandEvent
& rCEvt
);
89 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
90 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
92 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
96 static FilterNameVector
getMediaFilters();
97 /// @param o_pbLink if not 0, this is an "insert" dialog: display link
98 /// checkbox and store its state in *o_pbLink
99 static bool executeMediaURLDialog(weld::Window
* pParent
, OUString
& rURL
, bool *const o_pbLink
);
100 static void executeFormatErrorBox(weld::Window
* pParent
);
101 static bool isMediaURL( const OUString
& rURL
, const OUString
& rReferer
, bool bDeep
= false, Size
* pPreferredSizePixel
= nullptr );
103 static css::uno::Reference
< css::media::XPlayer
> createPlayer( const OUString
& rURL
, const OUString
& rReferer
, const OUString
* pMimeType
= nullptr );
105 static css::uno::Reference
< css::graphic::XGraphic
> grabFrame( const OUString
& rURL
, const OUString
& rReferer
,
106 const OUString
& sMimeType
);
109 MediaWindow(const MediaWindow
&) = delete;
110 MediaWindow
& operator =( const MediaWindow
& ) = delete;
112 VclPtr
<priv::MediaWindowImpl
> mpImpl
;
116 #endif // INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */