Update git submodules
[LibreOffice.git] / slideshow / source / engine / shapes / externalshapebase.hxx
blobd8c208db2a9944e2b0fdac29f1d62360b4ea3033
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_EXTERNALSHAPEBASE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_EXTERNALSHAPEBASE_HXX
23 #include <iexternalmediashapebase.hxx>
24 #include <unoview.hxx>
25 #include <slideshowcontext.hxx>
28 namespace slideshow::internal
30 /** Base class for shapes rendered by external engines.
32 Used as the common base for e.g. MediaShape or
33 AppletShape, all of which are rendered by external
34 components (and all employ distinct windows).
36 Please note that this base class indeed assumes the shape
37 does not interfere with the internal shapes in any way
38 (including mutual overdraw). It therefore reports yes for
39 the isBackgroundDetached() question.
41 class ExternalShapeBase : public IExternalMediaShapeBase
43 public:
44 /** Create a shape for the given XShape for an external shape
46 @param xShape
47 The XShape to represent.
49 @param nPrio
50 Externally-determined shape priority (used e.g. for
51 paint ordering). This number _must be_ unique!
53 ExternalShapeBase( const css::uno::Reference< css::drawing::XShape >& xShape,
54 double nPrio,
55 const SlideShowContext& rContext ); // throw ShapeLoadFailedException;
56 virtual ~ExternalShapeBase() override;
58 virtual css::uno::Reference< css::drawing::XShape > getXShape() const override;
60 // animation methods
63 virtual void play() override;
64 virtual void stop() override;
65 virtual void pause() override;
66 virtual bool isPlaying() const override;
67 virtual void setMediaTime(double) override;
68 void setLooping(bool bLooping) override;
70 // render methods
73 virtual bool update() const override;
74 virtual bool render() const override;
75 virtual bool isContentChanged() const override;
78 // Shape attributes
81 virtual ::basegfx::B2DRectangle getBounds() const override;
82 virtual ::basegfx::B2DRectangle getDomBounds() const override;
83 virtual ::basegfx::B2DRectangle getUpdateArea() const override;
84 virtual bool isVisible() const override;
85 virtual double getPriority() const override;
86 virtual bool isBackgroundDetached() const override;
88 protected:
89 const css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
91 private:
92 class ExternalShapeBaseListener; friend class ExternalShapeBaseListener;
94 /// override in derived class to render preview
95 virtual bool implRender( const ::basegfx::B2DRange& rCurrBounds ) const = 0;
97 /// override in derived class to resize
98 virtual void implViewChanged( const UnoViewSharedPtr& rView ) = 0;
99 /// override in derived class to resize
100 virtual void implViewsChanged() = 0;
102 /// override in derived class to start external viewer
103 virtual bool implStartIntrinsicAnimation() = 0;
104 /// override in derived class to stop external viewer
105 virtual bool implEndIntrinsicAnimation() = 0;
106 /// override in derived class to pause external viewer
107 virtual void implPauseIntrinsicAnimation() = 0;
108 /// override in derived class to return status of animation
109 virtual bool implIsIntrinsicAnimationPlaying() const = 0;
110 /// override in derived class to set media time
111 virtual void implSetIntrinsicAnimationTime(double) = 0;
112 virtual void implSetLooping(bool /*bLooping*/) {}
115 /// The associated XShape
116 css::uno::Reference< css::drawing::XShape > mxShape;
118 std::shared_ptr<ExternalShapeBaseListener> mpListener;
120 SubsettableShapeManagerSharedPtr mpShapeManager;
121 EventMultiplexer& mrEventMultiplexer;
123 // The attributes of this Shape
124 const double mnPriority;
125 ::basegfx::B2DRectangle maBounds;
129 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_EXTERNALSHAPEBASE_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */