1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterAnimation.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sdext.hxx"
35 #include "PresenterAnimation.hxx"
39 namespace sdext
{ namespace presenter
{
41 sal_uInt64
GetCurrentTime (void)
44 if (osl_getSystemTime(&aTimeValue
))
45 return sal_uInt64(aTimeValue
.Seconds
* 1000.0 + aTimeValue
.Nanosec
/ 1000000.0);
53 PresenterAnimation::PresenterAnimation (
54 const sal_uInt64 nStartDelay
,
55 const sal_uInt64 nTotalDuration
,
56 const sal_uInt64 nStepDuration
)
57 : mnStartTime(GetCurrentTime()+nStartDelay
),
58 mnTotalDuration(nTotalDuration
),
59 mnStepDuration(nStepDuration
),
68 PresenterAnimation::~PresenterAnimation (void)
75 sal_uInt64
PresenterAnimation::GetStartTime (void)
83 sal_uInt64
PresenterAnimation::GetEndTime (void)
85 return mnStartTime
+ mnTotalDuration
;
91 sal_uInt64
PresenterAnimation::GetStepDuration (void)
93 return mnStepDuration
;
99 void PresenterAnimation::AddStartCallback (const Callback
& rCallback
)
101 if (mpStartCallbacks
.get() == NULL
)
102 mpStartCallbacks
.reset(new ::std::vector
<Callback
>());
103 mpStartCallbacks
->push_back(rCallback
);
109 void PresenterAnimation::AddEndCallback (const Callback
& rCallback
)
111 if (mpEndCallbacks
.get() == NULL
)
112 mpEndCallbacks
.reset(new ::std::vector
<Callback
>());
113 mpEndCallbacks
->push_back(rCallback
);
118 void PresenterAnimation::RunStartCallbacks (void)
120 if (mpStartCallbacks
.get() != NULL
)
122 ::std::vector
<Callback
>::const_iterator iCallback
;
123 for (iCallback
=mpStartCallbacks
->begin(); iCallback
!=mpStartCallbacks
->end(); ++iCallback
)
131 void PresenterAnimation::RunEndCallbacks (void)
133 if (mpEndCallbacks
.get() != NULL
)
135 ::std::vector
<Callback
>::const_iterator iCallback
;
136 for (iCallback
=mpEndCallbacks
->begin(); iCallback
!=mpEndCallbacks
->end(); ++iCallback
)
144 } } // end of namespace ::sdext::presenter