Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

I had a look at unusedcode.easy (sdext/presenter) and removed a little bit more than mentioned there: as there are no end callbacks added (AddEndCallback() was unused), there is no need to run them -> RunEndCallbacks() could be removed as well. Same logic for start callbacks. Finally mpStartCallbacks and mpEndCallbacks could leave, too.

In PresenterAnimator AddAnimation() was unused and it seems that the whole class might be removed?!?

It builds successfully but nevertheless a review would be nice.

Christina
From e327a98220bd6da430c71b5cf22b4c3a4a9b8e0f Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <ChrRossmanith@web.de>
Date: Wed, 14 Mar 2012 19:50:29 +0100
Subject: [PATCH 1/2] Remove unused code

---
 sdext/source/presenter/PresenterWindowManager.cxx |   11 -----------
 sdext/source/presenter/PresenterWindowManager.hxx |    2 --
 2 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/sdext/source/presenter/PresenterWindowManager.cxx 
b/sdext/source/presenter/PresenterWindowManager.cxx
index 5dceffc..d25358f 100644
--- a/sdext/source/presenter/PresenterWindowManager.cxx
+++ b/sdext/source/presenter/PresenterWindowManager.cxx
@@ -1168,17 +1168,6 @@ void PresenterWindowManager::Invalidate (void)
 {
     mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow);
 }
-
-Reference<awt::XWindow> PresenterWindowManager::GetParentWindow (void) const
-{
-    return mxParentWindow;
-}
-
-Reference<rendering::XCanvas> PresenterWindowManager::GetParentCanvas (void) const
-{
-    return mxParentCanvas;
-}
-
 void PresenterWindowManager::Update (void)
 {
     mxClipPolygon = NULL;
diff --git a/sdext/source/presenter/PresenterWindowManager.hxx 
b/sdext/source/presenter/PresenterWindowManager.hxx
index 3051c38..d2a5ae2 100644
--- a/sdext/source/presenter/PresenterWindowManager.hxx
+++ b/sdext/source/presenter/PresenterWindowManager.hxx
@@ -97,8 +97,6 @@ public:
         const double nWidth,
         const double nHeight);
     void SetPaneBorderPainter (const ::rtl::Reference<PresenterPaneBorderPainter>& rPainter);
-    css::uno::Reference<css::awt::XWindow> GetParentWindow (void) const;
-    css::uno::Reference<css::rendering::XCanvas> GetParentCanvas (void) const;
     void Update (void);
     void Layout (void);
 
-- 
1.7.4.1

From 8c8d61c1604d2a1e8889b3681d9e5bf519cd18b0 Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <ChrRossmanith@web.de>
Date: Sat, 17 Mar 2012 15:24:39 +0100
Subject: [PATCH 2/2] Remove unused code (sdext)

---
 sdext/source/presenter/PresenterAnimation.cxx |   31 +------------------------
 sdext/source/presenter/PresenterAnimation.hxx |   17 -------------
 sdext/source/presenter/PresenterAnimator.cxx  |   11 ---------
 sdext/source/presenter/PresenterAnimator.hxx  |    8 +-----
 unusedcode.easy                               |    4 ---
 5 files changed, 2 insertions(+), 69 deletions(-)

diff --git a/sdext/source/presenter/PresenterAnimation.cxx 
b/sdext/source/presenter/PresenterAnimation.cxx
index cacf98d..b5c30ec 100644
--- a/sdext/source/presenter/PresenterAnimation.cxx
+++ b/sdext/source/presenter/PresenterAnimation.cxx
@@ -47,9 +47,7 @@ PresenterAnimation::PresenterAnimation (
     const sal_uInt64 nStepDuration)
     : mnStartTime(GetCurrentTime()+nStartDelay),
       mnTotalDuration(nTotalDuration),
-      mnStepDuration(nStepDuration),
-      mpStartCallbacks(),
-      mpEndCallbacks()
+      mnStepDuration(nStepDuration)
 {
 }
 
@@ -72,33 +70,6 @@ sal_uInt64 PresenterAnimation::GetStepDuration (void)
     return mnStepDuration;
 }
 
-void PresenterAnimation::AddEndCallback (const Callback& rCallback)
-{
-    if (mpEndCallbacks.get() == NULL)
-        mpEndCallbacks.reset(new ::std::vector<Callback>());
-    mpEndCallbacks->push_back(rCallback);
-}
-
-void PresenterAnimation::RunStartCallbacks (void)
-{
-    if (mpStartCallbacks.get() != NULL)
-    {
-        ::std::vector<Callback>::const_iterator iCallback;
-        for (iCallback=mpStartCallbacks->begin(); iCallback!=mpStartCallbacks->end(); ++iCallback)
-            (*iCallback)();
-    }
-}
-
-void PresenterAnimation::RunEndCallbacks (void)
-{
-    if (mpEndCallbacks.get() != NULL)
-    {
-        ::std::vector<Callback>::const_iterator iCallback;
-        for (iCallback=mpEndCallbacks->begin(); iCallback!=mpEndCallbacks->end(); ++iCallback)
-            (*iCallback)();
-    }
-}
-
 } } // end of namespace ::sdext::presenter
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sdext/source/presenter/PresenterAnimation.hxx 
b/sdext/source/presenter/PresenterAnimation.hxx
index fdd8de6..8c2ce42 100644
--- a/sdext/source/presenter/PresenterAnimation.hxx
+++ b/sdext/source/presenter/PresenterAnimation.hxx
@@ -83,11 +83,6 @@ public:
 
     typedef ::boost::function<void(void)> Callback;
 
-    /** Add a callback that is executed after Run() is called for the last
-        time.
-    */
-    void AddEndCallback (const Callback& rCallback);
-
     /** Called with nProgress taking on values between 0 and 1.
         @param nProgress
             A value between 0 and 1.
@@ -96,22 +91,10 @@ public:
     */
     virtual void Run (const double nProgress, const sal_uInt64 nCurrentTime) = 0;
 
-    /** Called just before Run() is called for the first time to trigger the
-        callbacks registered via the <method>AddStartCallback()</method>.
-    */
-    void RunStartCallbacks (void);
-
-    /** Called just after Run() is called for the last time to trigger the
-        callbacks registered via the <method>AddEndCallback()</method>.
-    */
-    void RunEndCallbacks (void);
-
 private:
     const sal_uInt64 mnStartTime;
     const sal_uInt64 mnTotalDuration;
     const sal_uInt64 mnStepDuration;
-    ::boost::scoped_ptr<std::vector<Callback> > mpStartCallbacks;
-    ::boost::scoped_ptr<std::vector<Callback> > mpEndCallbacks;
 };
 
 sal_uInt64 GetCurrentTime (void);
diff --git a/sdext/source/presenter/PresenterAnimator.cxx 
b/sdext/source/presenter/PresenterAnimator.cxx
index 55c9fd5..a401c2a 100644
--- a/sdext/source/presenter/PresenterAnimator.cxx
+++ b/sdext/source/presenter/PresenterAnimator.cxx
@@ -52,14 +52,6 @@ PresenterAnimator::~PresenterAnimator (void)
     PresenterTimer::CancelTask(mnCurrentTaskId);
 }
 
-void PresenterAnimator::AddAnimation (const SharedPresenterAnimation& rpAnimation)
-{
-    ::osl::MutexGuard aGuard (m_aMutex);
-
-    maFutureAnimations.insert(AnimationList::value_type(rpAnimation->GetStartTime(), rpAnimation));
-    ScheduleNextRun();
-}
-
 void PresenterAnimator::Process (void)
 {
     ::osl::MutexGuard aGuard (m_aMutex);
@@ -96,8 +88,6 @@ void PresenterAnimator::Process (void)
                 AnimationList::value_type(
                     nCurrentTime + pAnimation->GetStepDuration(),
                     pAnimation));
-        else
-            pAnimation->RunEndCallbacks();
     }
 
     ScheduleNextRun();
@@ -111,7 +101,6 @@ void PresenterAnimator::ActivateAnimations (const sal_uInt64 nCurrentTime)
         SharedPresenterAnimation pAnimation (maFutureAnimations.begin()->second);
         maActiveAnimations.insert(*maFutureAnimations.begin());
         maFutureAnimations.erase(maFutureAnimations.begin());
-        pAnimation->RunStartCallbacks();
     }
 }
 
diff --git a/sdext/source/presenter/PresenterAnimator.hxx 
b/sdext/source/presenter/PresenterAnimator.hxx
index 073592b..2ee3522 100644
--- a/sdext/source/presenter/PresenterAnimator.hxx
+++ b/sdext/source/presenter/PresenterAnimator.hxx
@@ -37,8 +37,7 @@
 
 namespace sdext { namespace presenter {
 
-/** Simple animation management.  Call AddAnimation to run animations
-    concurrently or one of the other.  See PresenterAnimation for details of
+/** Simple animation management. See PresenterAnimation for details of
     how to specify animations.
 */
 class PresenterAnimator
@@ -49,11 +48,6 @@ public:
     PresenterAnimator (void);
     virtual ~PresenterAnimator (void);
 
-    /** Add an animation.  The time at which to start and end this animation
-        is provided by the animation itself.
-    */
-    void AddAnimation (const SharedPresenterAnimation& rpAnimation);
-
 private:
     typedef ::std::multimap<sal_uInt64,SharedPresenterAnimation> AnimationList;
     AnimationList maFutureAnimations;
diff --git a/unusedcode.easy b/unusedcode.easy
index 5e63e06..d36f5d1 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -969,9 +969,7 @@ sd::slidesorter::model::VisualState::SetVisualStateBlend(double)
 sd::slidesorter::view::(anonymous 
namespace)::PageObjectRun::GetInnerBoundingBox(sd::slidesorter::view::Layouter const&, int) const
 sd::slidesorter::view::Button::IsDown() const
 sd::slidesorter::view::FontProvider::GetFont(OutputDevice const&)
-sdext::presenter::PresenterAnimation::AddEndCallback(boost::function<void ()> const&)
 sdext::presenter::PresenterAnimation::PresenterAnimation(unsigned long, unsigned long, unsigned 
long)
-sdext::presenter::PresenterAnimator::AddAnimation(boost::shared_ptr<sdext::presenter::PresenterAnimation>
 const&)
 sdext::presenter::PresenterController::GetAnimator() const
 sdext::presenter::PresenterGeometryHelper::Union(com::sun::star::awt::Rectangle const&, 
com::sun::star::awt::Rectangle const&)
 
sdext::presenter::PresenterHorizontalScrollBar::PresenterHorizontalScrollBar(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
 const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, 
boost::shared_ptr<sdext::presenter::PresenterPaintManager> const&, boost::function<void (double)> 
const&)
@@ -980,8 +978,6 @@ sdext::presenter::PresenterSprite::GetSize() const
 sdext::presenter::PresenterSprite::SetAlpha(double)
 sdext::presenter::PresenterSprite::Transform(com::sun::star::geometry::AffineMatrix2D const&)
 sdext::presenter::PresenterSpritePane::ShowTransparentBorder()
-sdext::presenter::PresenterWindowManager::GetParentCanvas() const
-sdext::presenter::PresenterWindowManager::GetParentWindow() const
 sdr::animation::Scheduler::Reset(unsigned int)
 sdr::contact::ViewContactOfPageObj::GetReferencedPage() const
 sdr::contact::ViewContactOfSdrMediaObj::hasPreferredSize() const
-- 
1.7.4.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.