tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / avmedia / source / viewer / mediawindow_impl.hxx
blobbddda2665c562a2f87bb7504fe239bf055034e2e
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 #pragma once
22 #include <vcl/transfer.hxx>
23 #include <vcl/syschild.hxx>
25 #include <mediacontrol.hxx>
27 namespace com::sun::star::media {
28 class XPlayer;
29 class XPlayerWindow;
32 namespace com::sun::star::uno {
33 class XComponentContext;
36 class BitmapEx;
38 namespace avmedia
41 class MediaWindow;
43 namespace priv
46 class MediaWindowControl : public MediaControl
48 public:
50 explicit MediaWindowControl( vcl::Window* pParent );
52 protected:
54 void update() override;
55 void execute( const MediaItem& rItem ) override;
58 class MediaChildWindow : public SystemChildWindow
60 public:
62 explicit MediaChildWindow( vcl::Window* pParent );
64 protected:
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;
74 class MediaEventListenersImpl;
76 class MediaWindowImpl : public Control, public DropTargetHelper, public DragSourceHelper
78 public:
79 MediaWindowImpl(vcl::Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl);
80 virtual ~MediaWindowImpl() override;
82 virtual void dispose() override;
84 static css::uno::Reference<css::media::XPlayer> createPlayer(const OUString& rURL, const OUString& rReferer, const OUString* pMimeType);
86 void setURL(const OUString& rURL, OUString const& rTempURL, OUString const& rReferer);
88 const OUString& getURL() const;
90 void setFallbackURL(const OUString& rURL);
91 const OUString& getFallbackURL() const;
93 bool isValid() const;
95 Size getPreferredSize() const;
97 bool start();
99 void updateMediaItem( MediaItem& rItem ) const;
100 void executeMediaItem( const MediaItem& rItem );
102 void setPosSize( const tools::Rectangle& rRect );
104 void setPointer( PointerStyle nPointer );
106 private:
108 // Window
109 virtual void MouseMove( const MouseEvent& rMEvt ) override;
110 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
111 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
112 virtual void KeyInput( const KeyEvent& rKEvt ) override;
113 virtual void KeyUp( const KeyEvent& rKEvt ) override;
114 virtual void Command( const CommandEvent& rCEvt ) override;
115 virtual void Resize() override;
116 virtual void StateChanged( StateChangedType ) override;
117 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; // const
118 virtual void GetFocus() override;
120 // DropTargetHelper
121 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
122 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
124 // DragSourceHelper
125 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
127 void stop();
129 bool isPlaying() const;
131 double getDuration() const;
133 void setMediaTime( double fTime );
134 double getMediaTime() const;
136 void stopPlayingInternal( bool );
138 void onURLChanged();
140 static css::uno::Reference<css::media::XPlayer> createPlayer(const OUString& rURL, const OUString& rManagerServName,
141 const css::uno::Reference<css::uno::XComponentContext>& xContext);
143 OUString maFileURL;
144 OUString mTempFileURL;
145 OUString maFallbackFileURL;
146 OUString maReferer;
147 OUString m_sMimeType;
148 css::uno::Reference<css::media::XPlayer> mxPlayer;
149 css::uno::Reference<css::media::XPlayerWindow> mxPlayerWindow;
150 MediaWindow* mpMediaWindow;
152 rtl::Reference<MediaEventListenersImpl> mxEvents;
153 VclPtr<MediaChildWindow> mpChildWindow;
154 VclPtr<MediaWindowControl> mpMediaWindowControl;
155 std::unique_ptr<BitmapEx> mpEmptyBmpEx;
156 std::unique_ptr<BitmapEx> mpAudioBmpEx;
157 const MediaItem* mpItem = nullptr;
160 }} // end namespace avmedia::priv
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */