From dffc87dd13daf9a2f2f629cd50558995aadc4d19 Mon Sep 17 00:00:00 2001 From: Siqi LIU Date: Sun, 4 Aug 2013 13:10:55 +0200 Subject: pointer display on the screen Change-Id: I43c91bdf6c364da282d354e5a07f871a9247f2d6 --- slideshow/Library_slideshow.mk | 1 + slideshow/source/engine/pointersymbol.cxx | 23 +++++++++++++++----- slideshow/source/engine/pointersymbol.hxx | 11 +++++++--- slideshow/source/engine/slideshowimpl.cxx | 36 +++++++++++++++++++++++++++++++ slideshow/source/engine/waitsymbol.cxx | 2 +- 5 files changed, 64 insertions(+), 9 deletions(-) (limited to 'slideshow') 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 #include +#include "com/sun/star/uno/Reference.hxx" #include "pointersymbol.hxx" #include "eventmultiplexer.hxx" @@ -51,8 +52,8 @@ PointerSymbolSharedPtr PointerSymbol::create( const uno::Reference 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( 0, LEFT_BORDER_SPACE ), + std::max( 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 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 #include +#include "com/sun/star/uno/Reference.hxx" + #include "vieweventhandler.hxx" #include "screenupdater.hxx" #include "eventmultiplexer.hxx" @@ -24,6 +26,8 @@ #include // for noncopyable #include +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 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 #include @@ -459,6 +460,8 @@ private: boost::shared_ptr mpRehearseTimingsActivity; boost::shared_ptr mpWaitSymbol; + boost::shared_ptr 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 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 << ","<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: */ -- cgit