LibreOffice Module slideshow (master) 1
delayevent.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#include <osl/diagnose.h>
22#include <delayevent.hxx>
23
24namespace slideshow::internal {
25
27{
28 OSL_ASSERT( isCharged() );
29 if (isCharged()) {
30 mbWasFired = true;
31 maFunc();
32 maFunc = nullptr; // early release of payload
33 }
34 return true;
35}
36
37bool Delay::isCharged() const
38{
39 return !mbWasFired;
40}
41
42double Delay::getActivationTime( double nCurrentTime ) const
43{
44 return nCurrentTime + mnTimeout;
45}
46
48{
49 // don't clear unconditionally, because it may currently be executed:
50 if (isCharged()) {
51 mbWasFired = true;
52 maFunc = nullptr; // release of payload
53 }
54}
55
56} // namespace slideshow::internal
57
58/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool isCharged() const override
Query whether this event is still charged, i.e.
Definition: delayevent.cxx:37
virtual void dispose() override
Dispose all object references.
Definition: delayevent.cxx:47
virtual double getActivationTime(double nCurrentTime) const override
Query the activation time instant this event shall be fired, if it was inserted at instant nCurrentTi...
Definition: delayevent.cxx:42
virtual bool fire() override
Execute the event.
Definition: delayevent.cxx:26