LibreOffice Module sd (master) 1
SlsAnimator.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
24#include <vcl/idle.hxx>
25#include <sal/types.h>
26#include <o3tl/deleter.hxx>
27
28#include <functional>
29#include <memory>
30#include <vector>
31
32namespace sd::slidesorter { class SlideSorter; }
33
35
39{
40public:
46
47 explicit Animator (SlideSorter& rSlideSorter);
48 ~Animator();
49 Animator(const Animator&) = delete;
50 Animator& operator=(const Animator&) = delete;
51
55 void Dispose();
56
60 typedef ::std::function<void (double)> AnimationFunctor;
61 typedef ::std::function<void ()> FinishFunctor;
62
63 typedef sal_Int32 AnimationId;
64 static const AnimationId NotAnAnimationId = -1;
65
73 const AnimationFunctor& rAnimation,
74 const FinishFunctor& rFinishFunctor);
75
81 void RemoveAnimation (const AnimationId nAnimationId);
82
88
89private:
93 class Animation;
94 typedef ::std::vector<std::shared_ptr<Animation> > AnimationList;
97
98 std::unique_ptr<view::SlideSorterView::DrawLock, o3tl::default_delete<view::SlideSorterView::DrawLock>> mpDrawLock;
99
101
102 DECL_LINK(TimeoutHandler, Timer *, void);
103
111 bool ProcessAnimations (const double nTime);
112
116
117 void RequestNextFrame();
118};
119
120} // end of namespace ::sd::slidesorter::controller
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
Handle one animation function by using a timer for frequent calls to the animations operator().
Definition: SlsAnimator.cxx:31
Experimental class for simple eye candy animations.
Definition: SlsAnimator.hxx:39
DECL_LINK(TimeoutHandler, Timer *, void)
Animator(SlideSorter &rSlideSorter)
Definition: SlsAnimator.cxx:61
std::unique_ptr< view::SlideSorterView::DrawLock, o3tl::default_delete< view::SlideSorterView::DrawLock > > mpDrawLock
Definition: SlsAnimator.hxx:98
void RemoveAnimation(const AnimationId nAnimationId)
Abort and remove an animation.
::std::function< void()> FinishFunctor
Definition: SlsAnimator.hxx:61
void RemoveAllAnimations()
A typical use case for this method is the temporary shutdown of the slidesorter when the slide sorter...
void Dispose()
When disposed the animator will stop its work immediately and not process any timer events anymore.
Definition: SlsAnimator.cxx:80
static const AnimationId NotAnAnimationId
Definition: SlsAnimator.hxx:64
bool ProcessAnimations(const double nTime)
Execute one step of every active animation.
AnimationId AddAnimation(const AnimationFunctor &rAnimation, const FinishFunctor &rFinishFunctor)
Schedule a new animation for execution.
Definition: SlsAnimator.cxx:96
::std::function< void(double)> AnimationFunctor
An animation object is called with values between 0 and 1 as single argument to its operator() method...
Definition: SlsAnimator.hxx:60
void CleanUpAnimationList()
Remove animations that have expired.
::std::vector< std::shared_ptr< Animation > > AnimationList
Definition: SlsAnimator.hxx:93
Animator(const Animator &)=delete
AnimationMode
In some circumstances we have to avoid animation and jump to the final animation state immediately.
Definition: SlsAnimator.hxx:45
Animator & operator=(const Animator &)=delete
::canvas::tools::ElapsedTime maElapsedTime
Definition: SlsAnimator.hxx:96