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>
31 /** Generic accumulation.
33 This template handles value accumulation across repeated
34 effect runs: returned is the end value times the repeat
35 count, plus the current value.
38 End value of the simple animation.
41 Number of completed repeats (i.e. 0 during the first
45 Current animation value
47 template< typename ValueType
> ValueType
accumulate( const ValueType
& rEndValue
,
48 sal_uInt32 nRepeatCount
,
49 const ValueType
& rCurrValue
)
51 return nRepeatCount
*rEndValue
+ rCurrValue
;
54 /// Specialization for non-addable enums/constant values
55 template<> sal_Int16 accumulate
< sal_Int16
>( const sal_Int16
&,
57 const sal_Int16
& rCurrValue
)
59 // always return rCurrValue, it's forbidden to add enums/constant values...
63 /// Specialization for non-addable strings
64 template<> OUString accumulate
< OUString
>( const OUString
&,
66 const OUString
& rCurrValue
)
68 // always return rCurrValue, it's impossible to add strings...
72 /// Specialization for non-addable bools
73 template<> bool accumulate
< bool >( const bool&,
75 const bool& bCurrValue
)
77 // always return bCurrValue, SMIL spec requires to ignore
78 // cumulative behaviour for bools.
84 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */