Kaydet (Commit) 2d0e58e1 authored tarafından Matúš Kukan's avatar Matúš Kukan

unusedcode: PresenterAnimation and PresenterAnimator

üst 3a603d37
...@@ -44,8 +44,6 @@ $(eval $(call gb_Library_use_libraries,PresenterScreen,\ ...@@ -44,8 +44,6 @@ $(eval $(call gb_Library_use_libraries,PresenterScreen,\
$(eval $(call gb_Library_add_exception_objects,PresenterScreen,\ $(eval $(call gb_Library_add_exception_objects,PresenterScreen,\
sdext/source/presenter/PresenterAccessibility \ sdext/source/presenter/PresenterAccessibility \
sdext/source/presenter/PresenterAnimation \
sdext/source/presenter/PresenterAnimator \
sdext/source/presenter/PresenterBitmapContainer \ sdext/source/presenter/PresenterBitmapContainer \
sdext/source/presenter/PresenterButton \ sdext/source/presenter/PresenterButton \
sdext/source/presenter/PresenterCanvasHelper \ sdext/source/presenter/PresenterCanvasHelper \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "PresenterAnimation.hxx"
#include <osl/time.h>
namespace sdext { namespace presenter {
sal_uInt64 GetCurrentTime (void)
{
TimeValue aTimeValue;
if (osl_getSystemTime(&aTimeValue))
return sal_uInt64(aTimeValue.Seconds * 1000.0 + aTimeValue.Nanosec / 1000000.0);
else
return 0;
}
PresenterAnimation::PresenterAnimation (
const sal_uInt64 nStartDelay,
const sal_uInt64 nTotalDuration,
const sal_uInt64 nStepDuration)
: mnStartTime(GetCurrentTime()+nStartDelay),
mnTotalDuration(nTotalDuration),
mnStepDuration(nStepDuration)
{
}
PresenterAnimation::~PresenterAnimation (void)
{
}
sal_uInt64 PresenterAnimation::GetStartTime (void)
{
return mnStartTime;
}
sal_uInt64 PresenterAnimation::GetEndTime (void)
{
return mnStartTime + mnTotalDuration;
}
sal_uInt64 PresenterAnimation::GetStepDuration (void)
{
return mnStepDuration;
}
} } // end of namespace ::sdext::presenter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SDEXT_PRESENTER_ANIMATION_HXX
#define SDEXT_PRESENTER_ANIMATION_HXX
#include <sal/types.h>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <vector>
namespace sdext { namespace presenter {
/** Base class for animations handled by a PresenterAnimator object.
A PresenterAnimation objects basically states when it wants to be
started, how long it runs, and in what steps it wants to be called back
while running.
When a PresenterAnimation object is active/running its Run() method is
called back with increasing values between 0 and 1.
*/
class PresenterAnimation
: private ::boost::noncopyable
{
public:
/** Create a new PresenterAnimation object.
@param nStartDelay
The delay in ms (milliseconds) from this call until the new
object is to be activated.
@param nTotalDuration
The duration in ms the Run() method is to be called with
increasing values between 0 and 1.
@param nStepDuration
The duration between calls to Run(). This leads to approximately
nTotalDuration/nStepDuration calls to Run(). The exact duration
of each step may vary depending on system load an other influences.
*/
PresenterAnimation (
const sal_uInt64 nStartDelay,
const sal_uInt64 nTotalDuration,
const sal_uInt64 nStepDuration);
virtual ~PresenterAnimation (void);
/** Return the absolute start time in a system dependent format.
At about this time the Run() method will be called with a value of 0.
*/
sal_uInt64 GetStartTime (void);
/** Return the absolute end time in a system dependent format.
At about this time the Run() method will be called with a value of 1.
*/
sal_uInt64 GetEndTime (void);
/** Return the duration of each step in ms.
*/
sal_uInt64 GetStepDuration (void);
typedef ::boost::function<void(void)> Callback;
/** Called with nProgress taking on values between 0 and 1.
@param nProgress
A value between 0 and 1.
@param nCurrentTime
Current time in a system dependent format.
*/
virtual void Run (const double nProgress, const sal_uInt64 nCurrentTime) = 0;
private:
const sal_uInt64 mnStartTime;
const sal_uInt64 mnTotalDuration;
const sal_uInt64 mnStepDuration;
};
sal_uInt64 GetCurrentTime (void);
inline sal_uInt32 GetSeconds (const sal_uInt64 nTime) { return sal_uInt32(nTime / 1000); }
inline sal_uInt32 GetNanoSeconds (const sal_uInt64 nTime) { return sal_uInt32((nTime % 1000) * 1000000); }
typedef ::boost::shared_ptr<PresenterAnimation> SharedPresenterAnimation;
} } // end of namespace ::sdext::presenter
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "PresenterAnimator.hxx"
#include "PresenterTimer.hxx"
#include <osl/diagnose.h>
#include <osl/time.h>
#include <salhelper/timer.hxx>
#include <boost/bind.hpp>
#include <boost/function.hpp>
namespace sdext { namespace presenter {
//===== PresenterAnimator =====================================================
PresenterAnimator::PresenterAnimator (void)
: maFutureAnimations(),
maActiveAnimations(),
mnCurrentTaskId(0),
mnNextTime(0)
{
}
PresenterAnimator::~PresenterAnimator (void)
{
PresenterTimer::CancelTask(mnCurrentTaskId);
}
void PresenterAnimator::Process (void)
{
::osl::MutexGuard aGuard (m_aMutex);
mnNextTime = 0;
const sal_uInt64 nCurrentTime (GetCurrentTime());
ActivateAnimations(nCurrentTime);
while ( ! maActiveAnimations.empty())
{
sal_uInt64 nRequestedTime (maActiveAnimations.begin()->first);
SharedPresenterAnimation pAnimation (maActiveAnimations.begin()->second);
if (nRequestedTime > nCurrentTime)
break;
maActiveAnimations.erase(maActiveAnimations.begin());
const double nTotalDuration (double(pAnimation->GetEndTime() - pAnimation->GetStartTime()));
double nProgress (nTotalDuration > 0 ? (nCurrentTime - pAnimation->GetStartTime()) / nTotalDuration : 1);
if (nProgress <= 0)
nProgress = 0;
else if (nProgress >= 1)
nProgress = 1;
OSL_TRACE("running animation step at %f (requested was %f) %f\n",
nCurrentTime/1e6, nRequestedTime/1e6, nProgress);
pAnimation->Run(nProgress, nCurrentTime);
if (nCurrentTime < pAnimation->GetEndTime())
maActiveAnimations.insert(
AnimationList::value_type(
nCurrentTime + pAnimation->GetStepDuration(),
pAnimation));
}
ScheduleNextRun();
}
void PresenterAnimator::ActivateAnimations (const sal_uInt64 nCurrentTime)
{
while ( ! maFutureAnimations.empty()
&& maFutureAnimations.begin()->first <= nCurrentTime)
{
SharedPresenterAnimation pAnimation (maFutureAnimations.begin()->second);
maActiveAnimations.insert(*maFutureAnimations.begin());
maFutureAnimations.erase(maFutureAnimations.begin());
}
}
void PresenterAnimator::ScheduleNextRun (void)
{
sal_uInt64 nStartTime (0);
if ( ! maActiveAnimations.empty())
{
nStartTime = maActiveAnimations.begin()->first;
if ( ! maFutureAnimations.empty())
if (maFutureAnimations.begin()->first < nStartTime)
nStartTime = maFutureAnimations.begin()->first;
}
else if ( ! maFutureAnimations.empty())
nStartTime = maFutureAnimations.begin()->first;
if (nStartTime > 0)
ScheduleNextRun(nStartTime);
}
void PresenterAnimator::ScheduleNextRun (const sal_uInt64 nStartTime)
{
if (mnNextTime==0 || nStartTime<mnNextTime)
{
mnNextTime = nStartTime;
::salhelper::TTimeValue aTimeValue (GetSeconds(mnNextTime), GetNanoSeconds(mnNextTime));
PresenterTimer::ScheduleSingleTaskAbsolute (
::boost::bind(&PresenterAnimator::Process, this),
aTimeValue);
}
}
} } // end of namespace ::sdext::presenter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SDEXT_PRESENTER_ANIMATOR_HXX
#define SDEXT_PRESENTER_ANIMATOR_HXX
#include "PresenterAnimation.hxx"
#include <cppuhelper/basemutex.hxx>
#include <map>
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
namespace sdext { namespace presenter {
/** Simple animation management. See PresenterAnimation for details of
how to specify animations.
*/
class PresenterAnimator
: private ::boost::noncopyable,
private ::cppu::BaseMutex
{
public:
PresenterAnimator (void);
virtual ~PresenterAnimator (void);
private:
typedef ::std::multimap<sal_uInt64,SharedPresenterAnimation> AnimationList;
AnimationList maFutureAnimations;
AnimationList maActiveAnimations;
sal_Int32 mnCurrentTaskId;
sal_uInt64 mnNextTime;
void Process (void);
void ActivateAnimations (const sal_uInt64 nCurrentTime);
void ScheduleNextRun (void);
void ScheduleNextRun (const sal_uInt64 nStartTime);
};
} } // end of namespace ::sdext::presenter
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "PresenterController.hxx" #include "PresenterController.hxx"
#include "PresenterAccessibility.hxx" #include "PresenterAccessibility.hxx"
#include "PresenterAnimator.hxx"
#include "PresenterCanvasHelper.hxx" #include "PresenterCanvasHelper.hxx"
#include "PresenterCurrentSlideObserver.hxx" #include "PresenterCurrentSlideObserver.hxx"
#include "PresenterFrameworkObserver.hxx" #include "PresenterFrameworkObserver.hxx"
...@@ -118,7 +117,6 @@ PresenterController::PresenterController ( ...@@ -118,7 +117,6 @@ PresenterController::PresenterController (
mpTheme(), mpTheme(),
mxMainWindow(), mxMainWindow(),
mpPaneBorderPainter(), mpPaneBorderPainter(),
mpAnimator(new PresenterAnimator()),
mpCanvasHelper(new PresenterCanvasHelper()), mpCanvasHelper(new PresenterCanvasHelper()),
mxPresenterHelper(), mxPresenterHelper(),
mpPaintManager(), mpPaintManager(),
...@@ -254,7 +252,6 @@ void PresenterController::disposing (void) ...@@ -254,7 +252,6 @@ void PresenterController::disposing (void)
if (xComponent.is()) if (xComponent.is())
xComponent->dispose(); xComponent->dispose();
} }
mpAnimator.reset();
mpCanvasHelper.reset(); mpCanvasHelper.reset();
{ {
Reference<lang::XComponent> xComponent (mxPresenterHelper, UNO_QUERY); Reference<lang::XComponent> xComponent (mxPresenterHelper, UNO_QUERY);
......
...@@ -63,7 +63,6 @@ namespace css = ::com::sun::star; ...@@ -63,7 +63,6 @@ namespace css = ::com::sun::star;
namespace sdext { namespace presenter { namespace sdext { namespace presenter {
class PresenterAnimator;
class PresenterCanvasHelper; class PresenterCanvasHelper;
class PresenterPaintManager; class PresenterPaintManager;
class PresenterPaneAnimator; class PresenterPaneAnimator;
...@@ -224,7 +223,6 @@ private: ...@@ -224,7 +223,6 @@ private:
::boost::shared_ptr<PresenterTheme> mpTheme; ::boost::shared_ptr<PresenterTheme> mpTheme;
css::uno::Reference<css::awt::XWindow> mxMainWindow; css::uno::Reference<css::awt::XWindow> mxMainWindow;
::rtl::Reference<PresenterPaneBorderPainter> mpPaneBorderPainter; ::rtl::Reference<PresenterPaneBorderPainter> mpPaneBorderPainter;
::boost::shared_ptr<PresenterAnimator> mpAnimator;
::boost::shared_ptr<PresenterCanvasHelper> mpCanvasHelper; ::boost::shared_ptr<PresenterCanvasHelper> mpCanvasHelper;
css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper; css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
::boost::shared_ptr<PresenterPaintManager> mpPaintManager; ::boost::shared_ptr<PresenterPaintManager> mpPaintManager;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
//#define ENABLE_PANE_RESIZING //#define ENABLE_PANE_RESIZING
#include "PresenterWindowManager.hxx" #include "PresenterWindowManager.hxx"
#include "PresenterAnimation.hxx"
#include "PresenterAnimator.hxx"
#include "PresenterController.hxx" #include "PresenterController.hxx"
#include "PresenterGeometryHelper.hxx" #include "PresenterGeometryHelper.hxx"
#include "PresenterHelper.hxx" #include "PresenterHelper.hxx"
......
...@@ -774,7 +774,6 @@ sd::ViewShellBase::RegisterFactory(unsigned short) ...@@ -774,7 +774,6 @@ sd::ViewShellBase::RegisterFactory(unsigned short)
sd::slidesorter::controller::SelectionFunction::EventDescriptor::EventDescriptor(KeyEvent const&, sd::slidesorter::SlideSorter&) sd::slidesorter::controller::SelectionFunction::EventDescriptor::EventDescriptor(KeyEvent const&, sd::slidesorter::SlideSorter&)
sd::slidesorter::view::Button::IsDown() const sd::slidesorter::view::Button::IsDown() const
sd::slidesorter::view::FontProvider::GetFont(OutputDevice const&) sd::slidesorter::view::FontProvider::GetFont(OutputDevice const&)
sdext::presenter::PresenterAnimation::PresenterAnimation(unsigned long, unsigned long, unsigned long)
sdr::animation::Scheduler::Reset(unsigned int) sdr::animation::Scheduler::Reset(unsigned int)
sdr::contact::ViewContactOfPageObj::GetReferencedPage() const sdr::contact::ViewContactOfPageObj::GetReferencedPage() const
sdr::contact::ViewContactOfSdrMediaObj::hasPreferredSize() const sdr::contact::ViewContactOfSdrMediaObj::hasPreferredSize() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment