diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2010-01-29 14:38:09 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2010-01-29 14:38:09 +0100 |
commit | 7db24fbf87af39d77fe8c8c57d719cdbad153aac (patch) | |
tree | fadca73ca38cc6f3d4b61ef1c072db70e66da529 | |
parent | bdf06223c6c64e9baff7c835f75134a97073ade3 (diff) | |
parent | 84ed0f699225aa8271057920a62f4faa597a6654 (diff) |
CWS-TOOLING: integrate CWS eraser01
21 files changed, 1573 insertions, 145 deletions
diff --git a/sd/source/ui/slideshow/makefile.mk b/sd/source/ui/slideshow/makefile.mk index e157ba99d3bc..7055d723df55 100644 --- a/sd/source/ui/slideshow/makefile.mk +++ b/sd/source/ui/slideshow/makefile.mk @@ -43,6 +43,11 @@ AUTOSEG=true .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk +.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 f1cb2cf4afb9..fbcc0ffedfdf 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 8a9799321738..85b2cf0f3009 100644 --- a/sd/source/ui/slideshow/slideshow.hrc +++ b/sd/source/ui/slideshow/slideshow.hrc @@ -41,5 +41,26 @@ #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 ec57d3e84897..42459427f54f 100644 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -74,6 +74,125 @@ Menu RID_SLIDESHOW_CONTEXTMENU { Separator = TRUE; }; +#ifdef ENABLE_PRESENTER_EXTRA_UI + MenuItem + { + 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; + Text [ en-US ] = "~Thin"; + }; + MenuItem + { + Identifier = CM_WIDTH_PEN_NORMAL; + Text [ en-US ] = "~Normal"; + }; + MenuItem + { + Identifier = CM_WIDTH_PEN_THICK; + Text [ en-US ] = "~Thick"; + }; + MenuItem + { + Identifier = CM_WIDTH_PEN_VERY_THICK; + Text [ en-US ] = "~Very Thick"; + }; + }; + }; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = CM_COLOR_PEN ; + Text [ en-US ] = "~Change Pen Color" ; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = CM_ERASE_ALLINK ; + Text [ en-US ] = "~Erase All Ink On Slide" ; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = CM_ERASE_INK_PEN; + Text [ en-US ] = "~Eraser Width" ; + + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = CM_ERASE_INK_PEN_VERY_THIN; + Text [ en-US ] = "~Very thin"; + }; + MenuItem + { + Identifier = CM_ERASE_INK_PEN_THIN; + Text [ en-US ] = "~Thin"; + }; + MenuItem + { + Identifier = CM_ERASE_INK_PEN_NORMAL; + Text [ en-US ] = "~Normal"; + }; + MenuItem + { + Identifier = CM_ERASE_INK_PEN_THICK; + Text [ en-US ] = "~Thick"; + }; + MenuItem + { + Identifier = CM_ERASE_INK_PEN_VERY_THICK; + Text [ en-US ] = "~Very Thick"; + }; + }; + }; + }; +#endif + MenuItem + { + Separator = TRUE; + }; MenuItem { Identifier = CM_SCREEN; @@ -98,12 +217,8 @@ Menu RID_SLIDESHOW_CONTEXTMENU }; MenuItem { - Separator = TRUE; - }; - MenuItem - { Identifier = CM_ENDSHOW ; Text [ en-US ] = "~End Show" ; - }; + }; }; }; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index e59f45b71e12..8881706e62bb 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -34,6 +34,7 @@ #include <boost/scoped_ptr.hpp> +#include "com/sun/star/frame/XComponentLoader.hpp" #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/drawing/XMasterPageTarget.hpp> @@ -86,6 +87,7 @@ #include "canvas/elapsedtime.hxx" #include "canvas/prioritybooster.hxx" #include "avmedia/mediawindow.hxx" +#include "svtools/colrdlg.hxx" #include <boost/noncopyable.hpp> #include <boost/bind.hpp> @@ -169,9 +171,9 @@ public: bool nextSlide(); bool previousSlide(); - void displayCurrentSlide( - const Reference< XSlideShow >& xShow, - const bool bSkipAllMainSequenceEffects); + void displayCurrentSlide( const Reference< XSlideShow >& xShow, + const Reference< XDrawPagesSupplier>& xDrawPages, + const bool bSkipAllMainSequenceEffects ); sal_Int32 getNextSlideIndex() const; sal_Int32 getPreviousSlideIndex() const; @@ -468,9 +470,9 @@ bool AnimationSlideController::previousSlide() return jumpToSlideIndex( getPreviousSlideIndex() ); } -void AnimationSlideController::displayCurrentSlide( - const Reference< XSlideShow >& xShow, - const bool bSkipAllMainSequenceEffects) +void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow, + const Reference< XDrawPagesSupplier>& xDrawPages, + const bool bSkipAllMainSequenceEffects ) { const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber(); @@ -519,7 +521,7 @@ void AnimationSlideController::displayCurrentSlide( aPropertySequence[nIndex] = aProperties[nIndex]; if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) ) - xShow->displaySlide( xSlide, xAnimNode, aPropertySequence ); + xShow->displaySlide( xSlide, xDrawPages, xAnimNode, aPropertySequence ); } } @@ -554,7 +556,15 @@ SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, , mbInputFreeze(false) , mbActive(sal_False) , maPresSettings( pDoc->getPresentationSettings() ) -, mnUserPaintColor( 0x0000FF00L ) +, 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) +#endif , mnEntryCounter(0) , mnLastSlideNumber(-1) , msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ) @@ -1121,7 +1131,8 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) aProperties.push_back( beans::PropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("UserPaintColor") ), - -1, Any( static_cast<sal_Int32>(0x0000FF00L) ), + // User paint color is black by default. + -1, Any( static_cast<sal_Int32>(0x00000000L) ), beans::PropertyState_DIRECT_VALUE ) ); } @@ -1431,7 +1442,9 @@ void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects) if( mpSlideController.get() && mxShow.is() ) { - mpSlideController->displayCurrentSlide( mxShow, bSkipAllMainSequenceEffects ); + Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), + UNO_QUERY_THROW ); + mpSlideController->displayCurrentSlide( mxShow, xDrawPages, bSkipAllMainSequenceEffects ); registerShapeEvents(mpSlideController->getCurrentSlideNumber()); update(); @@ -1448,6 +1461,14 @@ void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects) 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) ); } @@ -2182,6 +2203,17 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) PopupMenu* pMenu = new PopupMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) ); +#ifdef ENABLE_PRESENTER_EXTRA_UI + //adding button to contextual menu for erasing functionnalities for UserPaintOverlay + pMenu->EnableItem( CM_ERASE_ALLINK, (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(); pMenu->EnableItem( CM_NEXT_SLIDE, ( mpSlideController->getNextSlideIndex() != -1 ) ); pMenu->EnableItem( CM_PREV_SLIDE, ( mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ); @@ -2248,6 +2280,105 @@ 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 ) + { + if(! maPresSettings.mbMouseAsPen) + { + pMenu->EnableItem( CM_WIDTH_PEN, FALSE ); + } + else + { + sal_Int32 nIterator; + double nWidth; + + nWidth = 4.0; + for( nIterator = 1; nIterator < 6; nIterator++) + { + switch(nIterator) + { + case 1: + nWidth = 4.0; + break; + case 2: + nWidth = 100.0; + break; + case 3: + nWidth = 150.0; + break; + case 4: + nWidth = 200.0; + break; + case 5: + nWidth = 400.0; + break; + default: + break; + } + + pWidthMenu->EnableItem( (USHORT)(CM_WIDTH_PEN + nIterator), TRUE); + if( nWidth == mdUserPaintStrokeWidth) + pWidthMenu->CheckItem( (USHORT)(CM_WIDTH_PEN + nIterator) ); + + } + } + } + + + PopupMenu* pEraseWidthMenu = pMenu->GetPopupMenu( CM_ERASE_INK_PEN); + + // populate eraser width list + if( pEraseWidthMenu ) + { + if(! maPresSettings.mbMouseAsPen) + { + pMenu->EnableItem( CM_ERASE_INK_PEN, FALSE ); + } + else + { + sal_Int32 nEIterator; + double nEWidth; + + nEWidth = 100.0; + for( nEIterator = 1; nEIterator < 6; nEIterator++) + { + switch(nEIterator) + { + case 1: + nEWidth = 100.0; + break; + case 2: + nEWidth = 200.0; + break; + case 3: + nEWidth = 300.0; + break; + case 4: + nEWidth = 400.0; + break; + case 5: + nEWidth = 500.0; + break; + default: + break; + } + + 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)); + + } + } + } +#endif pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) ); pMenu->Execute( mpShowWindow, maPopupMousePos ); @@ -2311,32 +2442,139 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) } } break; +#ifdef ENABLE_PRESENTER_EXTRA_UI + if( maPresSettings.mbMouseAsPen ) + { + case CM_COLOR_PEN: + { + //Open a color picker based on SvColorDialog + ::Color aColor( mnUserPaintColor ); + SvColorDialog aColorDlg( mpShowWindow); + aColorDlg.SetColor( aColor ); - case CM_ENDSHOW: - // in case the user cancels the presentation, switch to current slide - // in edit mode - if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) ) - { - if( mpSlideController->getCurrentSlideNumber() != -1 ) + if (aColorDlg.Execute() ) + { + aColor = aColorDlg.GetColor(); + mnUserPaintColor = aColor.GetColor(); + setPenColor(mnUserPaintColor); + } + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_VERY_THIN: { - mnRestoreSlide = mpSlideController->getCurrentSlideNumber(); + setPenWidth(4.0); + mbWasPaused = false; } - } - endPresentation(); - break; - default: - sal_Int32 nPageNumber = nMenuId - CM_SLIDES; - const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); - if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) - { - mpShowWindow->RestartShow( nPageNumber ); - } - else if( nPageNumber != mpSlideController->getCurrentSlideNumber() ) - { - displaySlideNumber( nPageNumber ); - } - mbWasPaused = false; - break; + break; + + case CM_WIDTH_PEN_THIN: + { + setPenWidth(100.0); + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_NORMAL: + { + setPenWidth(150.0); + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_THICK: + { + setPenWidth(200.0); + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_VERY_THICK: + { + setPenWidth(400.0); + mbWasPaused = false; + } + break; + 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); + mbWasPaused = false; + } + break; + + case CM_ERASE_INK_PEN_THIN: + { + setEraseInk(200); + mbWasPaused = false; + } + break; + + case CM_ERASE_INK_PEN_NORMAL: + { + setEraseInk(300); + mbWasPaused = false; + } + break; + + case CM_ERASE_INK_PEN_THICK: + { + setEraseInk(400); + mbWasPaused = false; + } + break; + case CM_ERASE_INK_PEN_VERY_THICK: + { + setEraseInk(500); + mbWasPaused = false; + } + break; + } +#endif + + case CM_ENDSHOW: + // in case the user cancels the presentation, switch to current slide + // in edit mode + if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) ) + { + if( mpSlideController->getCurrentSlideNumber() != -1 ) + { + mnRestoreSlide = mpSlideController->getCurrentSlideNumber(); + } + } + endPresentation(); + break; + default: + sal_Int32 nPageNumber = nMenuId - CM_SLIDES; + const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); + if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) + { + mpShowWindow->RestartShow( nPageNumber ); + } + else if( nPageNumber != mpSlideController->getCurrentSlideNumber() ) + { + displaySlideNumber( nPageNumber ); + } + mbWasPaused = false; + break; } } @@ -2919,16 +3157,46 @@ 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 ) + aValueWidth <<= mdUserPaintStrokeWidth; + + beans::PropertyValue aPenPropWidth; + aPenPropWidth.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserPaintStrokeWidth" )); + aPenPropWidth.Value = aValueWidth; + + mxShow->setProperty( aPenPropWidth ); + + // for Pen Mode + Any aValueSwitchPenMode; + if( maPresSettings.mbMouseAsPen ) + 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 ) { @@ -2942,6 +3210,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) @@ -2956,10 +3282,71 @@ 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) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mbEraseAllInk=bEraseAllInk; + mbSwitchPenMode = true; + mbSwitchEraserMode = false; + if( maPresSettings.mbMouseAsPen ) + setUsePen( sal_True ); // update erase all ink bool +} + + +void SAL_CALL SlideshowImpl::setEraseInk( sal_Int32 nEraseInkSize ) throw (RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mnEraseInkSize=nEraseInkSize; + mbSwitchPenMode = false; + mbSwitchEraserMode = true; + if( maPresSettings.mbMouseAsPen ) + setUseEraser( 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 96b24913c45e..b98f05961816 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -202,6 +202,15 @@ public: virtual void SAL_CALL setUsePen( ::sal_Bool _usepen ) 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( 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); @@ -391,6 +400,14 @@ private: PresentationSettings maPresSettings; sal_Int32 mnUserPaintColor; +#ifdef ENABLE_PRESENTER_EXTRA_UI + bool mbSwitchPenMode; + bool mbSwitchEraserMode; + double mdUserPaintStrokeWidth; + bool mbEraseAllInk; +// 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 a7a7088a302f..a6ffbb492066 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 d62a7946d3c7..0d3579f7be48 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -262,8 +262,7 @@ struct EventMultiplexerImpl std::vector<ShapeCursorEventHandlerSharedPtr> > ImplShapeCursorHandlers; typedef ThreadUnsafeListenerContainer< PrioritizedHandlerEntry<HyperlinkHandler>, - std::vector< - PrioritizedHandlerEntry<HyperlinkHandler> > > ImplHyperLinkHandlers; + std::vector<PrioritizedHandlerEntry<HyperlinkHandler> > > ImplHyperLinkHandlers; template <typename XSlideShowViewFunc> void forEachView( XSlideShowViewFunc pViewMethod ); @@ -1078,12 +1077,48 @@ bool EventMultiplexer::notifyUserPaintColor( RGBColor const& rUserColor ) boost::cref(rUserColor))); } +bool EventMultiplexer::notifyUserPaintStrokeWidth( double rUserStrokeWidth ) +{ + return mpImpl->maUserPaintEventHandlers.applyAll( + boost::bind(&UserPaintEventHandler::widthChanged, + _1, + rUserStrokeWidth)); +} + 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 ) +{ + return mpImpl->maUserPaintEventHandlers.applyAll( + boost::bind(&UserPaintEventHandler::eraseAllInkChanged, + _1, + boost::cref(rEraseAllInk))); +} + +//adding erasing features with UserPaintOverlay +bool EventMultiplexer::notifyEraseInkWidth( sal_Int32 rEraseInkSize ) +{ + return mpImpl->maUserPaintEventHandlers.applyAll( + boost::bind(&UserPaintEventHandler::eraseInkWidthChanged, + _1, + boost::cref(rEraseInkSize))); +} + bool EventMultiplexer::notifyNextEffect() { return mpImpl->notifyNextEffect(); diff --git a/slideshow/source/engine/makefile.mk b/slideshow/source/engine/makefile.mk index 84afa7fb657e..2b640b6e8a39 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 ---------------------------------------------------------- ENVCFLAGS += -DBOOST_SPIRIT_USE_OLD_NAMESPACE diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 61f4d30fe2fc..a524aa697935 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -39,9 +39,22 @@ #include <goodies/grfmgr.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/streamwrap.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <cppcanvas/basegfxfactory.hxx> +#include <cppcanvas/polypolygon.hxx> #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/drawing/ColorMode.hpp> #include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/drawing/PointSequenceSequence.hpp> +#include <com/sun/star/drawing/PointSequence.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/drawing/XLayerSupplier.hpp> +#include <com/sun/star/drawing/XLayerManager.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include "drawshapesubsetting.hxx" #include "drawshape.hxx" @@ -52,11 +65,13 @@ #include "slideshowexceptions.hxx" #include "gdimtftools.hxx" #include "tools.hxx" +#include "slideshowcontext.hxx" #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> using namespace com::sun::star; +using namespace ::comphelper; namespace slideshow { namespace internal { @@ -436,7 +451,8 @@ ShapeSharedPtr ShapeImporter::createShape( bool ShapeImporter::isSkip( uno::Reference<beans::XPropertySet> const& xPropSet, - rtl::OUString const& shapeType ) const + rtl::OUString const& shapeType, + uno::Reference< drawing::XLayer> const& xLayer ) { // skip empty presentation objects: bool bEmpty = false; @@ -448,6 +464,26 @@ bool ShapeImporter::isSkip( return true; } + //skip shapes which corresponds to annotations + if(xLayer.is()) + { + rtl::OUString layerName; + uno::Reference<beans::XPropertySet> xPropLayerSet( + xLayer, uno::UNO_QUERY ); + const uno::Any& a(xPropLayerSet->getPropertyValue(rtl::OUString::createFromAscii("Name")) ); + bool const bRet = (a >>= layerName); + if(bRet) + { + if( layerName.equals(rtl::OUString::createFromAscii("DrawnInSlideshow"))) + { + //Transform shapes into PolyPolygons + importPolygons(xPropSet); + + return true; + } + } + } + // don't export presentation placeholders on masterpage // they can be non empty when user edits the default texts if(mbConvertingMasterPage) @@ -465,6 +501,46 @@ bool ShapeImporter::isSkip( return false; } + +void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xPropSet) { + + drawing::PointSequenceSequence aRetval; + sal_Int32 nLineColor=0; + double fLineWidth; + getPropertyValue( aRetval, xPropSet, OUSTR("PolyPolygon") ); + getPropertyValue( nLineColor, xPropSet, OUSTR("LineColor") ); + getPropertyValue( fLineWidth, xPropSet, OUSTR("LineWidth") ); + + drawing::PointSequence* pOuterSequence = aRetval.getArray(); + awt::Point* pInnerSequence = pOuterSequence->getArray(); + + ::basegfx::B2DPolygon aPoly; + basegfx::B2DPoint aPoint; + for( sal_Int32 nCurrPoly=0; nCurrPoly<pOuterSequence->getLength(); ++nCurrPoly ) + { + aPoint.setX((*pInnerSequence).X); + aPoint.setY((*pInnerSequence).Y); + aPoly.append( aPoint ); + *pInnerSequence++; + } + UnoViewVector::const_iterator aIter=(mrContext.mrViewContainer).begin(); + UnoViewVector::const_iterator aEnd=(mrContext.mrViewContainer).end(); + while(aIter != aEnd) + { + ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( + ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), + aPoly ) ); + if( pPolyPoly ) + { + pPolyPoly->setRGBALineColor( unoColor2RGBColor( nLineColor ).getIntegerColor() ); + pPolyPoly->setStrokeWidth(fLineWidth); + pPolyPoly->draw(); + maPolygons.push_back(pPolyPoly); + } + aIter++; + } +} + ShapeSharedPtr ShapeImporter::importBackgroundShape() // throw (ShapeLoadFailedException) { if( maShapesStack.empty() ) @@ -506,10 +582,23 @@ ShapeSharedPtr ShapeImporter::importShape() // throw (ShapeLoadFailedException) throw ShapeLoadFailedException(); } - rtl::OUString const shapeType( xCurrShape->getShapeType() ); + //Retrieve the layer for the current shape + uno::Reference< drawing::XLayer > xDrawnInSlideshow; + + uno::Reference< drawing::XLayerSupplier > xLayerSupplier(mxPagesSupplier, uno::UNO_QUERY); + if(xLayerSupplier.is()) + { + uno::Reference< container::XNameAccess > xNameAccess = xLayerSupplier->getLayerManager(); + + uno::Reference< drawing::XLayerManager > xLayerManager(xNameAccess, uno::UNO_QUERY); + + xDrawnInSlideshow = xLayerManager->getLayerForShape(xCurrShape); + } + + rtl::OUString const shapeType( xCurrShape->getShapeType()); // is this shape presentation-invisible? - if( !isSkip(xPropSet, shapeType) ) + if( !isSkip(xPropSet, shapeType, xDrawnInSlideshow) ) { bIsGroupShape = shapeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( @@ -549,17 +638,32 @@ bool ShapeImporter::isImportDone() const return maShapesStack.empty(); } -ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const& xPage, - uno::Reference<drawing::XDrawPage> const& xActualPage, - const SlideShowContext& rContext, - sal_Int32 nOrdNumStart, - bool bConvertingMasterPage ) : +PolyPolygonVector ShapeImporter::getPolygons() +{ + return maPolygons; +} + +ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const& xPage, + uno::Reference<drawing::XDrawPage> const& xActualPage, + uno::Reference<drawing::XDrawPagesSupplier> const& xPagesSupplier, + const SlideShowContext& rContext, + sal_Int32 nOrdNumStart, + bool bConvertingMasterPage ) : mxPage( xActualPage ), +#ifdef ENABLE_PRESENTER_EXTRA_UI + mxPagesSupplier( xPagesSupplier ), +#else + mxPagesSupplier( NULL ), +#endif mrContext( rContext ), + maPolygons(), maShapesStack(), mnAscendingPrio( nOrdNumStart ), mbConvertingMasterPage( bConvertingMasterPage ) { +#ifndef ENABLE_PRESENTER_EXTRA_UI + (void)xPagesSupplier; +#endif uno::Reference<drawing::XShapes> const xShapes( xPage, uno::UNO_QUERY_THROW ); maShapesStack.push( XShapesEntry(xShapes) ); diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 84b6ad7b4305..b036c9373fc7 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -81,7 +81,7 @@ #include <iterator> #include <algorithm> #include <functional> - +#include <iostream> using namespace ::com::sun::star; @@ -101,6 +101,7 @@ class SlideImpl : public Slide, { public: SlideImpl( const uno::Reference<drawing::XDrawPage>& xDrawPage, + const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages, const uno::Reference<animations::XAnimationNode>& xRootNode, EventQueue& rEventQueue, EventMultiplexer& rEventMultiplexer, @@ -112,7 +113,9 @@ public: const uno::Reference<uno::XComponentContext>& xContext, const ShapeEventListenerMap& rShapeListenerMap, const ShapeCursorMap& rShapeCursorMap, + const PolyPolygonVector& rPolyPolygonVector, RGBColor const& rUserPaintColor, + double dUserPaintStrokeWidth, bool bUserPaintEnabled, bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ); @@ -136,6 +139,9 @@ public: virtual basegfx::B2ISize getSlideSize() const; virtual uno::Reference<drawing::XDrawPage > getXDrawPage() const; virtual uno::Reference<animations::XAnimationNode> getXAnimationNode() const; + virtual PolyPolygonVector getPolygons(); + virtual void drawPolygons() const; + virtual bool isPaintOverlayActive() const; // TODO(F2): Rework SlideBitmap to no longer be based on XBitmap, // but on canvas-independent basegfx bitmaps @@ -201,6 +207,8 @@ private: /// End GIF and other intrinsic shape animations void startIntrinsicAnimations(); + /// Add Polygons to the member maPolygons + void addPolygons(PolyPolygonVector aPolygons); // Types // ===== @@ -230,6 +238,7 @@ private: /// The page model object uno::Reference< drawing::XDrawPage > mxDrawPage; + uno::Reference< drawing::XDrawPagesSupplier > mxDrawPagesSupplier; uno::Reference< animations::XAnimationNode > mxRootNode; LayerManagerSharedPtr mpLayerManager; @@ -244,8 +253,10 @@ private: /// Handles the animation and event generation for us SlideAnimations maAnimations; + PolyPolygonVector maPolygons; RGBColor maUserPaintColor; + double mdUserPaintStrokeWidth; UserPaintOverlaySharedPtr mpPaintOverlay; /// Bitmaps with slide content at various states @@ -287,6 +298,9 @@ private: /// When true, show() was called. Slide hidden oherwise. bool mbActive; + + ///When true, enablePaintOverlay was called and mbUserPaintOverlay = true + bool mbPaintOverlayActive; }; @@ -335,6 +349,7 @@ private: SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDrawPage, + const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages, const uno::Reference< animations::XAnimationNode >& xRootNode, EventQueue& rEventQueue, EventMultiplexer& rEventMultiplexer, @@ -346,11 +361,14 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra const uno::Reference< uno::XComponentContext >& xComponentContext, const ShapeEventListenerMap& rShapeListenerMap, const ShapeCursorMap& rShapeCursorMap, + const PolyPolygonVector& rPolyPolygonVector, RGBColor const& aUserPaintColor, + double dUserPaintStrokeWidth, bool bUserPaintEnabled, bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) : mxDrawPage( xDrawPage ), + mxDrawPagesSupplier( xDrawPages ), mxRootNode( xRootNode ), mpLayerManager( new LayerManager( rViewContainer, @@ -375,7 +393,9 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mrCursorManager( rCursorManager ), maAnimations( maContext, getSlideSizeImpl() ), + maPolygons(rPolyPolygonVector), maUserPaintColor(aUserPaintColor), + mdUserPaintStrokeWidth(dUserPaintStrokeWidth), mpPaintOverlay(), maSlideBitmaps(), meAnimationState( CONSTRUCTING_STATE ), @@ -387,7 +407,8 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mbShowLoaded( false ), mbHaveAnimations( false ), mbMainSequenceFound( false ), - mbActive( false ) + mbActive( false ), + mbPaintOverlayActive( false ) { // clone already existing views for slide bitmaps std::for_each( rViewContainer.begin(), @@ -436,6 +457,9 @@ void SlideImpl::dispose() mpShapeManager.reset(); mxRootNode.clear(); mxDrawPage.clear(); +#ifndef ENABLE_PRESENTER_EXTRA_UI + mxDrawPagesSupplier.clear(); +#endif } bool SlideImpl::prefetch() @@ -583,6 +607,12 @@ uno::Reference<animations::XAnimationNode> SlideImpl::getXAnimationNode() const return mxRootNode; } +PolyPolygonVector SlideImpl::getPolygons() +{ + if(mbPaintOverlayActive) + maPolygons = mpPaintOverlay->getPolygons(); + return maPolygons; +} SlideBitmapSharedPtr SlideImpl::getCurrentSlideBitmap( const UnoViewSharedPtr& rView ) const { @@ -862,14 +892,47 @@ bool SlideImpl::implPrefetchShow() void SlideImpl::enablePaintOverlay() { if( mbUserPaintOverlayEnabled ) + { mpPaintOverlay = UserPaintOverlay::create( maUserPaintColor, - 2.0, - maContext ); + mdUserPaintStrokeWidth, + maContext, + maPolygons ); + mbPaintOverlayActive = true; + } +} + +void SlideImpl::drawPolygons() const +{ + if( mbUserPaintOverlayEnabled ) + mpPaintOverlay->drawPolygons(); +} + +void SlideImpl::addPolygons(PolyPolygonVector aPolygons) +{ + if(!aPolygons.empty()) + { + for( PolyPolygonVector::iterator aIter=aPolygons.begin(), + aEnd=aPolygons.end(); + aIter!=aEnd; + ++aIter ) + { + maPolygons.push_back(*aIter); + } + } +} + +bool SlideImpl::isPaintOverlayActive() const +{ + return mbPaintOverlayActive; } void SlideImpl::disablePaintOverlay() { + if(mbPaintOverlayActive) + maPolygons = mpPaintOverlay->getPolygons(); + mpPaintOverlay.reset(); + mbPaintOverlayActive = false; } ::basegfx::B2DRectangle SlideImpl::getSlideRect() const @@ -1073,6 +1136,7 @@ bool SlideImpl::loadShapes() // ------------------------------------------------------------------------- ShapeImporter aMPShapesFunctor( xMasterPage, mxDrawPage, + mxDrawPagesSupplier, maContext, 0, /* shape num starts at 0 */ true ); @@ -1087,6 +1151,7 @@ bool SlideImpl::loadShapes() if( rShape ) mpLayerManager->addShape( rShape ); } + addPolygons(aMPShapesFunctor.getPolygons()); nCurrCount = xMasterPageShapes->getCount() + 1; } @@ -1121,6 +1186,7 @@ bool SlideImpl::loadShapes() ShapeImporter aShapesFunctor( mxDrawPage, mxDrawPage, + mxDrawPagesSupplier, maContext, nCurrCount, false ); @@ -1132,6 +1198,7 @@ bool SlideImpl::loadShapes() if( rShape ) mpLayerManager->addShape( rShape ); } + addPolygons(aShapesFunctor.getPolygons()); } catch( uno::RuntimeException& ) { @@ -1176,6 +1243,7 @@ basegfx::B2ISize SlideImpl::getSlideSizeImpl() const SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& xDrawPage, + const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages, const uno::Reference< animations::XAnimationNode >& xRootNode, EventQueue& rEventQueue, EventMultiplexer& rEventMultiplexer, @@ -1187,18 +1255,25 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& const uno::Reference< uno::XComponentContext >& xComponentContext, const ShapeEventListenerMap& rShapeListenerMap, const ShapeCursorMap& rShapeCursorMap, + const PolyPolygonVector& rPolyPolygonVector, RGBColor const& rUserPaintColor, + double dUserPaintStrokeWidth, bool bUserPaintEnabled, bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) { - boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xRootNode, rEventQueue, +#ifdef ENABLE_PRESENTER_EXTRA_UI + boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, +#else + (void)xDrawPages; + boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, NULL, xRootNode, rEventQueue, +#endif rEventMultiplexer, rScreenUpdater, rActivitiesQueue, rUserEventQueue, rCursorManager, rViewContainer, xComponentContext, rShapeListenerMap, - rShapeCursorMap, rUserPaintColor, - bUserPaintEnabled, + rShapeCursorMap, rPolyPolygonVector, rUserPaintColor, + dUserPaintStrokeWidth, bUserPaintEnabled, bIntrinsicAnimationsAllowed, bDisableAnimationZOrder )); diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index 5cdfbddc1193..cfcb6a1918dc 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -54,7 +54,8 @@ #include <boost/bind.hpp> #include <boost/noncopyable.hpp> - +#include "slide.hxx" +#include "cursormanager.hxx" using namespace ::com::sun::star; @@ -63,29 +64,40 @@ namespace slideshow namespace internal { class PaintOverlayHandler : public MouseEventHandler, - public ViewEventHandler + public ViewEventHandler, + public UserPaintEventHandler { public: - PaintOverlayHandler( const RGBColor& rStrokeColor, - double nStrokeWidth, - ActivitiesQueue& rActivitiesQueue, - ScreenUpdater& rScreenUpdater, - const UnoViewContainer& rViews ) : + PaintOverlayHandler( const RGBColor& rStrokeColor, + double nStrokeWidth, + ActivitiesQueue& rActivitiesQueue, + ScreenUpdater& rScreenUpdater, + const UnoViewContainer& rViews, + Slide& rSlide, + const PolyPolygonVector& rPolygons ) : mrActivitiesQueue( rActivitiesQueue ), mrScreenUpdater( rScreenUpdater ), maViews(), + maPolygons( rPolygons ), maStrokeColor( rStrokeColor ), mnStrokeWidth( nStrokeWidth ), maLastPoint(), maLastMouseDownPos(), mbIsLastPointValid( false ), - mbIsLastMouseDownPosValid( false ) + mbIsLastMouseDownPosValid( false ), + //handle the "remove all ink from slide" mode of erasing + mbIsEraseAllModeActivated( false ), + //handle the "remove stroke by stroke" mode of erasing + mbIsEraseModeActivated( false ), + mrSlide(rSlide), + mnSize(100) { std::for_each( rViews.begin(), rViews.end(), boost::bind( &PaintOverlayHandler::viewAdded, this, _1 )); + drawPolygons(); } virtual void dispose() @@ -118,9 +130,120 @@ namespace slideshow // polygon and repaint here. } + bool colorChanged( RGBColor const& rUserColor ) + { + this->maStrokeColor = rUserColor; + this->mbIsEraseModeActivated = false; + return true; + } + + bool widthChanged( double nUserStrokeWidth ) + { + this->mnStrokeWidth = nUserStrokeWidth; + mbIsEraseModeActivated = false; + return true; + } + + bool eraseAllInkChanged( bool const& 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; + ++aIter ) + { + // fully clear view content to background color + (*aIter)->getCanvas()->clear(); + + //get via SlideImpl instance the bitmap of the slide unmodified to redraw it + SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) ); + ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() ); + + const ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() ); + const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); + + // setup a canvas with device coordinate space, the slide + // bitmap already has the correct dimension. + ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); + + pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + + // render at given output position + pBitmap->move( aOutPosPixel ); + + // clear clip (might have been changed, e.g. from comb + // transition) + pBitmap->clip( ::basegfx::B2DPolyPolygon() ); + pBitmap->draw( pDevicePixelCanvas ); + + mrScreenUpdater.notifyUpdate(*aIter,true); + } + maPolygons.clear(); + } + 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 switchPenMode() + { + this->mbIsEraseModeActivated = false; + return true; + } + + bool switchEraserMode() + { + this->mbIsEraseModeActivated = true; + return true; + } + + bool disable() + { + return true; + } + + //Draw all registered polygons. + void drawPolygons() + { + for( PolyPolygonVector::iterator aIter=maPolygons.begin(), aEnd=maPolygons.end(); + aIter!=aEnd; + ++aIter ) + { + (*aIter)->draw(); + } + // screen update necessary to show painting + mrScreenUpdater.notifyUpdate(); + } + + //Retrieve all registered polygons. + PolyPolygonVector getPolygons() + { + return maPolygons; + } + // MouseEventHandler methods virtual bool handleMousePressed( const awt::MouseEvent& e ) { + if (e.Buttons == awt::MouseButton::RIGHT) + { + mbIsLastPointValid = false; + return false; + } + if (e.Buttons != awt::MouseButton::LEFT) return false; @@ -135,6 +258,12 @@ namespace slideshow virtual bool handleMouseReleased( const awt::MouseEvent& e ) { + if (e.Buttons == awt::MouseButton::RIGHT) + { + mbIsLastPointValid = false; + return false; + } + if (e.Buttons != awt::MouseButton::LEFT) return false; @@ -180,42 +309,110 @@ namespace slideshow virtual bool handleMouseDragged( const awt::MouseEvent& e ) { - if( !mbIsLastPointValid ) - { - mbIsLastPointValid = true; - maLastPoint.setX( e.X ); - maLastPoint.setY( e.Y ); - } - else + if(mbIsEraseModeActivated) { + //define the last point as an object + //we suppose that there's no way this point could be valid ::basegfx::B2DPolygon aPoly; + + maLastPoint.setX( e.X-mnSize ); + maLastPoint.setY( e.Y-mnSize ); + aPoly.append( maLastPoint ); - maLastPoint.setX( e.X ); - maLastPoint.setY( e.Y ); + maLastPoint.setX( e.X-mnSize ); + maLastPoint.setY( e.Y+mnSize ); aPoly.append( maLastPoint ); + maLastPoint.setX( e.X+mnSize ); + maLastPoint.setY( e.Y+mnSize ); - // paint to all views - for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); - aIter!=aEnd; - ++aIter ) + aPoly.append( maLastPoint ); + maLastPoint.setX( e.X+mnSize ); + maLastPoint.setY( e.Y-mnSize ); + + aPoly.append( maLastPoint ); + maLastPoint.setX( e.X-mnSize ); + maLastPoint.setY( e.Y-mnSize ); + + aPoly.append( maLastPoint ); + + //now we have defined a Polygon that is closed + + //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(); + aIter!=aEnd; + ++aIter ) { - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), - aPoly ) ); - if( pPolyPoly ) + //get via SlideImpl instance the bitmap of the slide unmodified to redraw it + SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) ); + ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() ); + + ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() ); + const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); + + // setup a canvas with device coordinate space, the slide + // bitmap already has the correct dimension. + ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); + + pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + + // render at given output position + pBitmap->move( aOutPosPixel ); + + ::basegfx::B2DPolyPolygon aPolyPoly=::basegfx::B2DPolyPolygon(aPoly); + aViewTransform.translate(-aOutPosPixel.getX(), -aOutPosPixel.getY()); + aPolyPoly.transform(aViewTransform); + // set clip so that we just redraw a part of the canvas + pBitmap->clip(aPolyPoly); + pBitmap->draw( pDevicePixelCanvas ); + + mrScreenUpdater.notifyUpdate(*aIter,true); + } + + } + else + { + if( !mbIsLastPointValid ) + { + mbIsLastPointValid = true; + maLastPoint.setX( e.X ); + maLastPoint.setY( e.Y ); + } + else + { + ::basegfx::B2DPolygon aPoly; + aPoly.append( maLastPoint ); + + maLastPoint.setX( e.X ); + maLastPoint.setY( e.Y ); + + aPoly.append( maLastPoint ); + + // paint to all views + for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); + aIter!=aEnd; + ++aIter ) { - pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); - pPolyPoly->draw(); + ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( + ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), + aPoly ) ); + + if( pPolyPoly ) + { + pPolyPoly->setStrokeWidth(mnStrokeWidth); + pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); + pPolyPoly->draw(); + maPolygons.push_back(pPolyPoly); + } } - } - // screen update necessary to show painting - mrScreenUpdater.notifyUpdate(); + // screen update necessary to show painting + mrScreenUpdater.notifyUpdate(); + } } - // mouse events captured return true; } @@ -226,42 +423,67 @@ namespace slideshow return false; // did not handle the event } + + private: ActivitiesQueue& mrActivitiesQueue; ScreenUpdater& mrScreenUpdater; UnoViewVector maViews; + PolyPolygonVector maPolygons; RGBColor maStrokeColor; double mnStrokeWidth; basegfx::B2DPoint maLastPoint; basegfx::B2DPoint maLastMouseDownPos; bool mbIsLastPointValid; bool mbIsLastMouseDownPosValid; + // added bool for erasing purpose : + bool mbIsEraseAllModeActivated; + bool mbIsEraseModeActivated; + Slide& mrSlide; + sal_Int32 mnSize; }; - UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor, - double nStrokeWidth, - const SlideShowContext& rContext ) + UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor, + double nStrokeWidth, + const SlideShowContext& rContext, + const PolyPolygonVector& rPolygons ) { UserPaintOverlaySharedPtr pRet( new UserPaintOverlay( rStrokeColor, nStrokeWidth, - rContext )); + rContext, + rPolygons )); return pRet; } - UserPaintOverlay::UserPaintOverlay( const RGBColor& rStrokeColor, - double nStrokeWidth, - const SlideShowContext& rContext ) : + UserPaintOverlay::UserPaintOverlay( const RGBColor& rStrokeColor, + double nStrokeWidth, + const SlideShowContext& rContext, + const PolyPolygonVector& rPolygons ) : mpHandler( new PaintOverlayHandler( rStrokeColor, nStrokeWidth, rContext.mrActivitiesQueue, rContext.mrScreenUpdater, - rContext.mrViewContainer )), + rContext.mrViewContainer, + //adding a link to Slide + dynamic_cast<Slide&>(rContext.mrCursorManager), + rPolygons )), mrMultiplexer( rContext.mrEventMultiplexer ) { mrMultiplexer.addClickHandler( mpHandler, 3.0 ); mrMultiplexer.addMouseMoveHandler( mpHandler, 3.0 ); mrMultiplexer.addViewHandler( mpHandler ); + mrMultiplexer.addUserPaintHandler(mpHandler); + } + + PolyPolygonVector UserPaintOverlay::getPolygons() + { + return mpHandler->getPolygons(); + } + + void UserPaintOverlay::drawPolygons() + { + mpHandler->drawPolygons(); } UserPaintOverlay::~UserPaintOverlay() @@ -273,7 +495,8 @@ namespace slideshow mrMultiplexer.removeViewHandler( mpHandler ); mpHandler->dispose(); } - catch (uno::Exception &) { + catch (uno::Exception &) + { OSL_ENSURE( false, rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), diff --git a/slideshow/source/engine/slide/userpaintoverlay.hxx b/slideshow/source/engine/slide/userpaintoverlay.hxx index 34a171f1740c..bc85ff649adb 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.hxx +++ b/slideshow/source/engine/slide/userpaintoverlay.hxx @@ -38,7 +38,7 @@ #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> - +#include <vector> /* Definition of UserPaintOverlay class */ @@ -51,7 +51,7 @@ namespace slideshow class PaintOverlayHandler; typedef ::boost::shared_ptr< class UserPaintOverlay > UserPaintOverlaySharedPtr; - + typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; /** Slide overlay, which can be painted into by the user. This class registers itself at the EventMultiplexer, @@ -69,15 +69,19 @@ namespace slideshow @param nStrokeWidth Width of the stroked path */ - static UserPaintOverlaySharedPtr create( const RGBColor& rStrokeColor, - double nStrokeWidth, - const SlideShowContext& rContext ); + static UserPaintOverlaySharedPtr create( const RGBColor& rStrokeColor, + double nStrokeWidth, + const SlideShowContext& rContext, + const PolyPolygonVector& rPolygons ); ~UserPaintOverlay(); + PolyPolygonVector getPolygons(); + void drawPolygons(); private: - UserPaintOverlay( const RGBColor& rStrokeColor, - double nStrokeWidth, - const SlideShowContext& rContext ); + UserPaintOverlay( const RGBColor& rStrokeColor, + double nStrokeWidth, + const SlideShowContext& rContext, + const PolyPolygonVector& rPolygons ); ::boost::shared_ptr<PaintOverlayHandler> mpHandler; EventMultiplexer& mrMultiplexer; diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 109e64ca63c1..0491b25a8a56 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -47,6 +47,7 @@ #include <comphelper/scopeguard.hxx> #include <comphelper/optional.hxx> #include <comphelper/servicedecl.hxx> +#include <comphelper/namecontainer.hxx> #include <cppcanvas/spritecanvas.hxx> #include <cppcanvas/vclfactory.hxx> @@ -62,6 +63,7 @@ #include <basegfx/tools/canvastools.hxx> #include <vcl/font.hxx> +#include "rtl/ref.hxx" #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XModifyListener.hpp> @@ -74,6 +76,16 @@ #include <com/sun/star/presentation/XSlideShowListener.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/drawing/PointSequenceSequence.hpp> +#include <com/sun/star/drawing/PointSequence.hpp> +#include <com/sun/star/drawing/XLayer.hpp> +#include <com/sun/star/drawing/XLayerSupplier.hpp> +#include <com/sun/star/drawing/XLayerManager.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +#include "com/sun/star/uno/Reference.hxx" #include <com/sun/star/loader/CannotActivateFactoryException.hpp> #include "unoviewcontainer.hxx" @@ -103,8 +115,10 @@ #include <map> #include <vector> #include <iterator> +#include <string> #include <algorithm> #include <stdio.h> +#include <iostream> using namespace com::sun::star; using namespace ::slideshow::internal; @@ -213,6 +227,13 @@ private: typedef cppu::WeakComponentImplHelper1<presentation::XSlideShow> SlideShowImplBase; +typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; + +/// Maps XDrawPage for annotations persistence +typedef ::std::map< ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage>, + PolyPolygonVector> PolygonMap; + class SlideShowImpl : private cppu::BaseMutex, public CursorManager, public SlideShowImplBase @@ -293,9 +314,11 @@ private: throw (uno::RuntimeException); virtual void SAL_CALL displaySlide( uno::Reference<drawing::XDrawPage> const& xSlide, + uno::Reference<drawing::XDrawPagesSupplier> const& xDrawPages, uno::Reference<animations::XAnimationNode> const& xRootNode, uno::Sequence<beans::PropertyValue> const& rProperties ) throw (uno::RuntimeException); + virtual void SAL_CALL registerUserPaintPolygons( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xDocFactory ) throw (::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL setProperty( beans::PropertyValue const& rProperty ) throw (uno::RuntimeException); virtual sal_Bool SAL_CALL addView( @@ -354,9 +377,13 @@ private: /// Stop currently running show. void stopShow(); + ///Find a polygons vector in maPolygons (map) + PolygonMap::iterator findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage); + /// Creates a new slide. SlideSharedPtr makeSlide( uno::Reference<drawing::XDrawPage> const& xDrawPage, + uno::Reference<drawing::XDrawPagesSupplier> const& xDrawPages, uno::Reference<animations::XAnimationNode> const& xRootNode ); /// Checks whether the given slide/animation node matches mpPrefetchSlide @@ -429,8 +456,20 @@ private: /// map of sal_Int16 values, specifying the mouse cursor for every shape ShapeCursorMap maShapeCursors; + //map of vector of Polygons, containing polygons drawn on each slide. + PolygonMap maPolygons; + boost::optional<RGBColor> maUserPaintColor; + boost::optional<double> maUserPaintStrokeWidth; + + //changed for the eraser project + 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; ScreenUpdater maScreenUpdater; EventQueue maEventQueue; @@ -459,6 +498,8 @@ private: SlideSharedPtr mpPrefetchSlide; /// slide to be prefetched: best candidate for upcoming slide uno::Reference<drawing::XDrawPage> mxPrefetchSlide; + /// save the XDrawPagesSupplier to retieve polygons + uno::Reference<drawing::XDrawPagesSupplier> mxDrawPagesSupplier; /// slide animation to be prefetched: uno::Reference<animations::XAnimationNode> mxPrefetchAnimationNode; @@ -550,6 +591,7 @@ SlideShowImpl::SlideShowImpl( maShapeEventListeners(), maShapeCursors(), maUserPaintColor(), + maUserPaintStrokeWidth(4.0), mpPresTimer( new canvas::tools::ElapsedTime ), maScreenUpdater(maViewContainer), maEventQueue( mpPresTimer ), @@ -569,6 +611,7 @@ SlideShowImpl::SlideShowImpl( mpCurrentSlide(), mpPrefetchSlide(), mxPrefetchSlide(), + mxDrawPagesSupplier(), mxPrefetchAnimationNode(), mnCurrentCursor(awt::SystemPointer::ARROW), mnWaitSymbolRequestCount(0), @@ -865,14 +908,38 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( true )); } +PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage) +{ + // TODO(P2) : Optimze research in the map. + bool bFound = false; + PolygonMap::iterator aIter=maPolygons.begin(); + + + while(aIter!=maPolygons.end() && !bFound) + { + if(aIter->first == xDrawPage) + bFound = true; + else + aIter++; + } + + return aIter; +} + SlideSharedPtr SlideShowImpl::makeSlide( - uno::Reference<drawing::XDrawPage> const& xDrawPage, - uno::Reference<animations::XAnimationNode> const& xRootNode ) + uno::Reference<drawing::XDrawPage> const& xDrawPage, + uno::Reference<drawing::XDrawPagesSupplier> const& xDrawPages, + uno::Reference<animations::XAnimationNode> const& xRootNode ) { - if (! xDrawPage.is()) + if( !xDrawPage.is() ) return SlideSharedPtr(); + //Retrieve polygons for the current slide + PolygonMap::iterator aIter; + aIter = findPolygons(xDrawPage); + const SlideSharedPtr pSlide( createSlide(xDrawPage, + xDrawPages, xRootNode, maEventQueue, maEventMultiplexer, @@ -884,7 +951,9 @@ SlideSharedPtr SlideShowImpl::makeSlide( mxComponentContext, maShapeEventListeners, maShapeCursors, + (aIter != maPolygons.end()) ? aIter->second : PolyPolygonVector(), maUserPaintColor ? *maUserPaintColor : RGBColor(), + *maUserPaintStrokeWidth, !!maUserPaintColor, mbImageAnimationsAllowed, mbDisableAnimationZOrder) ); @@ -949,7 +1018,14 @@ void SlideShowImpl::stopShow() // Force-end running animation // =========================== if (mpCurrentSlide) + { mpCurrentSlide->hide(); + //Register polygons in the map + if(findPolygons(mpCurrentSlide->getXDrawPage()) != maPolygons.end()) + maPolygons.erase(mpCurrentSlide->getXDrawPage()); + + maPolygons.insert(make_pair(mpCurrentSlide->getXDrawPage(),mpCurrentSlide->getPolygons())); + } // clear all queues maEventQueue.clear(); @@ -1024,6 +1100,7 @@ private: void SlideShowImpl::displaySlide( uno::Reference<drawing::XDrawPage> const& xSlide, + uno::Reference<drawing::XDrawPagesSupplier> const& xDrawPages, uno::Reference<animations::XAnimationNode> const& xRootNode, uno::Sequence<beans::PropertyValue> const& rProperties ) throw (uno::RuntimeException) @@ -1038,6 +1115,12 @@ 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, // stopShow()'s currSlide->hide() call is @@ -1070,9 +1153,7 @@ void SlideShowImpl::displaySlide( mpCurrentSlide = mpPrefetchSlide; } else - { - mpCurrentSlide = makeSlide( xSlide, xRootNode ); - } + mpCurrentSlide = makeSlide( xSlide, xDrawPages, xRootNode ); OSL_ASSERT( mpCurrentSlide ); if (mpCurrentSlide) @@ -1382,6 +1463,129 @@ sal_Bool SlideShowImpl::removeView( return true; } +void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMultiServiceFactory >& xDocFactory ) throw (uno::RuntimeException) +{ + //Retrieve Polygons if user ends presentation by context menu + if (mpCurrentSlide) + { + if(findPolygons(mpCurrentSlide->getXDrawPage()) != maPolygons.end()) + maPolygons.erase(mpCurrentSlide->getXDrawPage()); + + maPolygons.insert(make_pair(mpCurrentSlide->getXDrawPage(),mpCurrentSlide->getPolygons())); + } + + //Creating the layer for shapes + // query for the XLayerManager + uno::Reference< drawing::XLayerSupplier > xLayerSupplier(xDocFactory, uno::UNO_QUERY); + uno::Reference< container::XNameAccess > xNameAccess = xLayerSupplier->getLayerManager(); + + uno::Reference< drawing::XLayerManager > xLayerManager(xNameAccess, uno::UNO_QUERY); + // create a layer and set its properties + uno::Reference< drawing::XLayer > xDrawnInSlideshow = xLayerManager->insertNewByIndex(xLayerManager->getCount()); + uno::Reference< beans::XPropertySet > xLayerPropSet(xDrawnInSlideshow, uno::UNO_QUERY); + + //Layer Name which enables to catch annotations + rtl::OUString layerName = rtl::OUString::createFromAscii("DrawnInSlideshow"); + uno::Any aPropLayer; + + aPropLayer <<= layerName; + xLayerPropSet->setPropertyValue(rtl::OUString::createFromAscii("Name"), aPropLayer); + + aPropLayer <<= true; + xLayerPropSet->setPropertyValue(rtl::OUString::createFromAscii("IsVisible"), aPropLayer); + + aPropLayer <<= false; + xLayerPropSet->setPropertyValue(rtl::OUString::createFromAscii("IsLocked"), aPropLayer); + + PolygonMap::iterator aIter=maPolygons.begin(); + + PolyPolygonVector aPolygons; + ::cppcanvas::PolyPolygonSharedPtr pPolyPoly; + ::basegfx::B2DPolyPolygon b2DPolyPoly; + + //Register polygons for each slide + while(aIter!=maPolygons.end()) + { + aPolygons = aIter->second; + //Get shapes for the slide + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(aIter->first, ::com::sun::star::uno::UNO_QUERY); + //Retrieve polygons for one slide + for( PolyPolygonVector::iterator aIterPoly=aPolygons.begin(), + aEnd=aPolygons.end(); + aIterPoly!=aEnd; ++aIterPoly ) + { + pPolyPoly = (*aIterPoly); + b2DPolyPoly = ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(pPolyPoly->getUNOPolyPolygon()); + + //Normally there is only one polygon + for(sal_uInt32 i=0; i< b2DPolyPoly.count();i++) + { + const ::basegfx::B2DPolygon& aPoly = b2DPolyPoly.getB2DPolygon(i); + sal_uInt32 nPoints = aPoly.count(); + + if( nPoints > 1) + { + //create the PolyLineShape + uno::Reference< uno::XInterface > polyshape(xDocFactory->createInstance( + rtl::OUString::createFromAscii("com.sun.star.drawing.PolyLineShape") ) ); + uno::Reference< drawing::XShape > rPolyShape(polyshape, uno::UNO_QUERY); + + //Add the shape to the slide + Shapes->add(rPolyShape); + + //Retrieve shape properties + uno::Reference< beans::XPropertySet > aXPropSet = uno::Reference< beans::XPropertySet >( rPolyShape, uno::UNO_QUERY ); + //Construct a sequence of points sequence + drawing::PointSequenceSequence aRetval; + //Create only one sequence for one polygon + aRetval.realloc( 1 ); + // Retrieve the sequence of points from aRetval + drawing::PointSequence* pOuterSequence = aRetval.getArray(); + // Create 2 points in this sequence + pOuterSequence->realloc(nPoints); + // Get these points which are in an array + awt::Point* pInnerSequence = pOuterSequence->getArray(); + for( sal_uInt32 n = 0; n < nPoints; n++ ) + { + //Create a point from the polygon + *pInnerSequence++ = awt::Point( aPoly.getB2DPoint(n).getX(), aPoly.getB2DPoint(n).getY()); + } + + //Fill the properties + //Give the built PointSequenceSequence. + uno::Any aParam; + aParam <<= aRetval; + aXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam ); + + //LineStyle : SOLID by default + uno::Any aAny; + drawing::LineStyle eLS; + eLS = drawing::LineStyle_SOLID; + aAny <<= eLS; + aXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny ); + + //LineColor + sal_uInt32 nLineColor; + nLineColor = pPolyPoly->getRGBALineColor(); + //Transform polygon color from RRGGBBAA to AARRGGBB + aAny <<= RGBAColor2UnoColor(nLineColor); + aXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny ); + + //LineWidth + double fLineWidth; + fLineWidth = pPolyPoly->getStrokeWidth(); + aAny <<= (sal_Int32)fLineWidth; + aXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny ); + + // make polygons special + xLayerManager->attachShapeToLayer(rPolyShape, xDrawnInSlideshow); + } + } + } + ++aIter; + } +} + sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) throw (uno::RuntimeException) { @@ -1432,6 +1636,126 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) return true; } + //adding support for erasing features in UserPaintOverlay + if (rProperty.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("EraseAllInk") )) + { + bool nEraseAllInk(false); + if (rProperty.Value >>= nEraseAllInk) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + + // enable user paint + maEraseAllInk.reset( nEraseAllInk ); + maEventMultiplexer.notifyEraseAllInk( *maEraseAllInk ); + } + else + { + // 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") )) + { + sal_Int32 nEraseInk(100); + if (rProperty.Value >>= nEraseInk) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + + // enable user paint + maEraseInk.reset( nEraseInk ); + maEventMultiplexer.notifyEraseInkWidth( *maEraseInk ); + } + else + { + // disable user paint + maEraseInk.reset(); + maEventMultiplexer.notifyUserPaintDisabled(); + } + + if( mnCurrentCursor == awt::SystemPointer::ARROW ) + resetCursor(); + + return true; + } + + // new Property for pen's width + if (rProperty.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("UserPaintStrokeWidth") )) + { + double nWidth(4.0); + if (rProperty.Value >>= nWidth) + { + OSL_ENSURE( mbMouseVisible,"setProperty(): User paint overrides invisible mouse" ); + // enable user paint stroke width + maUserPaintStrokeWidth.reset( nWidth ); + maEventMultiplexer.notifyUserPaintStrokeWidth( *maUserPaintStrokeWidth ); + } + else + { + // disable user paint stroke width + maUserPaintStrokeWidth.reset(); + maEventMultiplexer.notifyUserPaintDisabled(); + } + if( mnCurrentCursor == awt::SystemPointer::ARROW ) + resetCursor(); + return true; + } + if (rProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("AdvanceOnClick") )) { @@ -1940,6 +2264,9 @@ void SlideShowImpl::notifySlideAnimationsEnded() { osl::MutexGuard const guard( m_aMutex ); + //Draw polygons above animations + mpCurrentSlide->drawPolygons(); + OSL_ENSURE( !isDisposed(), "### already disposed!" ); // This struct will receive the (interruptable) event, @@ -2023,7 +2350,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() if (! matches( mpPrefetchSlide, mxPrefetchSlide, mxPrefetchAnimationNode )) { - mpPrefetchSlide = makeSlide( mxPrefetchSlide, + mpPrefetchSlide = makeSlide( mxPrefetchSlide, mxDrawPagesSupplier, mxPrefetchAnimationNode ); } if (mpPrefetchSlide) @@ -2121,6 +2448,8 @@ bool SlideShowImpl::handleAnimationEvent( const AnimationNodeSharedPtr& rNode ) boost::bind( &animations::XAnimationListener::endEvent, _1, boost::cref(xNode) )); + if(mpCurrentSlide->isPaintOverlayActive()) + mpCurrentSlide->drawPolygons(); break; default: break; diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 136e70743916..9d214ad0fd0b 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -164,10 +164,10 @@ namespace slideshow // ========================= /// extract unary double value from Any - bool extractValue( double& o_rValue, - const uno::Any& rSourceAny, - const ShapeSharedPtr& rShape, - const ::basegfx::B2DVector& rSlideBounds ) + bool extractValue( double& o_rValue, + const uno::Any& rSourceAny, + const ShapeSharedPtr& rShape, + const ::basegfx::B2DVector& rSlideBounds ) { // try to extract numeric value (double, or smaller POD, like float or int) if( (rSourceAny >>= o_rValue) ) @@ -710,6 +710,38 @@ namespace slideshow static_cast< sal_uInt8 >( nColor >> 24U ) ) ); } + 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)); + } + + /*sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA 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 ) @@ -806,12 +838,12 @@ namespace slideshow // determine transformed page bounds const basegfx::B2DRange aRect( 0,0, - rSlideSize.getX(), - rSlideSize.getY() ); + rSlideSize.getX(), + rSlideSize.getY() ); basegfx::B2DRange aTmpRect; canvas::tools::calcTransformedRectBounds( aTmpRect, - aRect, - pView->getTransformation() ); + aRect, + pView->getTransformation() ); // #i42440# Returned slide size is one pixel too small, as // rendering happens one pixel to the right and below the diff --git a/slideshow/source/inc/eventmultiplexer.hxx b/slideshow/source/inc/eventmultiplexer.hxx index 303ae4dda898..a1c932252d7b 100644 --- a/slideshow/source/inc/eventmultiplexer.hxx +++ b/slideshow/source/inc/eventmultiplexer.hxx @@ -486,6 +486,33 @@ public: */ bool notifyUserPaintColor( RGBColor const& rUserColor ); + /** Notify a new user paint width + + Sending this notification also implies that user paint is + enabled. . + + @return true, if this event was processed by + anybody. If false is returned, no handler processed + this event (and probably, nothing will happen at all) + */ + bool notifyUserPaintStrokeWidth( double rUserStrokeWidth ); + + + /** Notify a new user paint erase all ink mode + + Sending this notification also implies that user paint is + enabled. User paint denotes the feature to draw colored lines + on top of the slide content. + + @return true, if this event was processed by + anybody. If false is returned, no handler processed + this event (and probably, nothing will happen at all) + */ + bool notifyEraseAllInk( bool const& rEraseAllInk ); + bool notifySwitchPenMode(); + bool notifySwitchEraserMode(); + bool notifyEraseInkWidth( sal_Int32 rEraseInkSize ); + /** Notify that user paint is disabled User paint denotes the feature to draw colored lines on top of diff --git a/slideshow/source/inc/rgbcolor.hxx b/slideshow/source/inc/rgbcolor.hxx index 1ea168ee80c3..73f14558b494 100644 --- a/slideshow/source/inc/rgbcolor.hxx +++ b/slideshow/source/inc/rgbcolor.hxx @@ -90,6 +90,9 @@ namespace slideshow */ ::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 d5e95ac45568..6b3ff7eb2057 100644 --- a/slideshow/source/inc/shapeimporter.hxx +++ b/slideshow/source/inc/shapeimporter.hxx @@ -33,6 +33,9 @@ #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/XLayer.hpp> +#include "unoviewcontainer.hxx" +#include "unoview.hxx" #include "shape.hxx" @@ -43,6 +46,10 @@ namespace internal { struct SlideShowContext; +typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; +typedef ::boost::shared_ptr< UnoView > UnoViewSharedPtr; +typedef ::std::vector< UnoViewSharedPtr > UnoViewVector; + /** This class imports all shapes from a given XShapes object */ class ShapeImporter @@ -75,6 +82,8 @@ public: ::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, const SlideShowContext& rContext, sal_Int32 nOrdNumStart, bool bConvertingMasterPage ); @@ -95,11 +104,13 @@ public: importShape() call. */ bool isImportDone() const; - + PolyPolygonVector getPolygons(); private: bool isSkip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> const& xPropSet, - ::rtl::OUString const& shapeType ) const; + ::rtl::OUString const& shapeType, + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XLayer> const& xLayer); ShapeSharedPtr createShape( ::com::sun::star::uno::Reference< @@ -108,6 +119,8 @@ private: ::com::sun::star::beans::XPropertySet> const& xPropSet, ::rtl::OUString const& shapeType ) const; + void importPolygons(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xPropSet) ; + struct XShapesEntry { ShapeSharedPtr const mpGroupShape; @@ -130,10 +143,11 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage> mxPage; + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPagesSupplier> mxPagesSupplier; const SlideShowContext& mrContext; - + PolyPolygonVector maPolygons; XShapesStack maShapesStack; - double mnAscendingPrio; bool mbConvertingMasterPage; }; diff --git a/slideshow/source/inc/slide.hxx b/slideshow/source/inc/slide.hxx index 90cc7cf6d1b1..9a467c164a96 100644 --- a/slideshow/source/inc/slide.hxx +++ b/slideshow/source/inc/slide.hxx @@ -42,6 +42,7 @@ namespace com { namespace sun { namespace star { namespace drawing { class XDrawPage; + class XDrawPagesSupplier; } namespace uno { class XComponentContext; @@ -63,7 +64,7 @@ namespace slideshow { class RGBColor; class ScreenUpdater; - + typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; class Slide { public: @@ -117,6 +118,14 @@ namespace slideshow virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getXAnimationNode() const = 0; + ///Gets the slide Polygons + virtual PolyPolygonVector getPolygons() = 0; + + ///Draw the slide Polygons + virtual void drawPolygons() const = 0; + + ///Check if slide is already active + virtual bool isPaintOverlayActive() const = 0; // Slide bitmaps // ------------------------------------------------------------------- @@ -183,24 +192,28 @@ namespace slideshow UserEeventQueue */ SlideSharedPtr createSlide( const ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPage >& xDrawPage, + ::com::sun::star::drawing::XDrawPage >& xDrawPage, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPagesSupplier >& xDrawPages, const ::com::sun::star::uno::Reference< - ::com::sun::star::animations::XAnimationNode >& xRootNode, - EventQueue& rEventQueue, - EventMultiplexer& rEventMultiplexer, - ScreenUpdater& rScreenUpdater, - ActivitiesQueue& rActivitiesQueue, - UserEventQueue& rUserEventQueue, - CursorManager& rCursorManager, - const UnoViewContainer& rViewContainer, + ::com::sun::star::animations::XAnimationNode >& xRootNode, + EventQueue& rEventQueue, + EventMultiplexer& rEventMultiplexer, + ScreenUpdater& rScreenUpdater, + ActivitiesQueue& rActivitiesQueue, + UserEventQueue& rUserEventQueue, + CursorManager& rCursorManager, + const UnoViewContainer& rViewContainer, const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext >& xContext, - const ShapeEventListenerMap& rShapeListenerMap, - const ShapeCursorMap& rShapeCursorMap, - RGBColor const& aUserPaintColor, - bool bUserPaintEnabled, - bool bIntrinsicAnimationsAllowed, - bool bDisableAnimationZOrder ); + ::com::sun::star::uno::XComponentContext >& xContext, + const ShapeEventListenerMap& rShapeListenerMap, + const ShapeCursorMap& rShapeCursorMap, + const PolyPolygonVector& rPolyPolygonVector, + RGBColor const& aUserPaintColor, + double dUserPaintStrokeWidth, + bool bUserPaintEnabled, + bool bIntrinsicAnimationsAllowed, + bool bDisableAnimationZOrder ); } } diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index bb10864419cb..71d2aae74fc1 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -289,6 +289,9 @@ namespace slideshow /** Convert a plain UNO API 32 bit int to RGBColor */ RGBColor unoColor2RGBColor( sal_Int32 ); + /** Convert an IntSRGBA to plain UNO API 32 bit int + */ + sal_Int32 RGBAColor2UnoColor( cppcanvas::Color::IntSRGBA ); /** Fill a plain rectangle on the given canvas with the given color */ diff --git a/slideshow/source/inc/userpainteventhandler.hxx b/slideshow/source/inc/userpainteventhandler.hxx index c688af984197..01919e0ae7e0 100644 --- a/slideshow/source/inc/userpainteventhandler.hxx +++ b/slideshow/source/inc/userpainteventhandler.hxx @@ -51,8 +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 eraseInkWidthChanged(sal_Int32 rEraseInkSize) =0; + virtual bool switchEraserMode() = 0; + virtual bool switchPenMode() = 0; virtual bool disable() = 0; }; |