tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / slideshow / source / engine / shapes / viewmediashape.hxx
blob34be8536b73be669464c5eaa444c001f09065e43
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_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWMEDIASHAPE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWMEDIASHAPE_HXX
23 #include <basegfx/range/b2drectangle.hxx>
24 #include <com/sun/star/awt/Point.hpp>
25 #include <com/sun/star/drawing/XShape.hpp>
27 #include <memory>
28 #include <vcl/vclptr.hxx>
30 #include <viewlayer.hxx>
32 class SystemChildWindow;
34 namespace com::sun::star {
35 namespace drawing {
36 class XShape;
38 namespace media {
39 class XPlayer;
40 class XPlayerWindow;
42 namespace uno {
43 class XComponentContext;
45 namespace beans{
46 class XPropertySet;
50 namespace slideshow::internal
52 /** This class is the viewable representation of a draw
53 document's media object, associated to a specific View
55 The class is able to render the associated media shape on
56 View implementations.
58 class ViewMediaShape final
60 public:
61 /** Create a ViewMediaShape for the given View
63 @param rView
64 The associated View object.
66 ViewMediaShape( const ViewLayerSharedPtr& rViewLayer,
67 css::uno::Reference< css::drawing::XShape > xShape,
68 css::uno::Reference< css::uno::XComponentContext > xContext,
69 const OUString& aFallbackDir );
71 /** destroy the object
73 ~ViewMediaShape();
75 /// Forbid copy construction
76 ViewMediaShape(const ViewMediaShape&) = delete;
77 /// Forbid copy assignment
78 ViewMediaShape& operator=(const ViewMediaShape&) = delete;
80 /** Query the associated view layer of this shape
82 const ViewLayerSharedPtr& getViewLayer() const;
84 // animation methods
87 /** Notify the ViewShape that an animation starts now
89 This method enters animation mode on the associate
90 target view. The shape can be animated in parallel on
91 different views.
93 void startMedia();
95 /** Notify the ViewShape that it is no longer animated
97 This methods ends animation mode on the associate
98 target view
100 void endMedia();
102 /** Notify the ViewShape that it should pause playback
104 This methods pauses animation on the associate
105 target view. The content stays visible (for video)
107 void pauseMedia();
109 /** Set current time of media.
111 @param fTime
112 Local media time that should now be presented, in seconds.
114 void setMediaTime(double fTime);
116 void setLooping(bool bLooping);
118 // render methods
121 /** Render the ViewShape
123 This method renders the ViewMediaShape on the associated view.
125 @param rBounds
126 The current media shape bounds
128 @return whether the rendering finished successfully.
130 bool render( const ::basegfx::B2DRectangle& rBounds ) const;
132 /** Resize the ViewShape
134 This method updates the ViewMediaShape size on the
135 associated view. It does not render.
137 @param rBounds
138 The current media shape bounds
140 @return whether the resize finished successfully.
142 bool resize( const ::basegfx::B2DRectangle& rNewBounds ) const;
144 private:
146 bool implInitialize( const ::basegfx::B2DRectangle& rBounds );
147 void implSetMediaProperties( const css::uno::Reference< css::beans::XPropertySet >& rxProps );
148 void implInitializeMediaPlayer( const OUString& rMediaURL, const OUString& rMimeType );
149 void implInitializePlayerWindow( const ::basegfx::B2DRectangle& rBounds,
150 const css::uno::Sequence< css::uno::Any >& rVCLDeviceParams );
151 ViewLayerSharedPtr mpViewLayer;
152 VclPtr< SystemChildWindow > mpMediaWindow;
153 mutable css::awt::Point maWindowOffset;
154 mutable ::basegfx::B2DRectangle maBounds;
156 css::uno::Reference< css::drawing::XShape > mxShape;
157 css::uno::Reference< css::media::XPlayer > mxPlayer;
158 css::uno::Reference< css::media::XPlayerWindow > mxPlayerWindow;
159 css::uno::Reference< css::uno::XComponentContext> mxComponentContext;
160 bool mbIsSoundEnabled;
161 OUString maFallbackDir;
164 typedef ::std::shared_ptr< ViewMediaShape > ViewMediaShapeSharedPtr;
168 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWMEDIASHAPE_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */