diff options
author | Siqi LIU <me@siqi.fr> | 2013-08-04 13:10:55 +0200 |
---|---|---|
committer | Siqi LIU <me@siqi.fr> | 2013-08-04 14:18:10 +0200 |
commit | dffc87dd13daf9a2f2f629cd50558995aadc4d19 (patch) | |
tree | 959406db44ffaed1f86bb935504968573cc1ba16 /slideshow | |
parent | Updated core (diff) | |
download | core-dffc87dd13daf9a2f2f629cd50558995aadc4d19.tar.gz core-dffc87dd13daf9a2f2f629cd50558995aadc4d19.zip |
pointer display on the screen
Change-Id: I43c91bdf6c364da282d354e5a07f871a9247f2d6
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/Library_slideshow.mk | 1 | ||||
-rw-r--r-- | slideshow/source/engine/pointersymbol.cxx | 23 | ||||
-rw-r--r-- | slideshow/source/engine/pointersymbol.hxx | 11 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 36 | ||||
-rw-r--r-- | slideshow/source/engine/waitsymbol.cxx | 2 |
5 files changed, 64 insertions, 9 deletions
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk index 3e792554693f..e8485efb26a2 100644 --- a/slideshow/Library_slideshow.mk +++ b/slideshow/Library_slideshow.mk @@ -142,6 +142,7 @@ $(eval $(call gb_Library_add_exception_objects,slideshow,\ slideshow/source/engine/unoviewcontainer \ slideshow/source/engine/usereventqueue \ slideshow/source/engine/waitsymbol \ + slideshow/source/engine/pointersymbol \ slideshow/source/engine/wakeupevent \ )) diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 48ad0e5d1693..8629ea74f413 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -28,6 +28,7 @@ #include <basegfx/vector/b2dvector.hxx> #include <com/sun/star/rendering/XCanvas.hpp> +#include "com/sun/star/uno/Reference.hxx" #include "pointersymbol.hxx" #include "eventmultiplexer.hxx" @@ -51,8 +52,8 @@ PointerSymbolSharedPtr PointerSymbol::create( const uno::Reference<rendering::XB { PointerSymbolSharedPtr pRet( new PointerSymbol( xBitmap, - rScreenUpdater, - rViewContainer )); + rScreenUpdater, + rViewContainer )); rEventMultiplexer.addViewHandler( pRet ); @@ -100,8 +101,20 @@ void PointerSymbol::setVisible( const bool bVisible ) } } +basegfx::B2DPoint PointerSymbol::calcSpritePos( UnoViewSharedPtr const & rView ) const +{ + const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(), + uno::UNO_QUERY_THROW ); + const geometry::IntegerSize2D realSize( xBitmap->getSize() ); + return basegfx::B2DPoint( + // pos.X pos.Y are given in 0..1, beginning from the upper left corner of the currentSlide. + std::min<sal_Int32>( 0, LEFT_BORDER_SPACE ), + std::max<sal_Int32>( 0, realSize.Height * 1 - mxBitmap->getSize().Height + - LOWER_BORDER_SPACE ) ); +} + basegfx::B2DPoint PointerSymbol::calcSpritePos( - UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D& pos) const + UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D pos) const { const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(), uno::UNO_QUERY_THROW ); @@ -195,7 +208,7 @@ void PointerSymbol::viewsChanged() } } -void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D& pos) +void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D pos) { // reposition sprites on all views ViewsVecT::const_iterator aIter( maViews.begin() ); @@ -210,6 +223,6 @@ void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D& } } // namespace internal -} // namespace presentation +} // namespace slideshow /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/source/engine/pointersymbol.hxx b/slideshow/source/engine/pointersymbol.hxx index 9dc2818d2dd9..77309e712c0a 100644 --- a/slideshow/source/engine/pointersymbol.hxx +++ b/slideshow/source/engine/pointersymbol.hxx @@ -14,6 +14,8 @@ #include <com/sun/star/rendering/XBitmap.hpp> #include <cppcanvas/customsprite.hxx> +#include "com/sun/star/uno/Reference.hxx" + #include "vieweventhandler.hxx" #include "screenupdater.hxx" #include "eventmultiplexer.hxx" @@ -24,6 +26,8 @@ #include <boost/utility.hpp> // for noncopyable #include <vector> +using namespace com::sun::star; + namespace slideshow { namespace internal { @@ -49,7 +53,8 @@ public: void hide() { setVisible(false); } /** Use this method to update the pointer's position */ - virtual void viewsChanged(const ::com::sun::star::geometry::RealPoint2D& pos); + void setVisible( const bool bVisible ); + virtual void viewsChanged(const ::com::sun::star::geometry::RealPoint2D pos); private: PointerSymbol( const ::com::sun::star::uno::Reference< @@ -63,9 +68,9 @@ private: virtual void viewChanged( const UnoViewSharedPtr& rView ); virtual void viewsChanged(); - void setVisible( const bool bVisible ); - basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D& pos = ::com::sun::star::geometry::RealPoint2D(0, 0) ) const; + ::basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D pos ) const; + ::basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView ) const; template <typename func_type> void for_each_sprite( func_type const & func ) const diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index f9e8ed8b58e0..db207a892adb 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -95,6 +95,7 @@ #include "waitsymbol.hxx" #include "effectrewinder.hxx" #include "framerate.hxx" +#include "pointersymbol.hxx" #include <boost/noncopyable.hpp> #include <boost/bind.hpp> @@ -459,6 +460,8 @@ private: boost::shared_ptr<RehearseTimingsActivity> mpRehearseTimingsActivity; boost::shared_ptr<WaitSymbol> mpWaitSymbol; + boost::shared_ptr<PointerSymbol> mpPointerSymbol; + /// the current slide transition sound object: SoundPlayerSharedPtr mpCurrentSlideTransitionSound; @@ -579,6 +582,7 @@ SlideShowImpl::SlideShowImpl( mpListener(), mpRehearseTimingsActivity(), mpWaitSymbol(), + mpPointerSymbol(), mpCurrentSlideTransitionSound(), mxComponentContext( xContext ), mxOptionalTransitionFactory(), @@ -653,6 +657,7 @@ void SlideShowImpl::disposing() } mpWaitSymbol.reset(); + mpPointerSymbol.reset(); if( mpRehearseTimingsActivity ) { @@ -1777,6 +1782,37 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) return true; } + if ( rProperty.Name == "PointerSymbolBitmap" ) + { + uno::Reference<rendering::XBitmap> xBitmap; + if (! (rProperty.Value >>= xBitmap)) + return false; + + mpPointerSymbol = PointerSymbol::create( xBitmap, + maScreenUpdater, + maEventMultiplexer, + maViewContainer ); + + return true; + } + + if ( rProperty.Name == "PointerVisible" ) + { + bool visible; + rProperty.Value >>= visible; + mpPointerSymbol->setVisible(visible); + } + + if ( rProperty.Name == "PointerPosition") + { + ::com::sun::star::geometry::RealPoint2D pos; + if (! (rProperty.Value >>= pos)) + return false; + + std::cerr<<"Received pos at :(" << pos.X << ","<<pos.Y << ")" << std::endl; + mpPointerSymbol->viewsChanged(pos); + } + if (rProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("NoSlideTransitions") )) { diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index 01ce9dbf0def..6c56ac795749 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -195,6 +195,6 @@ void WaitSymbol::viewsChanged() } } // namespace internal -} // namespace presentation +} // namespace slideshow /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |