diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-12-13 14:45:39 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-12-13 14:45:39 +0000 |
commit | f8368ee9f25daae88c767263fac30125db0084b1 (patch) | |
tree | dcb50ae5c5e64fa3a11b2decee55f019568e5e32 /slideshow/source/engine/transitions | |
parent | 420bc8b1dbfd585e58049e95dceaddb8aaf3dd67 (diff) |
INTEGRATION: CWS presfixes09 (1.4.16); FILE MERGED
2006/09/18 15:26:50 thb 1.4.16.6: #i10000# Fixed post-MERGE breakages
2006/04/24 13:25:33 thb 1.4.16.5: #i53194# Unified include statements (local headers always have double quotes; external headers angle brackets); reverted EventMultiplexer pause events to shared_ptr; removed EventMultiplexer::removeViewHandler(), since the handler is held weakly, anyway.
2006/04/03 16:19:01 thb 1.4.16.4: #i37778# Now passing down ComponentContext to all interested parties; building a second, all-exports version of the slideshow component (to facilitate unit testing also for internal classes) - this made necessary renaming ImportFailedException to ShapeLoadFailedException (because of silly i63703); applied relevant parts of #i63770# (const-correctness); reworked view handling in such a way that views are now kept in one central repository (and are not duplicated across all interested objects); moved code from namespace presentation to namespace slideshow
2006/03/24 18:23:26 thb 1.4.16.3: #i37778# Moved whole slideshow engine from namespace presentation (which conflicts with one of the UNO subnamespaces) to slideshow
2006/03/07 00:00:54 thb 1.4.16.2: RESYNC: (1.4-1.5); FILE MERGED
2006/03/06 22:14:32 thb 1.4.16.1: #i53194# #i55294# #i59324# Overhauled IntrinsicAnimationActivity; fixes GIF animation import; corrected rehearse timings sprite size; several cosmetic changes (removed external header guards); prepared scene for sprite prio
Diffstat (limited to 'slideshow/source/engine/transitions')
-rw-r--r-- | slideshow/source/engine/transitions/slidechangebase.hxx | 184 |
1 files changed, 84 insertions, 100 deletions
diff --git a/slideshow/source/engine/transitions/slidechangebase.hxx b/slideshow/source/engine/transitions/slidechangebase.hxx index 49f840175cbd..cc9fddf56e97 100644 --- a/slideshow/source/engine/transitions/slidechangebase.hxx +++ b/slideshow/source/engine/transitions/slidechangebase.hxx @@ -4,9 +4,9 @@ * * $RCSfile: slidechangebase.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: obo $ $Date: 2006-01-19 18:00:25 $ + * last change: $Author: kz $ $Date: 2006-12-13 15:45:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,25 +36,20 @@ #if ! defined(INCLUDED_PRESENTATION_INTERNAL_TRANSITIONS_SLIDECHANGEBASE_HXX) #define INCLUDED_PRESENTATION_INTERNAL_TRANSITIONS_SLIDECHANGEBASE_HXX +#include <osl/mutex.hxx> + #include "unoview.hxx" -#include "slidechangeanimation.hxx" +#include "vieweventhandler.hxx" +#include "numberanimation.hxx" #include "slide.hxx" #include "soundplayer.hxx" -#include "rtl/ref.hxx" -#include "osl/mutex.hxx" -#include "cppuhelper/compbase1.hxx" -#include "comphelper/broadcasthelper.hxx" -#include "com/sun/star/util/XModifyListener.hpp" -#include "com/sun/star/presentation/XSlideShowView.hpp" -#include "boost/utility.hpp" // for boost::noncopyable -#include "boost/optional.hpp" -#include "boost/bind.hpp" - -namespace presentation { -namespace internal { -typedef ::cppu::WeakComponentImplHelper1< - ::com::sun::star::util::XModifyListener > UnoBaseT; +#include <boost/enable_shared_from_this.hpp> +#include <boost/utility.hpp> +#include <boost/optional.hpp> + +namespace slideshow { +namespace internal { /** Base class for all slide change effects. @@ -62,9 +57,9 @@ typedef ::cppu::WeakComponentImplHelper1< functionality. Derived classes should normally only need to implement the perform() method. */ -class SlideChangeBase : private ::comphelper::OBaseMutex, - public SlideChangeAnimation, - public UnoBaseT, +class SlideChangeBase : public ViewEventHandler, + public NumberAnimation, + public boost::enable_shared_from_this<SlideChangeBase>, private ::boost::noncopyable { public: @@ -77,57 +72,65 @@ public: const ShapeAttributeLayerSharedPtr& ); virtual void end(); - // SlideChangeAnimation - virtual void addView( UnoViewSharedPtr const & pView ); - virtual bool removeView( UnoViewSharedPtr const & pView ); + // ViewEventHandler + virtual void viewAdded( const UnoViewSharedPtr& rView ); + virtual void viewRemoved( const UnoViewSharedPtr& rView ); + virtual void viewChanged( const UnoViewSharedPtr& rView ); protected: - virtual ~SlideChangeBase(); - /** Create a new SlideChanger, for the given leaving and entering slides. */ SlideChangeBase( ::boost::optional<SlideSharedPtr> const & leavingSlide, - const SlideSharedPtr& pEnteringSlide, - const SoundPlayerSharedPtr& pSoundPlayer, - bool bCreateLeavingSprites = true, bool bCreateEnteringSprites = true ); + const SlideSharedPtr& pEnteringSlide, + const SoundPlayerSharedPtr& pSoundPlayer, + const UnoViewContainer& rViewContainer, + EventMultiplexer& rEventMultiplexer, + bool bCreateLeavingSprites = true, + bool bCreateEnteringSprites = true ); + + /// Info on a per-view basis + struct ViewEntry + { + ViewEntry() {} + + explicit ViewEntry( const UnoViewSharedPtr& rView ) : + mpView( rView ) + { + } + + /// The view this entry is for + UnoViewSharedPtr mpView; + /// outgoing slide sprite + cppcanvas::CustomSpriteSharedPtr mpOutSprite; + /// incoming slide sprite + cppcanvas::CustomSpriteSharedPtr mpInSprite; + /// outgoing slide bitmap + mutable SlideBitmapSharedPtr mpLeavingBitmap; + /// incoming slide bitmap + mutable SlideBitmapSharedPtr mpEnteringBitmap; + + // for algo access + const UnoViewSharedPtr& getView() const { return mpView; } + }; + + typedef ::std::vector<ViewEntry> ViewsVecT; + + ViewsVecT::const_iterator beginViews() { return maViewData.begin(); } + ViewsVecT::const_iterator endViews() { return maViewData.end(); } - SlideBitmapSharedPtr getLeavingBitmap() const; - SlideBitmapSharedPtr getEnteringBitmap() const; + SlideBitmapSharedPtr getLeavingBitmap( const ViewEntry& rViewEntry ) const; + SlideBitmapSharedPtr getEnteringBitmap( const ViewEntry& rViewEntry ) const; - SlideBitmapSharedPtr createBitmap( - ::boost::optional<SlideSharedPtr> const & rSlide_ ) const; + SlideBitmapSharedPtr createBitmap( const UnoViewSharedPtr& pView, + const boost::optional<SlideSharedPtr>& rSlide_ ) const; - /// Query the size of the bitmaps in device pixel - ::basegfx::B2ISize getEnteringSizePixel( - UnoViewSharedPtr const & pView ) const; - /// Query the XDrawPage's size - ::basegfx::B2DSize getEnteringSize() const; + ::basegfx::B2ISize getEnteringSizePixel( const UnoViewSharedPtr& pView ) const; void renderBitmap( SlideBitmapSharedPtr const & pSlideBitmap, ::cppcanvas::CanvasSharedPtr const & pCanvas ); - /** Loop over each View, and call func with that - */ - template <typename FuncT> - void for_each_view( FuncT const& func ) const { - ::std::for_each( maViews.begin(), maViews.end(), func ); - } - - /** Loop over each View's canvas, and call func with that - */ - template <typename FuncT> - void for_each_canvas( FuncT const& func ) const { - UnoViewVector::const_iterator const iEnd( maViews.end() ); - for ( UnoViewVector::const_iterator iPos( maViews.begin() ); - iPos != iEnd; ++iPos ) - { - ::cppcanvas::CanvasSharedPtr const pCanvas( (*iPos)->getCanvas() ); - func( pCanvas ); - } - } - /** Called on derived classes to implement actual slide change. This method is called with the sprite of the slide coming 'in' @@ -136,12 +139,12 @@ protected: Current sprite to operate on. This is the sprite of the 'entering' slide - @param x + @param t Current parameter value */ virtual void performIn( const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - UnoViewSharedPtr const & pView, + const ViewEntry& rViewEntry, const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, double t ); @@ -153,58 +156,39 @@ protected: Current sprite to operate on. This is the sprite of the 'leaving' slide - @param x + @param t Current parameter value */ virtual void performOut( const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - UnoViewSharedPtr const & pView, + const ViewEntry& rViewEntry, const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, double t ); private: - // XModifyListener - virtual void SAL_CALL modified( - ::com::sun::star::lang::EventObject const& evt ) - throw (::com::sun::star::uno::RuntimeException); - // XEventListener - virtual void SAL_CALL disposing( - ::com::sun::star::lang::EventObject const& evt ) - throw (::com::sun::star::uno::RuntimeException); - - /// WeakComponentImplHelperBase: - virtual void SAL_CALL disposing(); -private: + ::cppcanvas::CustomSpriteSharedPtr createSprite( + UnoViewSharedPtr const & pView, + ::basegfx::B2DSize const & rSpriteSize, + double nPrio ) const; - // view mangement: - UnoViewVector maViews; - UnoViewSharedPtr findUnoView( - ::com::sun::star::uno::Reference< - ::com::sun::star::presentation::XSlideShowView> const & xSlideShowView ) - const; - bool removeView_( UnoViewSharedPtr const& pView, - bool bDisposedView = false ); - void removeTransformationChangedListenerFrom(UnoViewSharedPtr const& pView); - - SoundPlayerSharedPtr mpSoundPlayer; - - ::boost::optional<SlideSharedPtr> mLeavingSlide; - SlideSharedPtr mpEnteringSlide; - mutable SlideBitmapSharedPtr mpLeavingBitmap; - mutable SlideBitmapSharedPtr mpEnteringBitmap; - - typedef ::std::vector< ::cppcanvas::CustomSpriteSharedPtr > SpriteVector; - SpriteVector maOutSprites; - SpriteVector maInSprites; - const bool mbCreateLeavingSprites; - const bool mbCreateEnteringSprites; - bool mbSpritesVisible; + void addSprites( ViewEntry& rEntry ); - ::cppcanvas::CustomSpriteSharedPtr createSprite( - UnoViewSharedPtr const & pView, - ::basegfx::B2DSize const & rSpriteSize ) const; - void addSprites( UnoViewSharedPtr const & pView ); + ViewsVecT::iterator lookupView( UnoViewSharedPtr const & pView ); + ViewsVecT::const_iterator lookupView( UnoViewSharedPtr const & pView ) const; + + SoundPlayerSharedPtr mpSoundPlayer; + + const UnoViewContainer& mrViewContainer; + EventMultiplexer& mrEventMultiplexer; + + ::boost::optional<SlideSharedPtr> mLeavingSlide; + SlideSharedPtr mpEnteringSlide; + + ViewsVecT maViewData; + const bool mbCreateLeavingSprites; + const bool mbCreateEnteringSprites; + bool mbSpritesVisible; }; } // namespace internal |