diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-10-08 12:22:23 +0200 |
---|---|---|
committer | Thorsten Behrens <thb@documentfoundation.org> | 2013-10-08 12:33:58 +0200 |
commit | eff346b78c3a0bd9855dfa9b4dc92cfbf7a9ee27 (patch) | |
tree | e3e5d9056a87939fdc001412610a99e91187dbc1 /slideshow | |
parent | oglcanvas: ship comp registration, return device window. (diff) | |
download | core-eff346b78c3a0bd9855dfa9b4dc92cfbf7a9ee27.tar.gz core-eff346b78c3a0bd9855dfa9b4dc92cfbf7a9ee27.zip |
oglcanvas: XCanvas != XBitmap kill another instance
This crept in from gsoc, some whitespace / formatting alignment
with slideshow conventions, added doxygen class mission statement.
Change-Id: Ie9837fc437d9827dc8fa6b1c25a3f46a638bac51
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/pointersymbol.cxx | 73 | ||||
-rw-r--r-- | slideshow/source/engine/pointersymbol.hxx | 20 | ||||
-rw-r--r-- | slideshow/source/engine/waitsymbol.hxx | 1 |
3 files changed, 40 insertions, 54 deletions
diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 0516431312cf..9ff58929375e 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -28,8 +28,7 @@ #include <basegfx/vector/b2dvector.hxx> #include <com/sun/star/rendering/XCanvas.hpp> -#include <com/sun/star/geometry/IntegerSize2D.hpp> -#include "com/sun/star/uno/Reference.hxx" +#include <com/sun/star/presentation/XSlideShowView.hpp> #include "pointersymbol.hxx" #include "eventmultiplexer.hxx" @@ -47,9 +46,9 @@ const sal_Int32 LEFT_BORDER_SPACE = 10; const sal_Int32 LOWER_BORDER_SPACE = 10; PointerSymbolSharedPtr PointerSymbol::create( const uno::Reference<rendering::XBitmap>& xBitmap, - ScreenUpdater& rScreenUpdater, - EventMultiplexer& rEventMultiplexer, - const UnoViewContainer& rViewContainer ) + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + const UnoViewContainer& rViewContainer ) { PointerSymbolSharedPtr pRet( new PointerSymbol( xBitmap, @@ -62,11 +61,12 @@ PointerSymbolSharedPtr PointerSymbol::create( const uno::Reference<rendering::XB } PointerSymbol::PointerSymbol( uno::Reference<rendering::XBitmap> const & xBitmap, - ScreenUpdater& rScreenUpdater, - const UnoViewContainer& rViewContainer ) : + ScreenUpdater& rScreenUpdater, + const UnoViewContainer& rViewContainer ) : mxBitmap(xBitmap), maViews(), mrScreenUpdater( rScreenUpdater ), + maPos(), mbVisible(false) { std::for_each( rViewContainer.begin(), @@ -102,35 +102,14 @@ void PointerSymbol::setVisible( const bool bVisible ) } } -basegfx::B2DPoint PointerSymbol::calcSpritePos( UnoViewSharedPtr const & rView ) const +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 -{ - const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(), - uno::UNO_QUERY_THROW ); - const geometry::IntegerSize2D realSize( xBitmap->getSize() ); - + const awt::Rectangle aViewArea( rView->getUnoView()->getCanvasArea() ); const geometry::IntegerSize2D realTranslationOffset ( rView->getTranslationOffset() ); - - basegfx::B2DPoint newPos( - realTranslationOffset.Width + (realSize.Width - 2 * realTranslationOffset.Width) * pos.X, - realTranslationOffset.Height + (realSize.Height - 2 * realTranslationOffset.Height) * pos.Y); - - - return newPos; + return basegfx::B2DPoint( + realTranslationOffset.Width + ((aViewArea.Width - aViewArea.X) - 2 * realTranslationOffset.Width) * maPos.X, + realTranslationOffset.Height + ((aViewArea.Height - aViewArea.Y) - 2 * realTranslationOffset.Height) * maPos.Y); } void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) @@ -215,20 +194,26 @@ void PointerSymbol::viewsChanged() } } -void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D pos) +void PointerSymbol::viewsChanged(const geometry::RealPoint2D pos) { - // reposition sprites on all views - ViewsVecT::const_iterator aIter( maViews.begin() ); - ViewsVecT::const_iterator const aEnd ( maViews.end() ); - while( aIter != aEnd ) + if( pos.X != maPos.X || pos.Y != maPos.Y ) { - if( aIter->second ) { - aIter->second->movePixel( - calcSpritePos( aIter->first, pos )); - mrScreenUpdater.notifyUpdate(); - mrScreenUpdater.commitUpdates(); + maPos = pos; + + // reposition sprites on all views + ViewsVecT::const_iterator aIter( maViews.begin() ); + ViewsVecT::const_iterator const aEnd ( maViews.end() ); + while( aIter != aEnd ) + { + if( aIter->second ) + { + aIter->second->movePixel( + calcSpritePos( aIter->first )); + mrScreenUpdater.notifyUpdate(); + mrScreenUpdater.commitUpdates(); + } + ++aIter; } - ++aIter; } } diff --git a/slideshow/source/engine/pointersymbol.hxx b/slideshow/source/engine/pointersymbol.hxx index 77309e712c0a..706f312d8f54 100644 --- a/slideshow/source/engine/pointersymbol.hxx +++ b/slideshow/source/engine/pointersymbol.hxx @@ -34,15 +34,16 @@ namespace internal { class EventMultiplexer; typedef boost::shared_ptr<class PointerSymbol> PointerSymbolSharedPtr; +/// On-screen 'laser pointer' from the Impress remote control class PointerSymbol : public ViewEventHandler, - private ::boost::noncopyable + private ::boost::noncopyable { public: static PointerSymbolSharedPtr create( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap>& xBitmap, - ScreenUpdater& rScreenUpdater, - EventMultiplexer& rEventMultiplexer, - const UnoViewContainer& rViewContainer ); + ::com::sun::star::rendering::XBitmap>& xBitmap, + ScreenUpdater& rScreenUpdater, + EventMultiplexer& rEventMultiplexer, + const UnoViewContainer& rViewContainer ); /** Shows the pointer symbol. */ @@ -58,9 +59,9 @@ public: private: PointerSymbol( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap>& xBitmap, - ScreenUpdater& rScreenUpdater, - const UnoViewContainer& rViewContainer ); + ::com::sun::star::rendering::XBitmap>& xBitmap, + ScreenUpdater& rScreenUpdater, + const UnoViewContainer& rViewContainer ); // ViewEventHandler virtual void viewAdded( const UnoViewSharedPtr& rView ); @@ -68,8 +69,6 @@ private: virtual void viewChanged( const UnoViewSharedPtr& rView ); virtual void viewsChanged(); - - ::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> @@ -91,6 +90,7 @@ private: ViewsVecT maViews; ScreenUpdater& mrScreenUpdater; + ::com::sun::star::geometry::RealPoint2D maPos; bool mbVisible; }; diff --git a/slideshow/source/engine/waitsymbol.hxx b/slideshow/source/engine/waitsymbol.hxx index d1d477857ea2..655ceb108f2c 100644 --- a/slideshow/source/engine/waitsymbol.hxx +++ b/slideshow/source/engine/waitsymbol.hxx @@ -39,6 +39,7 @@ namespace internal { class EventMultiplexer; typedef boost::shared_ptr<class WaitSymbol> WaitSymbolSharedPtr; +/// On-screen 'hour glass' for when slideshow is unresponsive class WaitSymbol : public ViewEventHandler, private ::boost::noncopyable { |