diff options
author | ericb <ericb@ordinateur-de-eric-b-2.local> | 2009-12-15 23:12:19 +0100 |
---|---|---|
committer | ericb <ericb@ordinateur-de-eric-b-2.local> | 2009-12-15 23:12:19 +0100 |
commit | 60f515eaa1611d375b164ab8bbf4c04a448fcacd (patch) | |
tree | 9d163f3eb740f423d5b470b5f987ea82ea057dc3 | |
parent | 4881cb25179f2a0e20f979bb5bd9de769144c39e (diff) |
#i97972# commit all changes since Thorsten rebase. Thanks to Nelle, Jonathan, Christian and ericb
-rw-r--r-- | sd/source/ui/slideshow/makefile.mk | 5 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshow.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshow.hrc | 43 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshow.src | 51 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 193 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.hxx | 22 | ||||
-rw-r--r-- | slideshow/source/engine/color.cxx | 13 | ||||
-rw-r--r-- | slideshow/source/engine/eventmultiplexer.cxx | 24 | ||||
-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 | 55 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 72 | ||||
-rw-r--r-- | slideshow/source/engine/tools.cxx | 32 | ||||
-rw-r--r-- | slideshow/source/inc/eventmultiplexer.hxx | 4 | ||||
-rw-r--r-- | slideshow/source/inc/rgbcolor.hxx | 5 | ||||
-rw-r--r-- | slideshow/source/inc/shapeimporter.hxx | 6 | ||||
-rw-r--r-- | slideshow/source/inc/userpainteventhandler.hxx | 5 |
18 files changed, 414 insertions, 141 deletions
diff --git a/sd/source/ui/slideshow/makefile.mk b/sd/source/ui/slideshow/makefile.mk index b9b3cc9ee..7055d723d 100644 --- a/sd/source/ui/slideshow/makefile.mk +++ b/sd/source/ui/slideshow/makefile.mk @@ -43,8 +43,9 @@ AUTOSEG=true .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk -.IF "$(ENABLE_PRESENTER_EXTRA_UI)"="YES" -CDEFS+= -DENABLE_PRESENTER_EXTRA_UI +.IF "$(ENABLE_PRESENTER_EXTRA_UI)"=="YES" +RSCDEFS+=-DENABLE_PRESENTER_EXTRA_UI +ADDCDEFS+=-DENABLE_PRESENTER_EXTRA_UI .ENDIF # --- Files -------------------------------------------------------- diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 78a6c6df4..d73eb751a 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -87,7 +87,7 @@ extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName ); namespace { /** This local version of the work window overloads DataChanged() so that it - can restart the slide show when a displau is added or removed. + can restart the slide show when a display is added or removed. */ class FullScreenWorkWindow : public WorkWindow { diff --git a/sd/source/ui/slideshow/slideshow.hrc b/sd/source/ui/slideshow/slideshow.hrc index 326a32251..e0141d1af 100644 --- a/sd/source/ui/slideshow/slideshow.hrc +++ b/sd/source/ui/slideshow/slideshow.hrc @@ -27,6 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ + #ifndef SD_SLIDESHOW_HRC_ #define SD_SLIDESHOW_HRC_ @@ -37,23 +38,29 @@ #define CM_SCREEN_BLACK 5 #define CM_SCREEN_WHITE 6 #define CM_ENDSHOW 7 -#define CM_ERASE_INK 8 -#define CM_ERASE_ALLINK 9 -#define CM_ERASE_INK_PEN 10 -#define CM_ERASE_INK_PEN_VERY_THIN 11 -#define CM_ERASE_INK_PEN_THIN 12 -#define CM_ERASE_INK_PEN_NORMAL 13 -#define CM_ERASE_INK_PEN_THICK 14 -#define CM_ERASE_INK_PEN_VERY_THICK 15 -#define CM_COLOR_PEN 16 -#define CM_WIDTH_PEN 17 -#define CM_WIDTH_PEN_VERY_THIN 18 -#define CM_WIDTH_PEN_THIN 19 -#define CM_WIDTH_PEN_NORMAL 20 -#define CM_WIDTH_PEN_THICK 21 -#define CM_WIDTH_PEN_VERY_THICK 22 -#define CM_FIRST_SLIDE 23 -#define CM_LAST_SLIDE 24 -#define CM_SLIDES 25 +#define CM_FIRST_SLIDE 8 +#define CM_LAST_SLIDE 9 +#define CM_SLIDES 10 +#ifdef ENABLE_PRESENTER_EXTRA_UI +//CM for extra presenter UI +#define CM_ERASE_ALLINK 11 +#define CM_ERASE_INK 12 +#define CM_ERASE_INK_PEN 13 +#define CM_ERASE_INK_PEN_VERY_THIN 14 +#define CM_ERASE_INK_PEN_THIN 15 +#define CM_ERASE_INK_PEN_NORMAL 16 +#define CM_ERASE_INK_PEN_THICK 17 +#define CM_ERASE_INK_PEN_VERY_THICK 18 +#define CM_COLOR_PEN 19 +#define CM_WIDTH_PEN 20 +#define CM_WIDTH_PEN_VERY_THIN 21 +#define CM_WIDTH_PEN_THIN 22 +#define CM_WIDTH_PEN_NORMAL 23 +#define CM_WIDTH_PEN_THICK 24 +#define CM_WIDTH_PEN_VERY_THICK 25 +#define CM_PEN_MODE 26 +#define CM_ERASE_MODE 27 +#define CM_POINTER_OPTION 28 +#endif //ENABLE_PRESENTER_EXTRA_UI #endif diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src index a2cad1add..60bcd5c3b 100644 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -74,20 +74,34 @@ Menu RID_SLIDESHOW_CONTEXTMENU { Separator = TRUE; }; +#ifdef ENABLE_PRESENTER_EXTRA_UI MenuItem { - Identifier = CM_WIDTH_PEN; - Text [ en-US ] = "~Pen Width" ; - + Identifier = CM_PEN_MODE; + Text [ en-US ] = "~Pen Mode"; + }; + MenuItem + { + Identifier = CM_ERASE_MODE; + Text [ en-US ] = "~Eraser Mode"; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = CM_WIDTH_PEN; + Text [ en-US ] = "~Pen Width" ; SubMenu = Menu - { + { ItemList = { MenuItem { Identifier = CM_WIDTH_PEN_VERY_THIN; Text [ en-US ] = "~Very thin"; - }; + }; MenuItem { Identifier = CM_WIDTH_PEN_THIN; @@ -97,7 +111,7 @@ Menu RID_SLIDESHOW_CONTEXTMENU { Identifier = CM_WIDTH_PEN_NORMAL; Text [ en-US ] = "~Normal"; - }; + }; MenuItem { Identifier = CM_WIDTH_PEN_THICK; @@ -107,7 +121,7 @@ Menu RID_SLIDESHOW_CONTEXTMENU { Identifier = CM_WIDTH_PEN_VERY_THICK; Text [ en-US ] = "~Very Thick"; - }; + }; }; }; }; @@ -115,8 +129,8 @@ Menu RID_SLIDESHOW_CONTEXTMENU { Separator = TRUE; }; - MenuItem - { + MenuItem + { Identifier = CM_COLOR_PEN ; Text [ en-US ] = "~Change Pen Color" ; }; @@ -131,23 +145,23 @@ Menu RID_SLIDESHOW_CONTEXTMENU MenuItem { Identifier = CM_ERASE_ALLINK ; - Text [ en-US ] = "~Erase All Ink" ; - }; - MenuItem - { - Identifier = CM_ERASE_INK ; - Text [ en-US ] = "~Erase Ink Mode ON/OFF" ; + Text [ en-US ] = "~Erase All Ink On Slide" ; }; + // MenuItem + // { + // Identifier = CM_ERASE_INK ; + // Text [ en-US ] = "~Erase Ink Mode ON/OFF" ; + // }; MenuItem { Separator = TRUE; }; MenuItem { - Identifier = CM_ERASE_INK_PEN; - Text [ en-US ] = "~Eraser Size" ; + Identifier = CM_ERASE_INK_PEN; + Text [ en-US ] = "~Eraser Width" ; - SubMenu = Menu + SubMenu = Menu { ItemList = { @@ -179,6 +193,7 @@ Menu RID_SLIDESHOW_CONTEXTMENU }; }; }; +#endif MenuItem { Separator = TRUE; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index e47e4d3cc..21d0dbe85 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -468,6 +468,8 @@ bool AnimationSlideController::previousSlide() return jumpToSlideIndex( getPreviousSlideIndex() ); } + + void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow, const Reference< XDrawPagesSupplier>& xDrawPages ) { const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber(); @@ -525,11 +527,15 @@ SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, , mbInputFreeze(false) , mbActive(sal_False) , maPresSettings( pDoc->getPresentationSettings() ) -, mnUserPaintColor( 0x00000000L ) +, mnUserPaintColor( 0x00000000L ) //User paint color is Black by default +#ifdef ENABLE_PRESENTER_EXTRA_UI +, mbSwitchPenMode(true) +, mbSwitchEraserMode(false) , mdUserPaintStrokeWidth ( 4.0 ) , mbEraseAllInk(false) -, mbEraseInk(false) -, mnEraseInkSize(100.0) +//, mbEraseInk(false) +, mnEraseInkSize(100) +#endif , mnEntryCounter(0) , mnLastSlideNumber(-1) , msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ) @@ -1093,6 +1099,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) aProperties.push_back( beans::PropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("UserPaintColor") ), + // User paint color is black by default. -1, Any( static_cast<sal_Int32>(0x00000000L) ), beans::PropertyState_DIRECT_VALUE ) ); } @@ -1418,12 +1425,14 @@ void SlideshowImpl::displayCurrentSlide() void SlideshowImpl::endPresentation() { +#ifdef ENABLE_PRESENTER_EXTRA_UI if( maPresSettings.mbMouseAsPen) { Reference< XMultiServiceFactory > xDocFactory(mpDoc->getUnoModel(), UNO_QUERY ); if( xDocFactory.is() ) mxShow->registerUserPaintPolygons(xDocFactory); } +#endif if( !mnEndShowEvent ) mnEndShowEvent = Application::PostUserEvent( LINK(this, SlideshowImpl, endPresentationHdl) ); } @@ -2128,7 +2137,12 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) #ifdef ENABLE_PRESENTER_EXTRA_UI //adding button to contextual menu for erasing functionnalities for UserPaintOverlay pMenu->EnableItem( CM_ERASE_ALLINK, (maPresSettings.mbMouseAsPen)); - pMenu->EnableItem( CM_COLOR_PEN, (maPresSettings.mbMouseAsPen)); + // Adding button to contextual menu for changing pen color + pMenu->EnableItem( CM_COLOR_PEN, (maPresSettings.mbMouseAsPen)); + // Adding button to display if in Pen mode + pMenu->EnableItem( CM_PEN_MODE, (maPresSettings.mbMouseAsPen)); + // Adding button to displau if in Erase Mode + pMenu->EnableItem( CM_ERASE_MODE, (maPresSettings.mbMouseAsPen)); #endif const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); @@ -2197,9 +2211,10 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) pBlankMenu->CheckItem( ( mpShowWindow->GetBlankColor() == Color( COL_WHITE ) ) ? CM_SCREEN_WHITE : CM_SCREEN_BLACK ); } } - +#ifdef ENABLE_PRESENTER_EXTRA_UI + PopupMenu* pWidthMenu = pMenu->GetPopupMenu( CM_WIDTH_PEN); - + // populate color width list if( pWidthMenu ) { @@ -2244,7 +2259,7 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) } } -#ifdef ENABLE_PRESENTER_EXTRA_UI + PopupMenu* pEraseWidthMenu = pMenu->GetPopupMenu( CM_ERASE_INK_PEN); // populate eraser width list @@ -2286,7 +2301,11 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) pEraseWidthMenu->EnableItem( (USHORT)(CM_ERASE_INK_PEN + nEIterator), TRUE); if( nEWidth == mnEraseInkSize) pEraseWidthMenu->CheckItem( (USHORT)(CM_ERASE_INK_PEN + nEIterator) ); - + if( mbSwitchPenMode ) + pMenu->CheckItem( (USHORT)(CM_PEN_MODE)); + if( mbSwitchEraserMode ) + pMenu->CheckItem( (USHORT)(CM_ERASE_MODE)); + } } } @@ -2354,7 +2373,7 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) } } break; - +#ifdef ENABLE_PRESENTER_EXTRA_UI if( maPresSettings.mbMouseAsPen ) { case CM_COLOR_PEN: @@ -2408,48 +2427,59 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) mbWasPaused = false; } break; -#ifdef ENABLE_PRESENTER_EXTRA_UI case CM_ERASE_ALLINK: { setEraseAllInk(true); mbWasPaused = false; } break; + case CM_PEN_MODE: + { + setPenMode(true); + mbWasPaused = false; + } + break; + case CM_ERASE_MODE: + { + setEraserMode(true); + mbWasPaused = false; + } + break; case CM_ERASE_INK_PEN_VERY_THIN: { - setEraseInk(100.0); + setEraseInk(100); mbWasPaused = false; } break; case CM_ERASE_INK_PEN_THIN: { - setEraseInk(200.0); + setEraseInk(200); mbWasPaused = false; } break; case CM_ERASE_INK_PEN_NORMAL: { - setEraseInk(300.0); + setEraseInk(300); mbWasPaused = false; } break; case CM_ERASE_INK_PEN_THICK: { - setEraseInk(400.0); + setEraseInk(400); mbWasPaused = false; } break; case CM_ERASE_INK_PEN_VERY_THICK: { - setEraseInk(500.0); + setEraseInk(500); mbWasPaused = false; } break; -#endif } +#endif case CM_ENDSHOW: // in case the user cancels the presentation, switch to current slide @@ -3058,16 +3088,16 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeExc maPresSettings.mbMouseAsPen = bMouseAsPen; if( mxShow.is() ) try { + // For Pencolor; Any aValue; if( maPresSettings.mbMouseAsPen ) - // todo: take color from configuration - aValue <<= mnUserPaintColor; - + // TODO: take color from configuration + aValue <<= mnUserPaintColor; beans::PropertyValue aPenProp; aPenProp.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserPaintColor" )); aPenProp.Value = aValue; - mxShow->setProperty( aPenProp ); +#ifdef ENABLE_PRESENTER_EXTRA_UI //for StrokeWidth : Any aValueWidth; if( maPresSettings.mbMouseAsPen ) @@ -3078,23 +3108,26 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeExc aPenPropWidth.Value = aValueWidth; mxShow->setProperty( aPenPropWidth ); - - //for EraseAllInk : - Any aValueEraseAllInk; - if( maPresSettings.mbMouseAsPen ) - aValueEraseAllInk <<= mbEraseAllInk; - beans::PropertyValue aPenPropEraseAllInk; - aPenPropEraseAllInk.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EraseAllInk" )); - aPenPropEraseAllInk.Value = aValueEraseAllInk; - mxShow->setProperty( aPenPropEraseAllInk ); - //for EraseInk : - Any aValueEraseInk; + + // for Pen Mode + Any aValueSwitchPenMode; if( maPresSettings.mbMouseAsPen ) - aValueEraseInk <<= mnEraseInkSize; - beans::PropertyValue aPenPropEraseInk; - aPenPropEraseInk.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EraseInk" )); - aPenPropEraseInk.Value = aValueEraseInk; - mxShow->setProperty( aPenPropEraseInk ); + aValueSwitchPenMode <<= mbSwitchPenMode; + beans::PropertyValue aPenPropSwitchPenMode; + aPenPropSwitchPenMode.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SwitchPenMode" )); + aPenPropSwitchPenMode.Value = aValueSwitchPenMode; + mxShow->setProperty( aPenPropSwitchPenMode ); + + //for EraseAllInk : + Any aValueEraseAllInk; + if( maPresSettings.mbMouseAsPen ) + aValueEraseAllInk <<= mbEraseAllInk; + beans::PropertyValue aPenPropEraseAllInk; + aPenPropEraseAllInk.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EraseAllInk" )); + aPenPropEraseAllInk.Value = aValueEraseAllInk; + mxShow->setProperty( aPenPropEraseAllInk ); + mbEraseAllInk = false; // sets to false so not to have it applied again +#endif } catch( Exception& e ) { @@ -3108,23 +3141,64 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeExc } } +#ifdef ENABLE_PRESENTER_EXTRA_UI +void SAL_CALL SlideshowImpl::setUseEraser( sal_Bool bMouseAsPen ) throw (RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + maPresSettings.mbMouseAsPen = bMouseAsPen; + if( mxShow.is() ) try + { + + //for EraseInk : + Any aValueEraseInk; + if( maPresSettings.mbMouseAsPen ) + aValueEraseInk <<= mnEraseInkSize; + beans::PropertyValue aPenPropEraseInk; + aPenPropEraseInk.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EraseInk" )); + aPenPropEraseInk.Value = aValueEraseInk; + mxShow->setProperty( aPenPropEraseInk ); + + // for Erase Mode + Any aValueSwitchEraserMode; + if( maPresSettings.mbMouseAsPen ) + aValueSwitchEraserMode <<= mbSwitchEraserMode; + beans::PropertyValue aPenPropSwitchEraserMode; + aPenPropSwitchEraserMode.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SwitchEraserMode" )); + aPenPropSwitchEraserMode.Value = aValueSwitchEraserMode; + mxShow->setProperty( aPenPropSwitchEraserMode ); + } + catch( Exception& e ) + { + static_cast<void>(e); + DBG_ERROR( + (OString("sd::SlideshowImpl::setUseEraser(), " + "exception caught: ") + + rtl::OUStringToOString( + comphelper::anyToString( cppu::getCaughtException() ), + RTL_TEXTENCODING_UTF8 )).getStr() ); + } +} + // -------------------------------------------------------------------- + double SAL_CALL SlideshowImpl::getPenWidth() throw (RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); return mdUserPaintStrokeWidth; } - - + // -------------------------------------------------------------------- void SAL_CALL SlideshowImpl::setPenWidth( double dStrokeWidth ) throw (RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); mdUserPaintStrokeWidth = dStrokeWidth; + mbSwitchPenMode = true; + mbSwitchEraserMode = !mbSwitchPenMode; if( maPresSettings.mbMouseAsPen ) setUsePen( sal_True ); // update color and width } +#endif // -------------------------------------------------------------------- sal_Int32 SAL_CALL SlideshowImpl::getPenColor() throw (RuntimeException) @@ -3139,10 +3213,48 @@ void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) throw (RuntimeExcep { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); mnUserPaintColor = nColor; +#ifdef ENABLE_PRESENTER_EXTRA_UI + mbSwitchPenMode = true; + mbSwitchEraserMode = !mbSwitchPenMode; +#endif if( maPresSettings.mbMouseAsPen ) setUsePen( sal_True ); // update color } +#ifdef ENABLE_PRESENTER_EXTRA_UI +// -------------------------------------------------------------------- + +void SAL_CALL SlideshowImpl::setPenMode( bool bSwitchPenMode ) throw (RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mbSwitchPenMode = bSwitchPenMode; + + if(mbSwitchPenMode == true){ + mbSwitchEraserMode = false; + }else{ + mbSwitchEraserMode = true; + } + if( maPresSettings.mbMouseAsPen ) + setUsePen( sal_True ); // Switch to Pen Mode + +} + +void SAL_CALL SlideshowImpl::setEraserMode(bool bSwitchEraserMode ) throw (RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mbSwitchEraserMode = bSwitchEraserMode; + if(mbSwitchEraserMode = true){ + mbSwitchPenMode = false; + }else{ + mbSwitchPenMode = true; + } + + if( maPresSettings.mbMouseAsPen ) + setUseEraser( sal_True ); // Switch to EraseMode + +} + + // -------------------------------------------------------------------- void SAL_CALL SlideshowImpl::setEraseAllInk( bool bEraseAllInk ) throw (RuntimeException) @@ -3154,13 +3266,16 @@ void SAL_CALL SlideshowImpl::setEraseAllInk( bool bEraseAllInk ) throw (RuntimeE } -void SAL_CALL SlideshowImpl::setEraseInk( double nEraseInkSize ) throw (RuntimeException) +void SAL_CALL SlideshowImpl::setEraseInk( sal_Int32 nEraseInkSize ) throw (RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); mnEraseInkSize=nEraseInkSize; + mbSwitchPenMode = false; + mbSwitchEraserMode = true; if( maPresSettings.mbMouseAsPen ) setUsePen( sal_True ); // update erase ink size } +#endif // -------------------------------------------------------------------- // XSlideShowController Methods // -------------------------------------------------------------------- diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 627f4b027..888d18dc3 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -200,12 +200,17 @@ public: virtual void SAL_CALL setMouseVisible( ::sal_Bool _mousevisible ) throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getUsePen() throw (css::uno::RuntimeException); virtual void SAL_CALL setUsePen( ::sal_Bool _usepen ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getPenWidth() throw (css::uno::RuntimeException); - virtual void SAL_CALL setPenWidth( double dStrokeWidth ) throw (css::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getPenColor() throw (css::uno::RuntimeException); virtual void SAL_CALL setPenColor( ::sal_Int32 _pencolor ) throw (css::uno::RuntimeException); +#ifdef ENABLE_PRESENTER_EXTRA_UI + virtual void SAL_CALL setUseEraser( ::sal_Bool _usepen ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getPenWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPenWidth( double dStrokeWidth ) throw (css::uno::RuntimeException); virtual void SAL_CALL setEraseAllInk( bool bEraseAllInk ) throw (css::uno::RuntimeException); - virtual void SAL_CALL setEraseInk( double nEraseInkSize ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setEraseInk( sal_Int32 nEraseInkSize ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setPenMode( bool bSwitchPenMode) throw (css::uno::RuntimeException); + virtual void SAL_CALL setEraserMode( bool bSwitchEraserMode ) throw (css::uno::RuntimeException); +#endif virtual ::sal_Bool SAL_CALL isRunning( ) throw (css::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getSlideCount( ) throw (css::uno::RuntimeException); virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getSlideByIndex( ::sal_Int32 Index ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException); @@ -384,10 +389,15 @@ private: PresentationSettings maPresSettings; sal_Int32 mnUserPaintColor; - double mdUserPaintStrokeWidth; + +#ifdef ENABLE_PRESENTER_EXTRA_UI + bool mbSwitchPenMode; + bool mbSwitchEraserMode; + double mdUserPaintStrokeWidth; bool mbEraseAllInk; - bool mbEraseInk; - double mnEraseInkSize; +// bool mbEraseInk; + sal_Int32 mnEraseInkSize; +#endif /// used in updateHdl to prevent recursive calls sal_Int32 mnEntryCounter; diff --git a/slideshow/source/engine/color.cxx b/slideshow/source/engine/color.cxx index c33bb0282..639a0ace4 100644 --- a/slideshow/source/engine/color.cxx +++ b/slideshow/source/engine/color.cxx @@ -267,6 +267,19 @@ namespace slideshow getLuminance() ) ); 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 ) { diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index 8fbddaee3..9e1369f95 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 ba00e028b..6d4b182f2 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 2bee868ea..d6da57027 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 60865eda7..fc2fc28a6 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 >& xDrawPage, 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 >& xDrawP 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 3135bbb03..04ed29e58 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,20 +184,33 @@ namespace slideshow mrScreenUpdater.notifyUpdate(*aIter,true); } + maPolygons.clear(); } - mbIsEraseAllModeActivated=false; - return true; + mbIsEraseAllModeActivated=false; + return true; } - bool eraseInkChanged( double rEraseInkSize ) + bool eraseInkWidthChanged( sal_Int32 rEraseInkSize ) { - if(mbIsEraseModeActivated) - mbIsEraseModeActivated=false; - else - mbIsEraseModeActivated=true; + // Change the size + this->mnSize=rEraseInkSize; + // Changed to mode Erase + this->mbIsEraseModeActivated = true; return true; } - + + bool switchPenMode() + { + this->mbIsEraseModeActivated = false; + return true; + } + + bool switchEraserMode() + { + this->mbIsEraseModeActivated = true; + return true; + } + bool disable() { 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 f1b6300be..e9014bcd3 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,10 +1469,10 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) // enable user paint maEraseInk.reset( nEraseInk ); - maEventMultiplexer.notifyEraseInk( *maEraseInk ); + maEventMultiplexer.notifyEraseInkWidth( *maEraseInk ); } else - { + { // disable user paint maEraseInk.reset(); maEventMultiplexer.notifyUserPaintDisabled(); diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 39a506a11..9fc22fcb1 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,17 +710,27 @@ 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, const ::basegfx::B2DRectangle& rRect, ::cppcanvas::Color::IntSRGBA aFillColor ) diff --git a/slideshow/source/inc/eventmultiplexer.hxx b/slideshow/source/inc/eventmultiplexer.hxx index b25079a73..e0f1b423d 100644 --- a/slideshow/source/inc/eventmultiplexer.hxx +++ b/slideshow/source/inc/eventmultiplexer.hxx @@ -509,7 +509,9 @@ public: this event (and probably, nothing will happen at all) */ bool notifyEraseAllInk( bool const& rEraseAllInk ); - bool notifyEraseInk( double rEraseInkSize ); + bool notifySwitchPenMode(); + bool notifySwitchEraserMode(); + bool notifyEraseInkWidth( sal_Int32 rEraseInkSize ); /** Notify that user paint is disabled diff --git a/slideshow/source/inc/rgbcolor.hxx b/slideshow/source/inc/rgbcolor.hxx index 5248ffbed..c114c7a2d 100644 --- a/slideshow/source/inc/rgbcolor.hxx +++ b/slideshow/source/inc/rgbcolor.hxx @@ -89,7 +89,10 @@ namespace slideshow /** Create an integer sRGBA color. */ ::cppcanvas::Color::IntSRGBA getIntegerColor() const; - + + RGBColor(const RGBColor& rLHS); + RGBColor& operator=( const RGBColor& rLHS); + struct RGBTriple { RGBTriple(); diff --git a/slideshow/source/inc/shapeimporter.hxx b/slideshow/source/inc/shapeimporter.hxx index d7e2e1ed9..f78b47517 100644 --- a/slideshow/source/inc/shapeimporter.hxx +++ b/slideshow/source/inc/shapeimporter.hxx @@ -81,9 +81,9 @@ public: ShapeImporter( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, const ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPage >& xActualPage, - const ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPagesSupplier>& xPagesSupplier, + ::com::sun::star::drawing::XDrawPage >& xActualPage, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPagesSupplier>& xPagesSupplier, const SlideShowContext& rContext, sal_Int32 nOrdNumStart, bool bConvertingMasterPage ); diff --git a/slideshow/source/inc/userpainteventhandler.hxx b/slideshow/source/inc/userpainteventhandler.hxx index f8773a306..e357812e0 100644 --- a/slideshow/source/inc/userpainteventhandler.hxx +++ b/slideshow/source/inc/userpainteventhandler.hxx @@ -51,11 +51,12 @@ namespace slideshow { public: virtual ~UserPaintEventHandler() {} - virtual bool colorChanged( RGBColor const& rUserColor ) = 0; virtual bool widthChanged( double nUserStrokeWidth ) = 0; virtual bool eraseAllInkChanged(bool const& rEraseAllInk) =0; - virtual bool eraseInkChanged(double rEraseInkSize) =0; + virtual bool eraseInkWidthChanged(sal_Int32 rEraseInkSize) =0; + virtual bool switchEraserMode() = 0; + virtual bool switchPenMode() = 0; virtual bool disable() = 0; }; |