diff options
Diffstat (limited to 'slideshow/source/engine')
-rw-r--r-- | slideshow/source/engine/color.cxx | 13 | ||||
-rw-r--r-- | slideshow/source/engine/eventmultiplexer.cxx | 22 | ||||
-rw-r--r-- | slideshow/source/engine/makefile.mk | 4 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/shapeimporter.cxx | 4 | ||||
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 15 | ||||
-rw-r--r-- | slideshow/source/engine/slide/userpaintoverlay.cxx | 51 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 68 | ||||
-rw-r--r-- | slideshow/source/engine/tools.cxx | 30 |
8 files changed, 163 insertions, 44 deletions
diff --git a/slideshow/source/engine/color.cxx b/slideshow/source/engine/color.cxx index a7a7088a302fd..a6ffbb4920662 100644 --- a/slideshow/source/engine/color.cxx +++ b/slideshow/source/engine/color.cxx @@ -268,6 +268,19 @@ namespace slideshow return RGBColor( aColor.mnRed, aColor.mnGreen, aColor.mnBlue ); } + RGBColor::RGBColor(const RGBColor& rLHS) + { + RGBColor(rLHS.getRed(), rLHS.getGreen(), rLHS.getBlue()); + } + + RGBColor& RGBColor::operator=( const RGBColor& rLHS ){ + + maRGBTriple.mnRed = rLHS.getRed(); + maRGBTriple.mnGreen = rLHS.getGreen(); + maRGBTriple.mnBlue = rLHS.getBlue(); + return *this; + } + HSLColor operator+( const HSLColor& rLHS, const HSLColor& rRHS ) { return HSLColor( rLHS.getHue() + rRHS.getHue(), diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index 31cd7cf286c4d..6ad89b2782864 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -1067,17 +1067,27 @@ bool EventMultiplexer::notifyUserPaintColor( RGBColor const& rUserColor ) bool EventMultiplexer::notifyUserPaintStrokeWidth( double rUserStrokeWidth ) { return mpImpl->maUserPaintEventHandlers.applyAll( - boost::bind(&UserPaintEventHandler::widthChanged, - _1, - rUserStrokeWidth)); + boost::bind(&UserPaintEventHandler::widthChanged, + _1, + rUserStrokeWidth)); } - +//NELLE a regarder de plus près bool EventMultiplexer::notifyUserPaintDisabled() { return mpImpl->maUserPaintEventHandlers.applyAll( boost::mem_fn(&UserPaintEventHandler::disable)); } +bool EventMultiplexer::notifySwitchPenMode(){ + return mpImpl->maUserPaintEventHandlers.applyAll( + boost::mem_fn(&UserPaintEventHandler::switchPenMode)); +} + +bool EventMultiplexer::notifySwitchEraserMode(){ + return mpImpl->maUserPaintEventHandlers.applyAll( + boost::mem_fn(&UserPaintEventHandler::switchEraserMode)); +} + //adding erasing all ink features with UserPaintOverlay bool EventMultiplexer::notifyEraseAllInk( bool const& rEraseAllInk ) { @@ -1088,10 +1098,10 @@ bool EventMultiplexer::notifyEraseAllInk( bool const& rEraseAllInk ) } //adding erasing features with UserPaintOverlay -bool EventMultiplexer::notifyEraseInk( double rEraseInkSize ) +bool EventMultiplexer::notifyEraseInk( sal_Int32 rEraseInkSize ) { return mpImpl->maUserPaintEventHandlers.applyAll( - boost::bind(&UserPaintEventHandler::eraseInkChanged, + boost::bind(&UserPaintEventHandler::eraseInkWidthChanged, _1, boost::cref(rEraseInkSize))); } diff --git a/slideshow/source/engine/makefile.mk b/slideshow/source/engine/makefile.mk index ba00e028b9ff9..6d4b182f23237 100644 --- a/slideshow/source/engine/makefile.mk +++ b/slideshow/source/engine/makefile.mk @@ -41,6 +41,10 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk +.IF "$(ENABLE_PRESENTER_EXTRA_UI)"=="YES" +CDEFS+=-DENABLE_PRESENTER_EXTRA_UI +.ENDIF + # --- Common ---------------------------------------------------------- .IF "$(OS)"=="SOLARIS" diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 54436c7330ed9..98bda086286af 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -650,7 +650,11 @@ ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const& sal_Int32 nOrdNumStart, bool bConvertingMasterPage ) : mxPage( xActualPage ), +#ifdef ENABLE_PRESENTER_EXTRA_UI mxPagesSupplier( xPagesSupplier ), +#else + mxPagesSupplier( NULL ), +#endif mrContext( rContext ), maPolygons(), maShapesStack(), diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index e895f98fa94a3..c0302fd92909c 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -81,6 +81,7 @@ #include <iterator> #include <algorithm> #include <functional> +#include <iostream> using namespace ::com::sun::star; @@ -367,7 +368,11 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) : mxDrawPage( xDrawPage ), - mxDrawPagesSupplier( xDrawPages ), +#ifdef ENABLE_PRESENTER_EXTRA_UI + mxDrawPagesSupplier( xDrawPages ), +#else + mxDrawPagesSupplier( NULL ), +#endif mxRootNode( xRootNode ), mpLayerManager( new LayerManager( rViewContainer, @@ -456,7 +461,9 @@ void SlideImpl::dispose() mpShapeManager.reset(); mxRootNode.clear(); mxDrawPage.clear(); +#ifndef ENABLE_PRESENTER_EXTRA_UI mxDrawPagesSupplier.clear(); +#endif } bool SlideImpl::prefetch() @@ -906,7 +913,7 @@ void SlideImpl::drawPolygons() const void SlideImpl::addPolygons(PolyPolygonVector aPolygons) { - if(!aPolygons.empty()) + if(!aPolygons.empty()) /* FIXME : was if(aPolygons.size() != 0) */ { for( PolyPolygonVector::iterator aIter=aPolygons.begin(), aEnd=aPolygons.end(); @@ -1259,7 +1266,11 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) { +#ifdef ENABLE_PRESENTER_EXTRA_UI boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, +#else + boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, NULL, xRootNode, rEventQueue, +#endif rEventMultiplexer, rScreenUpdater, rActivitiesQueue, rUserEventQueue, rCursorManager, rViewContainer, diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index d9854f67b6fe4..cfcb6a1918dc7 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -65,7 +65,7 @@ namespace slideshow { class PaintOverlayHandler : public MouseEventHandler, public ViewEventHandler, - public UserPaintEventHandler + public UserPaintEventHandler { public: PaintOverlayHandler( const RGBColor& rStrokeColor, @@ -73,7 +73,7 @@ namespace slideshow ActivitiesQueue& rActivitiesQueue, ScreenUpdater& rScreenUpdater, const UnoViewContainer& rViews, - Slide& rSlide, + Slide& rSlide, const PolyPolygonVector& rPolygons ) : mrActivitiesQueue( rActivitiesQueue ), mrScreenUpdater( rScreenUpdater ), @@ -90,7 +90,7 @@ namespace slideshow //handle the "remove stroke by stroke" mode of erasing mbIsEraseModeActivated( false ), mrSlide(rSlide), - mnSize(100.0) + mnSize(100) { std::for_each( rViews.begin(), rViews.end(), @@ -132,23 +132,27 @@ namespace slideshow bool colorChanged( RGBColor const& rUserColor ) { - maStrokeColor = rUserColor; + this->maStrokeColor = rUserColor; + this->mbIsEraseModeActivated = false; return true; } bool widthChanged( double nUserStrokeWidth ) { - mnStrokeWidth = nUserStrokeWidth; + this->mnStrokeWidth = nUserStrokeWidth; + mbIsEraseModeActivated = false; return true; } bool eraseAllInkChanged( bool const& rEraseAllInk ) { - mbIsEraseAllModeActivated= rEraseAllInk; + this->mbIsEraseAllModeActivated= rEraseAllInk; // if the erase all mode is activated it will remove all ink from slide, // therefor destroy all the polygons stored if(mbIsEraseAllModeActivated) { + // The Erase Mode should be desactivated + mbIsEraseModeActivated = false; // must get access to the instance to erase all polygon for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); aIter!=aEnd; @@ -180,17 +184,30 @@ namespace slideshow mrScreenUpdater.notifyUpdate(*aIter,true); } + maPolygons.clear(); } - mbIsEraseAllModeActivated=false; + mbIsEraseAllModeActivated=false; + return true; + } + + bool eraseInkWidthChanged( sal_Int32 rEraseInkSize ) + { + // Change the size + this->mnSize=rEraseInkSize; + // Changed to mode Erase + this->mbIsEraseModeActivated = true; return true; } - bool eraseInkChanged( double rEraseInkSize ) + bool switchPenMode() { - if(mbIsEraseModeActivated) - mbIsEraseModeActivated=false; - else - mbIsEraseModeActivated=true; + this->mbIsEraseModeActivated = false; + return true; + } + + bool switchEraserMode() + { + this->mbIsEraseModeActivated = true; return true; } @@ -292,7 +309,7 @@ namespace slideshow virtual bool handleMouseDragged( const awt::MouseEvent& e ) { - if(mbIsEraseModeActivated) + if(mbIsEraseModeActivated) { //define the last point as an object //we suppose that there's no way this point could be valid @@ -324,7 +341,7 @@ namespace slideshow //The point is to redraw the LastPoint the way it was originally on the bitmap, //of the slide - for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); + for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); aIter!=aEnd; ++aIter ) { @@ -355,7 +372,7 @@ namespace slideshow mrScreenUpdater.notifyUpdate(*aIter,true); } - } + } else { if( !mbIsLastPointValid ) @@ -385,8 +402,10 @@ namespace slideshow if( pPolyPoly ) { + pPolyPoly->setStrokeWidth(mnStrokeWidth); pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); pPolyPoly->draw(); + maPolygons.push_back(pPolyPoly); } } @@ -421,7 +440,7 @@ namespace slideshow bool mbIsEraseAllModeActivated; bool mbIsEraseModeActivated; Slide& mrSlide; - double mnSize; + sal_Int32 mnSize; }; UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor, diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index ad63f4d80d17d..6e12389cddbe2 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -116,6 +116,7 @@ #include <string> #include <algorithm> #include <stdio.h> +#include <iostream> using namespace com::sun::star; using namespace ::slideshow::internal; @@ -367,9 +368,10 @@ private: boost::optional<double> maUserPaintStrokeWidth; //changed for the eraser project - boost::optional<bool> maEraseAllInk; - - boost::optional<bool> maEraseInk; + boost::optional<bool> maEraseAllInk; + boost::optional<bool> maSwitchPenMode; + boost::optional<bool> maSwitchEraserMode; + boost::optional<sal_Int32> maEraseInk; //end changed boost::shared_ptr<canvas::tools::ElapsedTime> mpPresTimer; @@ -956,7 +958,11 @@ void SlideShowImpl::displaySlide( // precondition: must only be called from the main thread! DBG_TESTSOLARMUTEX(); +#ifdef ENABLE_PRESENTER_EXTRA_UI mxDrawPagesSupplier = xDrawPages; +#else + mxDrawPagesSupplier = NULL; +#endif stopShow(); // MUST call that: results in // maUserEventQueue.clear(). What's more, @@ -990,9 +996,7 @@ void SlideShowImpl::displaySlide( mpCurrentSlide = mpPrefetchSlide; } else - { mpCurrentSlide = makeSlide( xSlide, xDrawPages, xRootNode ); - } OSL_ASSERT( mpCurrentSlide ); if (mpCurrentSlide) @@ -1399,21 +1403,65 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) } else { - // disable user paint - maEraseAllInk.reset(); - maEventMultiplexer.notifyUserPaintDisabled(); + // disable user paint + maEraseAllInk.reset(); + maEventMultiplexer.notifyUserPaintDisabled(); + } + + if( mnCurrentCursor == awt::SystemPointer::ARROW ) + resetCursor(); + + return true; + } + + if (rProperty.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SwitchPenMode") )) + { + bool nSwitchPenMode(false); + if (rProperty.Value >>= nSwitchPenMode) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + + if(nSwitchPenMode == true){ + // Switch to Pen Mode + maSwitchPenMode.reset( nSwitchPenMode ); + maEventMultiplexer.notifySwitchPenMode(); + } } if( mnCurrentCursor == awt::SystemPointer::ARROW ) resetCursor(); + return true; + } + + + if (rProperty.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SwitchEraserMode") )) + { + bool nSwitchEraserMode(false); + if (rProperty.Value >>= nSwitchEraserMode) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + if(nSwitchEraserMode == true){ + // switch to Eraser mode + maSwitchEraserMode.reset( nSwitchEraserMode ); + maEventMultiplexer.notifySwitchEraserMode(); + } + } + if( mnCurrentCursor == awt::SystemPointer::ARROW ) + resetCursor(); return true; } + + if (rProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("EraseInk") )) { - double nEraseInk(0.0); + sal_Int32 nEraseInk(100); if (rProperty.Value >>= nEraseInk) { OSL_ENSURE( mbMouseVisible, @@ -1421,7 +1469,7 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) // enable user paint maEraseInk.reset( nEraseInk ); - maEventMultiplexer.notifyEraseInk( *maEraseInk ); + maEventMultiplexer.notifyEraseInkWidth( *maEraseInk ); } else { diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index be3a398490402..249375f990329 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -637,8 +637,8 @@ namespace slideshow aTransform ); } - ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds, - const ::basegfx::B2DRange& rShapeBounds ) + ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds, + const ::basegfx::B2DRange& rShapeBounds ) { return ::basegfx::B2DRectangle( lerp( rShapeBounds.getMinX(), @@ -710,15 +710,25 @@ namespace slideshow static_cast< sal_uInt8 >( nColor >> 24U ) ) ); } - sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor ) + /*sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor ) { - return ::cppcanvas::makeColorARGB( - // convert from IntSRGBA color to API color - // (0xRRGGBBAA -> 0xAARRGGBB) - static_cast< sal_uInt8 >(0), - ::cppcanvas::getRed(aColor), - ::cppcanvas::getGreen(aColor), - ::cppcanvas::getBlue(aColor)); + return ::cppcanvas::unMakeColor( + // convert from IntSRGBA color to API color + // (0xRRGGBBAA -> 0xAARRGGBB) + static_cast< sal_uInt8 >(0), + ::cppcanvas::getRed(aColor), + ::cppcanvas::getGreen(aColor), + ::cppcanvas::getBlue(aColor)); + }*/ + + sal_Int8 unSignedToSigned(sal_Int8 nInt) + { + if(nInt < 0 ){ + sal_Int8 nInt2 = nInt >> 1U; + return nInt2; + }else{ + return nInt; + } } void fillRect( const ::cppcanvas::CanvasSharedPtr& rCanvas, |