Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / avmedia / mediawindow.hxx
blobe20d740ddf382bcbbdeea08c9ffe6f99e99b0de2
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_MEDIAWINDOW_HXX
21 #define INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
23 #include <memory>
24 #include <vector>
25 #include <tools/gen.hxx>
26 #include <com/sun/star/media/ZoomLevel.hpp>
27 #include <com/sun/star/media/XPlayer.hpp>
28 #include <com/sun/star/graphic/XGraphic.hpp>
29 #include <com/sun/star/uno/XInterface.hpp>
30 #include <vcl/bitmapex.hxx>
31 #include <vcl/vclptr.hxx>
32 #include <avmedia/avmediadllapi.h>
34 #define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
36 namespace vcl { class Window; }
37 class KeyEvent;
38 class MouseEvent;
39 class CommandEvent;
40 class PopupMenu;
41 class Pointer;
42 struct AcceptDropEvent;
43 struct ExecuteDropEvent;
46 namespace avmedia
48 typedef ::std::vector< ::std::pair< OUString, OUString > > FilterNameVector;
50 class MediaItem;
52 namespace priv { class MediaWindowImpl; }
54 class AVMEDIA_DLLPUBLIC MediaWindow
56 public:
57 MediaWindow( vcl::Window* parent, bool bInternalMediaControl );
58 virtual ~MediaWindow();
60 void setURL( const OUString& rURL, const OUString& rReferer );
61 const OUString& getURL() const;
63 bool isValid() const;
64 Size getPreferredSize() const;
66 vcl::Window* getWindow() const;
68 void setPosSize( const Rectangle& rNewRect );
70 void setPointer( const Pointer& rPointer );
72 bool start();
74 void updateMediaItem( MediaItem& rItem ) const;
75 void executeMediaItem( const MediaItem& rItem );
77 void show();
78 void hide();
80 public:
82 virtual void MouseMove( const MouseEvent& rMEvt );
83 virtual void MouseButtonDown( const MouseEvent& rMEvt );
84 virtual void MouseButtonUp( const MouseEvent& rMEvt );
86 virtual void KeyInput( const KeyEvent& rKEvt );
87 virtual void KeyUp( const KeyEvent& rKEvt );
89 virtual void Command( const CommandEvent& rCEvt );
91 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
92 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
94 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
96 public:
98 static void getMediaFilters( FilterNameVector& rFilterNameVector );
99 /// @param o_pbLink if not 0, this is an "insert" dialog: display link
100 /// checkbox and store its state in *o_pbLink
101 static bool executeMediaURLDialog( vcl::Window* pParent,
102 OUString& rURL, bool *const o_pbLink );
103 static void executeFormatErrorBox( vcl::Window* pParent );
104 static bool isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep = false, Size* pPreferredSizePixel = nullptr );
106 static css::uno::Reference< css::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr );
108 static css::uno::Reference< css::graphic::XGraphic > grabFrame( const OUString& rURL, const OUString& rReferer,
109 const OUString& sMimeType );
111 static BitmapEx getAudioLogo();
112 static BitmapEx getEmptyLogo();
114 private:
115 MediaWindow(const MediaWindow&) = delete;
116 MediaWindow& operator =( const MediaWindow& ) = delete;
118 VclPtr<priv::MediaWindowImpl> mpImpl;
122 #endif // INCLUDED_AVMEDIA_MEDIAWINDOW_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */