LibreOffice Module slideshow (master) 1
externalshapebase.cxx
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
21// must be first
23
24#include "externalshapebase.hxx"
25#include <eventmultiplexer.hxx>
27#include <vieweventhandler.hxx>
29#include <tools.hxx>
30
31
32using namespace ::com::sun::star;
33
34
35namespace slideshow::internal
36{
39 {
40 public:
42 mrBase( rBase )
43 {}
46
47 private:
48 // ViewEventHandler
49
50
51 virtual void viewAdded( const UnoViewSharedPtr& ) override {}
52 virtual void viewRemoved( const UnoViewSharedPtr& ) override {}
53 virtual void viewChanged( const UnoViewSharedPtr& rView ) override
54 {
56 }
57 virtual void viewsChanged() override
58 {
60 }
61
62
63 // IntrinsicAnimationEventHandler
64
65
66 virtual bool enableAnimations() override
67 {
69 }
70 virtual bool disableAnimations() override
71 {
73 }
74
76 };
77
78
80 double nPrio,
81 const SlideShowContext& rContext ) :
83 mxShape( xShape ),
87 mnPriority( nPrio ), // TODO(F1): When ZOrder someday becomes usable: make this ( getAPIShapePrio( xShape ) ),
88 maBounds( getAPIShapeBounds( xShape ) )
89 {
90 ENSURE_OR_THROW( mxShape.is(), "ExternalShapeBase::ExternalShapeBase(): Invalid XShape" );
91
92 mpShapeManager->addIntrinsicAnimationHandler( mpListener );
94 }
95
96
98 {
99 try
100 {
102 mpShapeManager->removeIntrinsicAnimationHandler( mpListener );
103 }
104 catch (uno::Exception &)
105 {
106 TOOLS_WARN_EXCEPTION( "slideshow", "" );
107 }
108 }
109
110
112 {
113 return mxShape;
114 }
115
116
118 {
120 }
121
122
124 {
126 }
127
128
130 {
132 }
133
134
136 {
138 }
139
140
142 {
144 }
145
146 void ExternalShapeBase::setLooping(bool bLooping) { implSetLooping(bLooping); }
147
149 {
150 return render();
151 }
152
153
155 {
156 if( maBounds.getRange().equalZero() )
157 {
158 // zero-sized shapes are effectively invisible,
159 // thus, we save us the rendering...
160 return true;
161 }
162
163 return implRender( maBounds );
164 }
165
166
168 {
169 return true;
170 }
171
172
174 {
175 return maBounds;
176 }
177
178
180 {
181 return maBounds;
182 }
183
184
186 {
187 return maBounds;
188 }
189
190
192 {
193 return true;
194 }
195
196
198 {
199 return mnPriority;
200 }
201
202
204 {
205 // external shapes always have their own window/surface
206 return true;
207 }
208
209}
210
211/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
ShapeManagerSharedPtr mpShapeManager
::basegfx::B2DRectangle maBounds
B2DVector getRange() const
bool equalZero() const
void removeViewHandler(const ViewEventHandlerWeakPtr &rHandler)
void addViewHandler(const ViewEventHandlerWeakPtr &rHandler)
Register an event handler that will be called when views are changed.
virtual void viewRemoved(const UnoViewSharedPtr &) override
Notify removed view.
virtual void viewChanged(const UnoViewSharedPtr &rView) override
Notify changed view.
ExternalShapeBaseListener & operator=(const ExternalShapeBaseListener &)=delete
virtual void viewsChanged() override
Notify that all views changed.
ExternalShapeBaseListener(const ExternalShapeBaseListener &)=delete
virtual void viewAdded(const UnoViewSharedPtr &) override
Notify new view.
Base class for shapes rendered by external engines.
virtual bool update() const override
Update the shape.
virtual ::basegfx::B2DRectangle getUpdateArea() const override
Get the current shape update area.
virtual void stop() override
Notify the Shape that it should stop playback.
SubsettableShapeManagerSharedPtr mpShapeManager
virtual bool implStartIntrinsicAnimation()=0
override in derived class to start external viewer
css::uno::Reference< css::drawing::XShape > mxShape
The associated XShape.
virtual void implPauseIntrinsicAnimation()=0
override in derived class to pause external viewer
virtual ::basegfx::B2DRectangle getBounds() const override
Get the current shape position and size.
void setLooping(bool bLooping) override
ExternalShapeBase(const css::uno::Reference< css::drawing::XShape > &xShape, double nPrio, const SlideShowContext &rContext)
Create a shape for the given XShape for an external shape.
virtual bool implEndIntrinsicAnimation()=0
override in derived class to stop external viewer
virtual void setMediaTime(double) override
Set media time in seconds.
virtual bool isPlaying() const override
Query whether the media is currently playing.
virtual css::uno::Reference< css::drawing::XShape > getXShape() const override
Get the associated XShape of this shape.
virtual bool isContentChanged() const override
Query whether shape content changed.
virtual bool isVisible() const override
Query whether the shape is visible at all.
virtual void implViewChanged(const UnoViewSharedPtr &rView)=0
override in derived class to resize
virtual void implSetIntrinsicAnimationTime(double)=0
override in derived class to set media time
virtual ::basegfx::B2DRectangle getDomBounds() const override
Get the DOM position and size of the shape.
virtual bool implIsIntrinsicAnimationPlaying() const =0
override in derived class to return status of animation
std::shared_ptr< ExternalShapeBaseListener > mpListener
virtual bool render() const override
Render the shape.
virtual void pause() override
Notify the Shape that it should pause playback.
virtual void implViewsChanged()=0
override in derived class to resize
virtual bool implRender(const ::basegfx::B2DRange &rCurrBounds) const =0
override in derived class to render preview
virtual double getPriority() const override
Get the shape priority.
virtual void play() override
Notify the Shape that it should start with playback.
virtual bool isBackgroundDetached() const override
Query whether the Shape is currently detached from the background.
Interface for handling intrinsic animation display modes.
Interface for handling view events.
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ENSURE_OR_THROW(c, m)
IntrinsicAnimationEventHandlerSharedPtr mpListener
std::shared_ptr< T > make_shared(Args &&... args)
::basegfx::B2DRectangle getAPIShapeBounds(const uno::Reference< drawing::XShape > &xShape)
Definition: tools.cxx:718
std::shared_ptr< UnoView > UnoViewSharedPtr
uno::Reference< drawing::XShape > const mxShape
std::shared_ptr< SubsettableShapeManager > mpSubsettableShapeManager
Definition: slideimpl.cxx:199
EventMultiplexer & mrEventMultiplexer
Definition: slideview.cxx:728
double mnPriority
Definition: slideview.cxx:86
Common arguments for slideshow objects.