1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_ACTIVITIES_ACCUMULATION_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
27 namespace slideshow::internal
29 /** Generic accumulation.
31 This template handles value accumulation across repeated
32 effect runs: returned is the end value times the repeat
33 count, plus the current value.
36 End value of the simple animation.
39 Number of completed repeats (i.e. 0 during the first
43 Current animation value
45 template< typename ValueType
> ValueType
accumulate( const ValueType
& rEndValue
,
46 sal_uInt32 nRepeatCount
,
47 const ValueType
& rCurrValue
)
49 return nRepeatCount
*rEndValue
+ rCurrValue
;
52 /// Specialization for non-addable enums/constant values
53 template<> sal_Int16 accumulate
< sal_Int16
>( const sal_Int16
&,
55 const sal_Int16
& rCurrValue
)
57 // always return rCurrValue, it's forbidden to add enums/constant values...
61 /// Specialization for non-addable strings
62 template<> OUString accumulate
< OUString
>( const OUString
&,
64 const OUString
& rCurrValue
)
66 // always return rCurrValue, it's impossible to add strings...
70 /// Specialization for non-addable bools
71 template<> bool accumulate
< bool >( const bool&,
73 const bool& bCurrValue
)
75 // always return bCurrValue, SMIL spec requires to ignore
76 // cumulative behaviour for bools.
82 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */