LibreOffice Module avmedia (master) 1
mediawindow_impl.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 <vcl/transfer.hxx>
23#include <vcl/syschild.hxx>
24
25#include <mediacontrol.hxx>
26
27namespace com::sun::star::media {
28 class XPlayer;
29 class XPlayerWindow;
30}
31
32namespace com::sun::star::uno {
33 class XComponentContext;
34}
35
36class BitmapEx;
37
38namespace avmedia
39{
40
41class MediaWindow;
42
43namespace priv
44{
45
47{
48public:
49
50 explicit MediaWindowControl( vcl::Window* pParent );
51
52protected:
53
54 void update() override;
55 void execute( const MediaItem& rItem ) override;
56};
57
59{
60public:
61
62 explicit MediaChildWindow( vcl::Window* pParent );
63
64protected:
65
66 virtual void MouseMove( const MouseEvent& rMEvt ) override;
67 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
68 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
69 virtual void KeyInput( const KeyEvent& rKEvt ) override;
70 virtual void KeyUp( const KeyEvent& rKEvt ) override;
71 virtual void Command( const CommandEvent& rCEvt ) override;
72};
73
75
76class MediaWindowImpl : public Control, public DropTargetHelper, public DragSourceHelper
77{
78public:
79 MediaWindowImpl(vcl::Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl);
80 virtual ~MediaWindowImpl() override;
81
82 virtual void dispose() override;
83
84 static css::uno::Reference<css::media::XPlayer> createPlayer(const OUString& rURL, const OUString& rReferer, const OUString* pMimeType);
85
86 void setURL(const OUString& rURL, OUString const& rTempURL, OUString const& rReferer);
87
88 const OUString& getURL() const;
89
90 bool isValid() const;
91
92 Size getPreferredSize() const;
93
94 bool start();
95
96 void updateMediaItem( MediaItem& rItem ) const;
97 void executeMediaItem( const MediaItem& rItem );
98
99 void setPosSize( const tools::Rectangle& rRect );
100
101 void setPointer( PointerStyle nPointer );
102
103private:
104
105 // Window
106 virtual void MouseMove( const MouseEvent& rMEvt ) override;
107 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
108 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
109 virtual void KeyInput( const KeyEvent& rKEvt ) override;
110 virtual void KeyUp( const KeyEvent& rKEvt ) override;
111 virtual void Command( const CommandEvent& rCEvt ) override;
112 virtual void Resize() override;
113 virtual void StateChanged( StateChangedType ) override;
114 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; // const
115 virtual void GetFocus() override;
116
117 // DropTargetHelper
118 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
119 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
120
121 // DragSourceHelper
122 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
123
124 void stop();
125
126 bool isPlaying() const;
127
128 double getDuration() const;
129
130 void setMediaTime( double fTime );
131 double getMediaTime() const;
132
133 void stopPlayingInternal( bool );
134
135 void onURLChanged();
136
137 static css::uno::Reference<css::media::XPlayer> createPlayer(const OUString& rURL, const OUString& rManagerServName,
138 const css::uno::Reference<css::uno::XComponentContext>& xContext);
139
140 OUString maFileURL;
141 OUString mTempFileURL;
142 OUString maReferer;
143 OUString m_sMimeType;
144 css::uno::Reference<css::media::XPlayer> mxPlayer;
145 css::uno::Reference<css::media::XPlayerWindow> mxPlayerWindow;
147
151 std::unique_ptr<BitmapEx> mpEmptyBmpEx;
152 std::unique_ptr<BitmapEx> mpAudioBmpEx;
153 const MediaItem* mpItem = nullptr;
154};
155
156}} // end namespace avmedia::priv
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Command(const CommandEvent &rCEvt) override
virtual void MouseMove(const MouseEvent &rMEvt) override
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
MediaChildWindow(vcl::Window *pParent)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void KeyUp(const KeyEvent &rKEvt) override
virtual void KeyInput(const KeyEvent &rKEvt) override
void execute(const MediaItem &rItem) override
MediaWindowControl(vcl::Window *pParent)
void updateMediaItem(MediaItem &rItem) const
void executeMediaItem(const MediaItem &rItem)
virtual void MouseMove(const MouseEvent &rMEvt) override
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
std::unique_ptr< BitmapEx > mpEmptyBmpEx
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
css::uno::Reference< css::media::XPlayer > mxPlayer
VclPtr< MediaWindowControl > mpMediaWindowControl
std::unique_ptr< BitmapEx > mpAudioBmpEx
virtual void KeyUp(const KeyEvent &rKEvt) override
virtual void KeyInput(const KeyEvent &rKEvt) override
static css::uno::Reference< css::media::XPlayer > createPlayer(const OUString &rURL, const OUString &rReferer, const OUString *pMimeType)
void setPosSize(const tools::Rectangle &rRect)
MediaWindowImpl(vcl::Window *parent, MediaWindow *pMediaWindow, bool bInternalMediaControl)
void setPointer(PointerStyle nPointer)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
virtual void dispose() override
virtual void Command(const CommandEvent &rCEvt) override
const OUString & getURL() const
virtual void StateChanged(StateChangedType) override
VclPtr< MediaChildWindow > mpChildWindow
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
rtl::Reference< MediaEventListenersImpl > mxEvents
virtual void GetFocus() override
static css::uno::Reference< css::media::XPlayer > createPlayer(const OUString &rURL, const OUString &rManagerServName, const css::uno::Reference< css::uno::XComponentContext > &xContext)
css::uno::Reference< css::media::XPlayerWindow > mxPlayerWindow
void setURL(const OUString &rURL, OUString const &rTempURL, OUString const &rReferer)
virtual void Resize() override
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
PointerStyle
signed char sal_Int8
StateChangedType