From 44d83b68fd07342fdad4003ce4007e26669979f4 Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 29 Jun 2009 15:15:41 +0200 Subject: #103174# Code from the ecntablet and eraser CWS; optionally improves user paint interactions in slideshow --- sd/source/ui/slideshow/makefile.mk | 4 + sd/source/ui/slideshow/slideshow.hrc | 22 +- sd/source/ui/slideshow/slideshow.src | 110 +++++++ sd/source/ui/slideshow/slideshowimpl.cxx | 335 +++++++++++++++++++-- sd/source/ui/slideshow/slideshowimpl.hxx | 9 +- slideshow/source/engine/eventmultiplexer.cxx | 29 +- slideshow/source/engine/shapes/shapeimporter.cxx | 113 ++++++- slideshow/source/engine/slide/slideimpl.cxx | 81 ++++- slideshow/source/engine/slide/userpaintoverlay.cxx | 282 ++++++++++++++--- slideshow/source/engine/slide/userpaintoverlay.hxx | 20 +- slideshow/source/engine/slideshowimpl.cxx | 291 +++++++++++++++++- slideshow/source/engine/tools.cxx | 31 +- slideshow/source/inc/eventmultiplexer.hxx | 25 ++ slideshow/source/inc/shapeimporter.hxx | 22 +- slideshow/source/inc/slide.hxx | 47 +-- slideshow/source/inc/tools.hxx | 3 + slideshow/source/inc/userpainteventhandler.hxx | 3 + 17 files changed, 1293 insertions(+), 134 deletions(-) diff --git a/sd/source/ui/slideshow/makefile.mk b/sd/source/ui/slideshow/makefile.mk index e157ba99d3bc..b9b3cc9ee84f 100644 --- a/sd/source/ui/slideshow/makefile.mk +++ b/sd/source/ui/slideshow/makefile.mk @@ -43,6 +43,10 @@ AUTOSEG=true .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk +.IF "$(ENABLE_PRESENTER_EXTRA_UI)"="YES" +CDEFS+= -DENABLE_PRESENTER_EXTRA_UI +.ENDIF + # --- Files -------------------------------------------------------- diff --git a/sd/source/ui/slideshow/slideshow.hrc b/sd/source/ui/slideshow/slideshow.hrc index 8a9799321738..11a5f9807bb1 100644 --- a/sd/source/ui/slideshow/slideshow.hrc +++ b/sd/source/ui/slideshow/slideshow.hrc @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - #ifndef SD_SLIDESHOW_HRC_ #define SD_SLIDESHOW_HRC_ @@ -38,8 +37,23 @@ #define CM_SCREEN_BLACK 5 #define CM_SCREEN_WHITE 6 #define CM_ENDSHOW 7 -#define CM_FIRST_SLIDE 8 -#define CM_LAST_SLIDE 9 -#define CM_SLIDES 10 +#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 #endif diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src index ec57d3e84897..7d5a05c463bd 100644 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -75,6 +75,56 @@ Menu RID_SLIDESHOW_CONTEXTMENU 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 Color" ; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem { Identifier = CM_SCREEN; Text [ en-US ] = "~Screen" ; @@ -101,6 +151,66 @@ Menu RID_SLIDESHOW_CONTEXTMENU Separator = TRUE; }; MenuItem + { + Identifier = CM_ERASE_ALLINK ; + Text [ en-US ] = "~Erase All Ink" ; + }; + MenuItem + { + Identifier = CM_ERASE_INK ; + Text [ en-US ] = "~Erase Ink Mode ON/OFF" ; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = CM_ERASE_ALLINK ; + Text [ en-US ] = "~Erase All Ink" ; + }; + MenuItem + { + Identifier = CM_ERASE_INK_PEN; + Text [ en-US ] = "~Eraser Size" ; + + 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"; + }; + }; + }; + }; + 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 c0b4857f3f6b..e56c93f72b13 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -34,6 +34,7 @@ #include +#include "com/sun/star/frame/XComponentLoader.hpp" #include #include #include @@ -86,6 +87,7 @@ #include "canvas/elapsedtime.hxx" #include "canvas/prioritybooster.hxx" #include "avmedia/mediawindow.hxx" +#include "svtools/colrdlg.hxx" #include #include @@ -169,7 +171,7 @@ public: bool nextSlide(); bool previousSlide(); - void displayCurrentSlide( const Reference< XSlideShow >& xShow ); + void displayCurrentSlide( const Reference< XSlideShow >& xShow, const Reference< XDrawPagesSupplier>& xDrawPages); sal_Int32 getNextSlideIndex() const; sal_Int32 getPreviousSlideIndex() const; @@ -466,7 +468,7 @@ bool AnimationSlideController::previousSlide() return jumpToSlideIndex( getPreviousSlideIndex() ); } -void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow ) +void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow, const Reference< XDrawPagesSupplier>& xDrawPages ) { const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber(); @@ -488,7 +490,7 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow } if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) ) - xShow->displaySlide( xSlide, xAnimNode, aProperties ); + xShow->displaySlide( xSlide, xDrawPages, xAnimNode, aProperties ); } } @@ -523,7 +525,11 @@ SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, , mbInputFreeze(false) , mbActive(sal_False) , maPresSettings( pDoc->getPresentationSettings() ) -, mnUserPaintColor( 0x0000FF00L ) +, mnUserPaintColor( 0x00000000L ) +, mdUserPaintStrokeWidth ( 4.0 ) +, mbEraseAllInk(false) +, mbEraseInk(false) +, mnEraseInkSize(100.0) , mnEntryCounter(0) , mnLastSlideNumber(-1) , msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ) @@ -1087,7 +1093,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) aProperties.push_back( beans::PropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("UserPaintColor") ), - -1, Any( static_cast(0x0000FF00L) ), + -1, Any( static_cast(0x00000000L) ), beans::PropertyState_DIRECT_VALUE ) ); } @@ -1394,7 +1400,8 @@ void SlideshowImpl::displayCurrentSlide() if( mpSlideController.get() && mxShow.is() ) { - mpSlideController->displayCurrentSlide( mxShow ); + Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW ); + mpSlideController->displayCurrentSlide( mxShow, xDrawPages ); registerShapeEvents(mpSlideController->getCurrentSlideNumber()); update(); @@ -1411,6 +1418,12 @@ void SlideshowImpl::displayCurrentSlide() void SlideshowImpl::endPresentation() { + if( maPresSettings.mbMouseAsPen) + { + Reference< XMultiServiceFactory > xDocFactory(mpDoc->getUnoModel(), UNO_QUERY ); + if( xDocFactory.is() ) + mxShow->registerUserPaintPolygons(xDocFactory); + } if( !mnEndShowEvent ) mnEndShowEvent = Application::PostUserEvent( LINK(this, SlideshowImpl, endPresentationHdl) ); } @@ -2112,6 +2125,12 @@ 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)); + pMenu->EnableItem( CM_COLOR_PEN, (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) ); @@ -2179,6 +2198,100 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) } } + 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) ); + + } + } + } + +#ifdef ENABLE_PRESENTER_EXTRA_UI + 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) ); + + } + } + } +#endif + pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) ); pMenu->Execute( mpShowWindow, maPopupMousePos ); delete pMenu; @@ -2241,32 +2354,134 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) } } break; + case CM_COLOR_PEN: + if( maPresSettings.mbMouseAsPen ) + { + //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: + if( maPresSettings.mbMouseAsPen ) { - 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: + if( maPresSettings.mbMouseAsPen ) + { + setPenWidth(100.0); + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_NORMAL: + if( maPresSettings.mbMouseAsPen ) + { + setPenWidth(150.0); + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_THICK: + if( maPresSettings.mbMouseAsPen ) + { + setPenWidth(200.0); + mbWasPaused = false; + } + break; + + case CM_WIDTH_PEN_VERY_THICK: + if( maPresSettings.mbMouseAsPen ) + { + setPenWidth(400.0); + mbWasPaused = false; + } + break; + case CM_ERASE_ALLINK: + if( maPresSettings.mbMouseAsPen ) + { + setEraseAllInk(true); + mbWasPaused = false; + } + break; + case CM_ERASE_INK_PEN_VERY_THIN: + if( maPresSettings.mbMouseAsPen ) + { + setEraseInk(100.0); + mbWasPaused = false; + } + break; + + case CM_ERASE_INK_PEN_THIN: + if( maPresSettings.mbMouseAsPen ) + { + setEraseInk(200.0); + mbWasPaused = false; + } + break; + + case CM_ERASE_INK_PEN_NORMAL: + if( maPresSettings.mbMouseAsPen ) + { + setEraseInk(300.0); + mbWasPaused = false; + } + break; + + case CM_ERASE_INK_PEN_THICK: + if( maPresSettings.mbMouseAsPen ) + { + setEraseInk(400.0); + mbWasPaused = false; + } + break; + case CM_ERASE_INK_PEN_VERY_THICK: + if( maPresSettings.mbMouseAsPen ) + { + setEraseInk(500.0); + mbWasPaused = false; + } + break; + + 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; } } @@ -2859,6 +3074,33 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeExc aPenProp.Value = aValue; mxShow->setProperty( aPenProp ); + //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 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; + if( maPresSettings.mbMouseAsPen ) + aValueEraseInk <<= mnEraseInkSize; + beans::PropertyValue aPenPropEraseInk; + aPenPropEraseInk.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EraseInk" )); + aPenPropEraseInk.Value = aValueEraseInk; + mxShow->setProperty( aPenPropEraseInk ); } catch( Exception& e ) { @@ -2872,6 +3114,23 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeExc } } +// -------------------------------------------------------------------- +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; + if( maPresSettings.mbMouseAsPen ) + setUsePen( sal_True ); // update color and width +} // -------------------------------------------------------------------- sal_Int32 SAL_CALL SlideshowImpl::getPenColor() throw (RuntimeException) @@ -2890,6 +3149,24 @@ void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) throw (RuntimeExcep setUsePen( sal_True ); // update color } +// -------------------------------------------------------------------- + +void SAL_CALL SlideshowImpl::setEraseAllInk( bool bEraseAllInk ) throw (RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mbEraseAllInk=bEraseAllInk; + if( maPresSettings.mbMouseAsPen ) + setUsePen( sal_True ); // update erase all ink bool +} + + +void SAL_CALL SlideshowImpl::setEraseInk( double nEraseInkSize ) throw (RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mnEraseInkSize=nEraseInkSize; + if( maPresSettings.mbMouseAsPen ) + setUsePen( sal_True ); // update erase ink size +} // -------------------------------------------------------------------- // XSlideShowController Methods // -------------------------------------------------------------------- diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index b9d5506ff2f3..b492288b3f0c 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -200,8 +200,12 @@ 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); + virtual void SAL_CALL setEraseAllInk( bool bEraseAllInk ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setEraseInk( double nEraseInkSize ) throw (css::uno::RuntimeException); 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); @@ -380,7 +384,10 @@ private: PresentationSettings maPresSettings; sal_Int32 mnUserPaintColor; - + double mdUserPaintStrokeWidth; + bool mbEraseAllInk; + bool mbEraseInk; + double mnEraseInkSize; /// used in updateHdl to prevent recursive calls sal_Int32 mnEntryCounter; diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index 181a787301b7..31cd7cf286c4 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -262,8 +262,7 @@ struct EventMultiplexerImpl std::vector > ImplShapeCursorHandlers; typedef ThreadUnsafeListenerContainer< PrioritizedHandlerEntry, - std::vector< - PrioritizedHandlerEntry > > ImplHyperLinkHandlers; + std::vector > > ImplHyperLinkHandlers; template void forEachView( XSlideShowViewFunc pViewMethod ); @@ -1065,12 +1064,38 @@ 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)); } +//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::notifyEraseInk( double rEraseInkSize ) +{ + return mpImpl->maUserPaintEventHandlers.applyAll( + boost::bind(&UserPaintEventHandler::eraseInkChanged, + _1, + boost::cref(rEraseInkSize))); +} + bool EventMultiplexer::notifyNextEffect() { return mpImpl->notifyNextEffect(); diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 61f4d30fe2fc..54436c7330ed 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -39,9 +39,22 @@ #include #include #include +#include +#include +#include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "drawshapesubsetting.hxx" #include "drawshape.hxx" @@ -52,11 +65,13 @@ #include "slideshowexceptions.hxx" #include "gdimtftools.hxx" #include "tools.hxx" +#include "slideshowcontext.hxx" #include #include using namespace com::sun::star; +using namespace ::comphelper; namespace slideshow { namespace internal { @@ -436,7 +451,8 @@ ShapeSharedPtr ShapeImporter::createShape( bool ShapeImporter::isSkip( uno::Reference 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 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 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; nCurrPolygetLength(); ++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,13 +638,21 @@ bool ShapeImporter::isImportDone() const return maShapesStack.empty(); } -ShapeImporter::ShapeImporter( uno::Reference const& xPage, - uno::Reference const& xActualPage, - const SlideShowContext& rContext, - sal_Int32 nOrdNumStart, - bool bConvertingMasterPage ) : +PolyPolygonVector ShapeImporter::getPolygons() +{ + return maPolygons; +} + +ShapeImporter::ShapeImporter( uno::Reference const& xPage, + uno::Reference const& xActualPage, + uno::Reference const& xPagesSupplier, + const SlideShowContext& rContext, + sal_Int32 nOrdNumStart, + bool bConvertingMasterPage ) : mxPage( xActualPage ), + mxPagesSupplier( xPagesSupplier ), mrContext( rContext ), + maPolygons(), maShapesStack(), mnAscendingPrio( nOrdNumStart ), mbConvertingMasterPage( bConvertingMasterPage ) diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 84b6ad7b4305..e895f98fa94a 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -82,7 +82,6 @@ #include #include - using namespace ::com::sun::star; // ----------------------------------------------------------------------------- @@ -101,6 +100,7 @@ class SlideImpl : public Slide, { public: SlideImpl( const uno::Reference& xDrawPage, + const uno::Reference& xDrawPages, const uno::Reference& xRootNode, EventQueue& rEventQueue, EventMultiplexer& rEventMultiplexer, @@ -112,7 +112,9 @@ public: const uno::Reference& xContext, const ShapeEventListenerMap& rShapeListenerMap, const ShapeCursorMap& rShapeCursorMap, + const PolyPolygonVector& rPolyPolygonVector, RGBColor const& rUserPaintColor, + double dUserPaintStrokeWidth, bool bUserPaintEnabled, bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ); @@ -136,6 +138,9 @@ public: virtual basegfx::B2ISize getSlideSize() const; virtual uno::Reference getXDrawPage() const; virtual uno::Reference 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 +206,8 @@ private: /// End GIF and other intrinsic shape animations void startIntrinsicAnimations(); + /// Add Polygons to the member maPolygons + void addPolygons(PolyPolygonVector aPolygons); // Types // ===== @@ -230,6 +237,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 +252,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 +297,9 @@ private: /// When true, show() was called. Slide hidden oherwise. bool mbActive; + + ///When true, enablePaintOverlay was called and mbUserPaintOverlay = true + bool mbPaintOverlayActive; }; @@ -335,6 +348,7 @@ private: SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDrawPage, + const uno::Reference& xDrawPages, const uno::Reference< animations::XAnimationNode >& xRootNode, EventQueue& rEventQueue, EventMultiplexer& rEventMultiplexer, @@ -346,11 +360,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 +392,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 +406,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 +456,7 @@ void SlideImpl::dispose() mpShapeManager.reset(); mxRootNode.clear(); mxDrawPage.clear(); + mxDrawPagesSupplier.clear(); } bool SlideImpl::prefetch() @@ -583,6 +604,12 @@ uno::Reference SlideImpl::getXAnimationNode() const return mxRootNode; } +PolyPolygonVector SlideImpl::getPolygons() +{ + if(mbPaintOverlayActive) + maPolygons = mpPaintOverlay->getPolygons(); + return maPolygons; +} SlideBitmapSharedPtr SlideImpl::getCurrentSlideBitmap( const UnoViewSharedPtr& rView ) const { @@ -862,14 +889,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 +1133,7 @@ bool SlideImpl::loadShapes() // ------------------------------------------------------------------------- ShapeImporter aMPShapesFunctor( xMasterPage, mxDrawPage, + mxDrawPagesSupplier, maContext, 0, /* shape num starts at 0 */ true ); @@ -1087,6 +1148,7 @@ bool SlideImpl::loadShapes() if( rShape ) mpLayerManager->addShape( rShape ); } + addPolygons(aMPShapesFunctor.getPolygons()); nCurrCount = xMasterPageShapes->getCount() + 1; } @@ -1121,6 +1183,7 @@ bool SlideImpl::loadShapes() ShapeImporter aShapesFunctor( mxDrawPage, mxDrawPage, + mxDrawPagesSupplier, maContext, nCurrCount, false ); @@ -1132,6 +1195,7 @@ bool SlideImpl::loadShapes() if( rShape ) mpLayerManager->addShape( rShape ); } + addPolygons(aShapesFunctor.getPolygons()); } catch( uno::RuntimeException& ) { @@ -1176,6 +1240,7 @@ basegfx::B2ISize SlideImpl::getSlideSizeImpl() const SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& xDrawPage, + const uno::Reference& xDrawPages, const uno::Reference< animations::XAnimationNode >& xRootNode, EventQueue& rEventQueue, EventMultiplexer& rEventMultiplexer, @@ -1187,18 +1252,20 @@ 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 pRet( new SlideImpl( xDrawPage, xRootNode, rEventQueue, + boost::shared_ptr pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, 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..d9854f67b6fe 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -54,7 +54,8 @@ #include #include - +#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.0) { std::for_each( rViews.begin(), rViews.end(), boost::bind( &PaintOverlayHandler::viewAdded, this, _1 )); + drawPolygons(); } virtual void dispose() @@ -118,9 +130,103 @@ namespace slideshow // polygon and repaint here. } + bool colorChanged( RGBColor const& rUserColor ) + { + maStrokeColor = rUserColor; + return true; + } + + bool widthChanged( double nUserStrokeWidth ) + { + mnStrokeWidth = nUserStrokeWidth; + return true; + } + + bool eraseAllInkChanged( bool const& rEraseAllInk ) + { + mbIsEraseAllModeActivated= rEraseAllInk; + // if the erase all mode is activated it will remove all ink from slide, + // therefor destroy all the polygons stored + if(mbIsEraseAllModeActivated) + { + // 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); + } + } + mbIsEraseAllModeActivated=false; + return true; + } + + bool eraseInkChanged( double rEraseInkSize ) + { + if(mbIsEraseModeActivated) + mbIsEraseModeActivated=false; + else + 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 +241,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 +292,108 @@ 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 + 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 ) + aIter!=aEnd; + ++aIter ) { - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), - aPoly ) ); - if( pPolyPoly ) - { - pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); - pPolyPoly->draw(); - } + //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); } - // screen update necessary to show painting - mrScreenUpdater.notifyUpdate(); } + 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 ) + { + ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( + ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), + aPoly ) ); + + if( pPolyPoly ) + { + pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); + pPolyPoly->draw(); + } + } + // screen update necessary to show painting + mrScreenUpdater.notifyUpdate(); + } + } // mouse events captured return true; } @@ -226,42 +404,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; + double 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(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 +476,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 #include - +#include /* 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 mpHandler; EventMultiplexer& mrMultiplexer; diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index ac0f256324d7..ad63f4d80d17 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -62,6 +63,7 @@ #include #include +#include "rtl/ref.hxx" #include #include @@ -73,6 +75,16 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "com/sun/star/uno/Reference.hxx" #include #include "unoviewcontainer.hxx" @@ -101,6 +113,7 @@ #include #include #include +#include #include #include @@ -144,6 +157,13 @@ namespace { typedef cppu::WeakComponentImplHelper1 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 @@ -223,9 +243,11 @@ private: throw (uno::RuntimeException); virtual void SAL_CALL displaySlide( uno::Reference const& xSlide, + uno::Reference const& xDrawPages, uno::Reference const& xRootNode, uno::Sequence 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( @@ -278,9 +300,13 @@ private: /// Stop currently running show. void stopShow(); + ///Find a polygons vector in maPolygons (map) + PolygonMap::iterator findPolygons( uno::Reference const& xDrawPage); + /// Creates a new slide. SlideSharedPtr makeSlide( uno::Reference const& xDrawPage, + uno::Reference const& xDrawPages, uno::Reference const& xRootNode ); /// Checks whether the given slide/animation node matches mpPrefetchSlide @@ -333,8 +359,19 @@ 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 maUserPaintColor; + boost::optional maUserPaintStrokeWidth; + + //changed for the eraser project + boost::optional maEraseAllInk; + + boost::optional maEraseInk; + //end changed + boost::shared_ptr mpPresTimer; ScreenUpdater maScreenUpdater; EventQueue maEventQueue; @@ -363,6 +400,8 @@ private: SlideSharedPtr mpPrefetchSlide; /// slide to be prefetched: best candidate for upcoming slide uno::Reference mxPrefetchSlide; + /// save the XDrawPagesSupplier to retieve polygons + uno::Reference mxDrawPagesSupplier; /// slide animation to be prefetched: uno::Reference mxPrefetchAnimationNode; @@ -447,6 +486,7 @@ SlideShowImpl::SlideShowImpl( maShapeEventListeners(), maShapeCursors(), maUserPaintColor(), + maUserPaintStrokeWidth(4.0), mpPresTimer( new canvas::tools::ElapsedTime ), maScreenUpdater(maViewContainer), maEventQueue( mpPresTimer ), @@ -466,6 +506,7 @@ SlideShowImpl::SlideShowImpl( mpCurrentSlide(), mpPrefetchSlide(), mxPrefetchSlide(), + mxDrawPagesSupplier(), mxPrefetchAnimationNode(), mnCurrentCursor(awt::SystemPointer::ARROW), mbWaitState(false), @@ -756,14 +797,38 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( true )); } +PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference 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 const& xDrawPage, - uno::Reference const& xRootNode ) + uno::Reference const& xDrawPage, + uno::Reference const& xDrawPages, + uno::Reference 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, @@ -775,7 +840,9 @@ SlideSharedPtr SlideShowImpl::makeSlide( mxComponentContext, maShapeEventListeners, maShapeCursors, + (aIter != maPolygons.end()) ? aIter->second : PolyPolygonVector(), maUserPaintColor ? *maUserPaintColor : RGBColor(), + *maUserPaintStrokeWidth, !!maUserPaintColor, mbImageAnimationsAllowed, mbDisableAnimationZOrder) ); @@ -817,7 +884,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(); @@ -869,6 +943,7 @@ struct SlideShowImpl::PrefetchPropertiesFunc void SlideShowImpl::displaySlide( uno::Reference const& xSlide, + uno::Reference const& xDrawPages, uno::Reference const& xRootNode, uno::Sequence const& rProperties ) throw (uno::RuntimeException) @@ -881,6 +956,8 @@ void SlideShowImpl::displaySlide( // precondition: must only be called from the main thread! DBG_TESTSOLARMUTEX(); + mxDrawPagesSupplier = xDrawPages; + stopShow(); // MUST call that: results in // maUserEventQueue.clear(). What's more, // stopShow()'s currSlide->hide() call is @@ -914,7 +991,7 @@ void SlideShowImpl::displaySlide( } else { - mpCurrentSlide = makeSlide( xSlide, xRootNode ); + mpCurrentSlide = makeSlide( xSlide, xDrawPages, xRootNode ); } OSL_ASSERT( mpCurrentSlide ); @@ -1133,6 +1210,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) { @@ -1183,6 +1383,82 @@ 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("EraseInk") )) + { + double nEraseInk(0.0); + if (rProperty.Value >>= nEraseInk) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + + // enable user paint + maEraseInk.reset( nEraseInk ); + maEventMultiplexer.notifyEraseInk( *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") )) { @@ -1654,6 +1930,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, @@ -1738,7 +2017,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() if (! matches( mpPrefetchSlide, mxPrefetchSlide, mxPrefetchAnimationNode )) { - mpPrefetchSlide = makeSlide( mxPrefetchSlide, + mpPrefetchSlide = makeSlide( mxPrefetchSlide, mxDrawPagesSupplier, mxPrefetchAnimationNode ); } if (mpPrefetchSlide) @@ -1832,6 +2111,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 b2c179647db3..be3a39849040 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -163,10 +163,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) ) @@ -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,6 +710,17 @@ 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)); + } + void fillRect( const ::cppcanvas::CanvasSharedPtr& rCanvas, const ::basegfx::B2DRectangle& rRect, ::cppcanvas::Color::IntSRGBA aFillColor ) @@ -806,12 +817,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..01722ee0b527 100644 --- a/slideshow/source/inc/eventmultiplexer.hxx +++ b/slideshow/source/inc/eventmultiplexer.hxx @@ -486,6 +486,31 @@ 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 notifyEraseInk( double 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/shapeimporter.hxx b/slideshow/source/inc/shapeimporter.hxx index d5e95ac45568..e86db9c7a864 100644 --- a/slideshow/source/inc/shapeimporter.hxx +++ b/slideshow/source/inc/shapeimporter.hxx @@ -33,6 +33,9 @@ #include #include #include +#include +#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..1a9ab5fbb64a 100644 --- a/slideshow/source/inc/userpainteventhandler.hxx +++ b/slideshow/source/inc/userpainteventhandler.hxx @@ -53,6 +53,9 @@ namespace slideshow 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 disable() = 0; }; -- cgit From 54e4becdc5eee38a4ef85f8bab8d6258c54e2faf Mon Sep 17 00:00:00 2001 From: thb Date: Thu, 2 Jul 2009 16:36:09 +0200 Subject: Better wording, better menu, and better code; kudos to ericb for the patch --- sd/source/ui/slideshow/slideshow.src | 55 +++++++++++++++----------------- sd/source/ui/slideshow/slideshowimpl.cxx | 18 ++++------- 2 files changed, 31 insertions(+), 42 deletions(-) diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src index 7d5a05c463bd..07df291e428f 100644 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -118,35 +118,13 @@ Menu RID_SLIDESHOW_CONTEXTMENU MenuItem { Identifier = CM_COLOR_PEN ; - Text [ en-US ] = "~Change Color" ; + Text [ en-US ] = "~Change Pen Color" ; }; MenuItem { Separator = TRUE; }; MenuItem - { - Identifier = CM_SCREEN; - Text [ en-US ] = "~Screen" ; - - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = CM_SCREEN_BLACK; - Text [ en-US ] = "~Black"; - }; - MenuItem - { - Identifier = CM_SCREEN_WHITE; - Text [ en-US ] = "~White"; - }; - }; - }; - }; - MenuItem { Separator = TRUE; }; @@ -165,11 +143,6 @@ Menu RID_SLIDESHOW_CONTEXTMENU Separator = TRUE; }; MenuItem - { - Identifier = CM_ERASE_ALLINK ; - Text [ en-US ] = "~Erase All Ink" ; - }; - MenuItem { Identifier = CM_ERASE_INK_PEN; Text [ en-US ] = "~Eraser Size" ; @@ -206,14 +179,36 @@ Menu RID_SLIDESHOW_CONTEXTMENU }; }; }; + MenuItem + { + Separator = TRUE; + }; MenuItem { - Separator = TRUE; + Identifier = CM_SCREEN; + Text [ en-US ] = "~Screen" ; + + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = CM_SCREEN_BLACK; + Text [ en-US ] = "~Black"; + }; + MenuItem + { + Identifier = CM_SCREEN_WHITE; + Text [ en-US ] = "~White"; + }; + }; + }; }; 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 e56c93f72b13..c7966d805c01 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2354,8 +2354,10 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) } } break; + + if( maPresSettings.mbMouseAsPen ) + { case CM_COLOR_PEN: - if( maPresSettings.mbMouseAsPen ) { //Open a color picker based on SvColorDialog ::Color aColor( mnUserPaintColor ); @@ -2373,7 +2375,6 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_WIDTH_PEN_VERY_THIN: - if( maPresSettings.mbMouseAsPen ) { setPenWidth(4.0); mbWasPaused = false; @@ -2381,7 +2382,6 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_WIDTH_PEN_THIN: - if( maPresSettings.mbMouseAsPen ) { setPenWidth(100.0); mbWasPaused = false; @@ -2389,7 +2389,6 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_WIDTH_PEN_NORMAL: - if( maPresSettings.mbMouseAsPen ) { setPenWidth(150.0); mbWasPaused = false; @@ -2397,7 +2396,6 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_WIDTH_PEN_THICK: - if( maPresSettings.mbMouseAsPen ) { setPenWidth(200.0); mbWasPaused = false; @@ -2405,21 +2403,19 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_WIDTH_PEN_VERY_THICK: - if( maPresSettings.mbMouseAsPen ) { setPenWidth(400.0); mbWasPaused = false; } break; +#ifdef ENABLE_PRESENTER_EXTRA_UI case CM_ERASE_ALLINK: - if( maPresSettings.mbMouseAsPen ) { setEraseAllInk(true); mbWasPaused = false; } break; case CM_ERASE_INK_PEN_VERY_THIN: - if( maPresSettings.mbMouseAsPen ) { setEraseInk(100.0); mbWasPaused = false; @@ -2427,7 +2423,6 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_ERASE_INK_PEN_THIN: - if( maPresSettings.mbMouseAsPen ) { setEraseInk(200.0); mbWasPaused = false; @@ -2435,7 +2430,6 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_ERASE_INK_PEN_NORMAL: - if( maPresSettings.mbMouseAsPen ) { setEraseInk(300.0); mbWasPaused = false; @@ -2443,19 +2437,19 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu ) break; case CM_ERASE_INK_PEN_THICK: - if( maPresSettings.mbMouseAsPen ) { setEraseInk(400.0); mbWasPaused = false; } break; case CM_ERASE_INK_PEN_VERY_THICK: - if( maPresSettings.mbMouseAsPen ) { setEraseInk(500.0); mbWasPaused = false; } break; +#endif + } case CM_ENDSHOW: // in case the user cancels the presentation, switch to current slide -- cgit From bf54db8b13d611c461ba2db9030f7d92e1497baf Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 12 Nov 2009 13:50:09 +0100 Subject: #i105942# --- sd/source/filter/eppt/epptso.cxx | 103 +++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 75e5a4ba3227..6b0e12213449 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1963,54 +1963,68 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool } } - if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX ) + rtl::OUString aCharHeightName, aCharWeightName, aCharLocaleName, aCharPostureName; + switch( nScriptType ) { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), bGetPropStateValue ) ) + case com::sun::star::i18n::ScriptType::ASIAN : { - float fFloat; - mAny >>= fFloat; - if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD ) - mnCharAttr |= 1; + aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeightAsian" ) ); + aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightAsian" ) ); + aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocaleAsian" ) ); + aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureAsian" ) ); + break; + } + case com::sun::star::i18n::ScriptType::COMPLEX : + { + aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeightComplex" ) ); + aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightComplex" ) ); + aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocaleComplex" ) ); + aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureComplex" ) ); + break; + } + default: + { + aCharHeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ); + aCharWeightName = String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ); + aCharLocaleName = String( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); + aCharPostureName = String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ); + break; } } - else + + mnCharHeight = 24; + if ( GetPropertyValue( mAny, mXPropSet, aCharHeightName, sal_False ) ) { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightComplex" ) ), bGetPropStateValue ) ) + float fVal; + if ( mAny >>= fVal ) { - float fFloat; - mAny >>= fFloat; - if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD ) - mnCharAttr |= 1; + mnCharHeight = (sal_uInt16)( fVal + 0.5 ); + meCharHeight = GetPropertyState( mXPropSet, aCharHeightName ); } } - - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 1; - - if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX ) + if ( GetPropertyValue( mAny, mXPropSet, aCharWeightName, sal_False ) ) { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), bGetPropStateValue ) ) + float fFloat; + if ( mAny >>= fFloat ) { - ::com::sun::star::awt::FontSlant aFS; - mAny >>= aFS; - switch ( aFS ) - { - case ::com::sun::star::awt::FontSlant_OBLIQUE : - case ::com::sun::star::awt::FontSlant_ITALIC : - mnCharAttr |= 2; - break; - default: - break; - } + if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD ) + mnCharAttr |= 1; + if ( GetPropertyState( mXPropSet, aCharWeightName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) + mnCharAttrHard |= 1; } } - else + if ( GetPropertyValue( mAny, mXPropSet, aCharLocaleName, sal_False ) ) + { + com::sun::star::lang::Locale eLocale; + if ( mAny >>= eLocale ) + meCharLocale = eLocale; + } + if ( GetPropertyValue( mAny, mXPropSet, aCharPostureName, sal_False ) ) { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureComplex" ) ), bGetPropStateValue ) ) + ::com::sun::star::awt::FontSlant aFS; + if ( mAny >>= aFS ) { - ::com::sun::star::awt::FontSlant aFS; - mAny >>= aFS; - switch ( aFS ) + switch( aFS ) { case ::com::sun::star::awt::FontSlant_OBLIQUE : case ::com::sun::star::awt::FontSlant_ITALIC : @@ -2019,12 +2033,11 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool default: break; } + if ( GetPropertyState( mXPropSet, aCharPostureName ) == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) + mnCharAttrHard |= 2; } } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 2; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), bGetPropStateValue ) ) { sal_Int16 nVal; @@ -2050,13 +2063,6 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) mnCharAttrHard |= 16; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ), bGetPropStateValue ) ) - { - com::sun::star::lang::Locale eLocale; - if ( mAny >>= eLocale ) - meCharLocale = eLocale; - } - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ), bGetPropStateValue ) ) { sal_Int16 nVal; @@ -2067,15 +2073,6 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) mnCharAttrHard |= 512; - mnCharHeight = 24; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), bGetPropStateValue ) ) - { - float fVal; - mAny >>= fVal; - mnCharHeight = (sal_uInt16)( fVal + 0.5 ); - } - meCharHeight = ePropState; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ), bGetPropStateValue ) ) { sal_uInt32 nSOColor = *( (sal_uInt32*)mAny.getValue() ); -- cgit From d529dfa3b1bebe6f284cbc4d0779eb0a058074fb Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 13 Nov 2009 17:19:14 +0100 Subject: impress181: #i106770# applied patch from cmc --- sd/source/filter/eppt/epptso.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 6b0e12213449..b234595e0b9b 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -2418,15 +2418,10 @@ void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight ) // from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName) { - StarSymbolToMSMultiFont *pConvert = 0; - FontFamily eFamily = FAMILY_DECORATIVE; - - if (!pConvert) - { - pConvert = CreateStarSymbolToMSMultiFont(); - } sal_Unicode cChar = rNumStr.GetChar(0); + StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont(); String sFont = pConvert->ConvertChar(cChar); + delete pConvert; if (sFont.Len()) { rNumStr = static_cast< sal_Unicode >(cChar | 0xF000); @@ -2442,7 +2437,6 @@ static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, Str let words own font substitution kick in */ rChrSet = RTL_TEXTENCODING_UNICODE; - eFamily = FAMILY_SWISS; rFontName = ::GetFontToken(rFontName, 0); } else @@ -2455,7 +2449,6 @@ static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, Str rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings")); rNumStr = static_cast< sal_Unicode >(0x6C); } - delete pConvert; } void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue ) -- cgit From 593892f63dc03cdf2478ed07adb807a033e2cc5a Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 16 Nov 2009 15:03:54 +0100 Subject: #i82435# enable drop of image link embedded --- sd/source/ui/view/sdview4.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 72534b476a73..748c23338d44 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -377,9 +377,10 @@ IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG ) if( !pGraphicFilter->ImportGraphic( aGraphic, aURL ) ) { sal_Int8 nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0; + const bool bLink = ( ( nTempAction & DND_ACTION_LINK ) != 0 ); SdrGrafObj* pGrafObj = InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL ); - if( pGrafObj ) + if( pGrafObj && bLink ) pGrafObj->SetGraphicLink( aCurrentDropFile, String() ); // return action from first inserted graphic -- cgit From 55c5ee94dee3182d7ba0d2961266f49db5561bb6 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 11 Dec 2009 14:31:09 +0100 Subject: impress181: #i107561#: now also exporting notes to pdf --- sd/source/ui/unoidl/unomodel.cxx | 52 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 8906059e57cf..aaa6920749c2 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -111,6 +112,12 @@ #include #include +#include +#include +#include +#include +#include + using ::rtl::OUString; #include @@ -1604,6 +1611,44 @@ sal_Int32 ImplPDFGetBookmarkPage( const String& rBookmark, SdDrawDocument& rDoc return nPage; } +void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData ) +{ + try + { + uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW ); + uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); + + sal_Int32 nIndex = 1; + + LanguageType eLanguage = Application::GetSettings().GetLanguage(); + while( xAnnotationEnumeration->hasMoreElements() ) + { + uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() ); + + geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() ); + uno::Reference< text::XText > xText( xAnnotation->getTextRange() ); +// rtl::OUString sInitials( getInitials( sAuthor ) ); + util::DateTime aDateTime( xAnnotation->getDateTime() ); + + Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year ); + Time aTime; + String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, SVXDATEFORMAT_B, *(SD_MOD()->GetNumberFormatter()), eLanguage ) ); + + vcl::PDFNote aNote; + String sTitle( xAnnotation->getAuthor() ); + sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); + sTitle += aStr; + aNote.Title = sTitle; + aNote.Contents = xText->getString(); + rPDFExtOutDevData.CreateNote( Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ), + static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote ); + } + } + catch( uno::Exception& ) + { + } +} + void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData ) { const rtl::OUString sGroup ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GroupShape" ) ); @@ -1842,11 +1887,14 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r const sal_Int32 nPageNumber = nRenderer + 1; PageKind ePageKind = PK_STANDARD; sal_Bool bExportNotesPages = sal_False; + sal_Bool bExportNotes = sal_False; for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) { if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) - rxOptions[ nProperty].Value >>= xRenderDevice; + rxOptions[ nProperty ].Value >>= xRenderDevice; + else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ) ) + rxOptions[ nProperty ].Value >>= bExportNotes; else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) ) { rxOptions[ nProperty].Value >>= bExportNotesPages; @@ -1942,6 +1990,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) ); if ( xPage.is() ) { + if ( bExportNotes ) + ImplPDFExportComments( xPage, *pPDFExtOutDevData ); uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY ); if( xPagePropSet.is() ) { -- cgit From af5c661b945658b1c0a2f61e66446d030abdbf40 Mon Sep 17 00:00:00 2001 From: ericb Date: Tue, 15 Dec 2009 23:12:19 +0100 Subject: #i97972# commit all changes since Thorsten rebase. Thanks to Nelle, Jonathan, Christian and ericb --- sd/source/ui/slideshow/makefile.mk | 5 +- sd/source/ui/slideshow/slideshow.cxx | 2 +- sd/source/ui/slideshow/slideshow.hrc | 43 +++-- sd/source/ui/slideshow/slideshow.src | 45 +++-- sd/source/ui/slideshow/slideshowimpl.cxx | 183 +++++++++++++++++---- sd/source/ui/slideshow/slideshowimpl.hxx | 20 ++- slideshow/source/engine/color.cxx | 13 ++ slideshow/source/engine/eventmultiplexer.cxx | 22 ++- slideshow/source/engine/makefile.mk | 4 + slideshow/source/engine/shapes/shapeimporter.cxx | 4 + slideshow/source/engine/slide/slideimpl.cxx | 15 +- slideshow/source/engine/slide/userpaintoverlay.cxx | 51 ++++-- slideshow/source/engine/slideshowimpl.cxx | 68 ++++++-- slideshow/source/engine/tools.cxx | 30 ++-- slideshow/source/inc/eventmultiplexer.hxx | 4 +- slideshow/source/inc/rgbcolor.hxx | 3 + slideshow/source/inc/shapeimporter.hxx | 2 +- slideshow/source/inc/userpainteventhandler.hxx | 5 +- 18 files changed, 396 insertions(+), 123 deletions(-) diff --git a/sd/source/ui/slideshow/makefile.mk b/sd/source/ui/slideshow/makefile.mk index b9b3cc9ee84f..7055d723df55 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 6d5e3e31ad80..7df7e3e105f7 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 11a5f9807bb1..85b2cf0f3009 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 07df291e428f..ee21508deb38 100644 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -74,13 +74,27 @@ 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 @@ -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 c7966d805c01..eb4a430116ff 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(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,6 +2211,7 @@ 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); @@ -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,6 +2301,10 @@ 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 ) @@ -3079,22 +3109,25 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeExc mxShow->setProperty( aPenPropWidth ); - //for EraseAllInk : - Any aValueEraseAllInk; + // for Pen Mode + Any aValueSwitchPenMode; 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; - 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(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 b492288b3f0c..ec90b433f9ee 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; + +#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 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 31cd7cf286c4..6ad89b278286 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 ba00e028b9ff..6d4b182f2323 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 54436c7330ed..98bda086286a 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -650,7 +650,11 @@ ShapeImporter::ShapeImporter( uno::Reference 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 e895f98fa94a..c0302fd92909 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -81,6 +81,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -367,7 +368,11 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) : mxDrawPage( xDrawPage ), - mxDrawPagesSupplier( xDrawPages ), +#ifdef ENABLE_PRESENTER_EXTRA_UI + mxDrawPagesSupplier( xDrawPages ), +#else + mxDrawPagesSupplier( NULL ), +#endif mxRootNode( xRootNode ), mpLayerManager( new LayerManager( rViewContainer, @@ -456,7 +461,9 @@ void SlideImpl::dispose() mpShapeManager.reset(); mxRootNode.clear(); mxDrawPage.clear(); +#ifndef ENABLE_PRESENTER_EXTRA_UI mxDrawPagesSupplier.clear(); +#endif } bool SlideImpl::prefetch() @@ -906,7 +913,7 @@ void SlideImpl::drawPolygons() const void SlideImpl::addPolygons(PolyPolygonVector aPolygons) { - if(!aPolygons.empty()) + if(!aPolygons.empty()) /* FIXME : was if(aPolygons.size() != 0) */ { for( PolyPolygonVector::iterator aIter=aPolygons.begin(), aEnd=aPolygons.end(); @@ -1259,7 +1266,11 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) { +#ifdef ENABLE_PRESENTER_EXTRA_UI boost::shared_ptr pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, +#else + boost::shared_ptr 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 d9854f67b6fe..cfcb6a1918dc 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -65,7 +65,7 @@ namespace slideshow { class PaintOverlayHandler : public MouseEventHandler, public ViewEventHandler, - public UserPaintEventHandler + public UserPaintEventHandler { public: PaintOverlayHandler( const RGBColor& rStrokeColor, @@ -73,7 +73,7 @@ namespace slideshow ActivitiesQueue& rActivitiesQueue, ScreenUpdater& rScreenUpdater, const UnoViewContainer& rViews, - Slide& rSlide, + Slide& rSlide, const PolyPolygonVector& rPolygons ) : mrActivitiesQueue( rActivitiesQueue ), mrScreenUpdater( rScreenUpdater ), @@ -90,7 +90,7 @@ namespace slideshow //handle the "remove stroke by stroke" mode of erasing mbIsEraseModeActivated( false ), mrSlide(rSlide), - mnSize(100.0) + mnSize(100) { std::for_each( rViews.begin(), rViews.end(), @@ -132,23 +132,27 @@ namespace slideshow bool colorChanged( RGBColor const& rUserColor ) { - maStrokeColor = rUserColor; + this->maStrokeColor = rUserColor; + this->mbIsEraseModeActivated = false; return true; } bool widthChanged( double nUserStrokeWidth ) { - mnStrokeWidth = nUserStrokeWidth; + this->mnStrokeWidth = nUserStrokeWidth; + mbIsEraseModeActivated = false; return true; } bool eraseAllInkChanged( bool const& rEraseAllInk ) { - mbIsEraseAllModeActivated= rEraseAllInk; + this->mbIsEraseAllModeActivated= rEraseAllInk; // if the erase all mode is activated it will remove all ink from slide, // therefor destroy all the polygons stored if(mbIsEraseAllModeActivated) { + // The Erase Mode should be desactivated + mbIsEraseModeActivated = false; // must get access to the instance to erase all polygon for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); aIter!=aEnd; @@ -180,17 +184,30 @@ namespace slideshow mrScreenUpdater.notifyUpdate(*aIter,true); } + maPolygons.clear(); } - mbIsEraseAllModeActivated=false; + mbIsEraseAllModeActivated=false; + return true; + } + + bool eraseInkWidthChanged( sal_Int32 rEraseInkSize ) + { + // Change the size + this->mnSize=rEraseInkSize; + // Changed to mode Erase + this->mbIsEraseModeActivated = true; return true; } - bool eraseInkChanged( double rEraseInkSize ) + bool switchPenMode() { - if(mbIsEraseModeActivated) - mbIsEraseModeActivated=false; - else - mbIsEraseModeActivated=true; + this->mbIsEraseModeActivated = false; + return true; + } + + bool switchEraserMode() + { + this->mbIsEraseModeActivated = true; return true; } @@ -292,7 +309,7 @@ namespace slideshow virtual bool handleMouseDragged( const awt::MouseEvent& e ) { - if(mbIsEraseModeActivated) + if(mbIsEraseModeActivated) { //define the last point as an object //we suppose that there's no way this point could be valid @@ -324,7 +341,7 @@ namespace slideshow //The point is to redraw the LastPoint the way it was originally on the bitmap, //of the slide - for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); + for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); aIter!=aEnd; ++aIter ) { @@ -355,7 +372,7 @@ namespace slideshow mrScreenUpdater.notifyUpdate(*aIter,true); } - } + } else { if( !mbIsLastPointValid ) @@ -385,8 +402,10 @@ namespace slideshow if( pPolyPoly ) { + pPolyPoly->setStrokeWidth(mnStrokeWidth); pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); pPolyPoly->draw(); + maPolygons.push_back(pPolyPoly); } } @@ -421,7 +440,7 @@ namespace slideshow bool mbIsEraseAllModeActivated; bool mbIsEraseModeActivated; Slide& mrSlide; - double mnSize; + sal_Int32 mnSize; }; UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor, diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index ad63f4d80d17..6e12389cddbe 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -116,6 +116,7 @@ #include #include #include +#include using namespace com::sun::star; using namespace ::slideshow::internal; @@ -367,9 +368,10 @@ private: boost::optional maUserPaintStrokeWidth; //changed for the eraser project - boost::optional maEraseAllInk; - - boost::optional maEraseInk; + boost::optional maEraseAllInk; + boost::optional maSwitchPenMode; + boost::optional maSwitchEraserMode; + boost::optional maEraseInk; //end changed boost::shared_ptr mpPresTimer; @@ -956,7 +958,11 @@ void SlideShowImpl::displaySlide( // precondition: must only be called from the main thread! DBG_TESTSOLARMUTEX(); +#ifdef ENABLE_PRESENTER_EXTRA_UI mxDrawPagesSupplier = xDrawPages; +#else + mxDrawPagesSupplier = NULL; +#endif stopShow(); // MUST call that: results in // maUserEventQueue.clear(). What's more, @@ -990,9 +996,7 @@ void SlideShowImpl::displaySlide( mpCurrentSlide = mpPrefetchSlide; } else - { mpCurrentSlide = makeSlide( xSlide, xDrawPages, xRootNode ); - } OSL_ASSERT( mpCurrentSlide ); if (mpCurrentSlide) @@ -1399,21 +1403,65 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) } else { - // disable user paint - maEraseAllInk.reset(); - maEventMultiplexer.notifyUserPaintDisabled(); + // disable user paint + maEraseAllInk.reset(); + maEventMultiplexer.notifyUserPaintDisabled(); + } + + if( mnCurrentCursor == awt::SystemPointer::ARROW ) + resetCursor(); + + return true; + } + + if (rProperty.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SwitchPenMode") )) + { + bool nSwitchPenMode(false); + if (rProperty.Value >>= nSwitchPenMode) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + + if(nSwitchPenMode == true){ + // Switch to Pen Mode + maSwitchPenMode.reset( nSwitchPenMode ); + maEventMultiplexer.notifySwitchPenMode(); + } } if( mnCurrentCursor == awt::SystemPointer::ARROW ) resetCursor(); + return true; + } + + + if (rProperty.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SwitchEraserMode") )) + { + bool nSwitchEraserMode(false); + if (rProperty.Value >>= nSwitchEraserMode) + { + OSL_ENSURE( mbMouseVisible, + "setProperty(): User paint overrides invisible mouse" ); + if(nSwitchEraserMode == true){ + // switch to Eraser mode + maSwitchEraserMode.reset( nSwitchEraserMode ); + maEventMultiplexer.notifySwitchEraserMode(); + } + } + if( mnCurrentCursor == awt::SystemPointer::ARROW ) + resetCursor(); return true; } + + if (rProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("EraseInk") )) { - double nEraseInk(0.0); + sal_Int32 nEraseInk(100); if (rProperty.Value >>= nEraseInk) { OSL_ENSURE( mbMouseVisible, @@ -1421,7 +1469,7 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) // enable user paint maEraseInk.reset( nEraseInk ); - maEventMultiplexer.notifyEraseInk( *maEraseInk ); + maEventMultiplexer.notifyEraseInkWidth( *maEraseInk ); } else { diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index be3a39849040..249375f99032 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -637,8 +637,8 @@ namespace slideshow aTransform ); } - ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds, - const ::basegfx::B2DRange& rShapeBounds ) + ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds, + const ::basegfx::B2DRange& rShapeBounds ) { return ::basegfx::B2DRectangle( lerp( rShapeBounds.getMinX(), @@ -710,15 +710,25 @@ namespace slideshow static_cast< sal_uInt8 >( nColor >> 24U ) ) ); } - sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor ) + /*sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor ) { - return ::cppcanvas::makeColorARGB( - // convert from IntSRGBA color to API color - // (0xRRGGBBAA -> 0xAARRGGBB) - static_cast< sal_uInt8 >(0), - ::cppcanvas::getRed(aColor), - ::cppcanvas::getGreen(aColor), - ::cppcanvas::getBlue(aColor)); + return ::cppcanvas::unMakeColor( + // convert from IntSRGBA color to API color + // (0xRRGGBBAA -> 0xAARRGGBB) + static_cast< sal_uInt8 >(0), + ::cppcanvas::getRed(aColor), + ::cppcanvas::getGreen(aColor), + ::cppcanvas::getBlue(aColor)); + }*/ + + sal_Int8 unSignedToSigned(sal_Int8 nInt) + { + if(nInt < 0 ){ + sal_Int8 nInt2 = nInt >> 1U; + return nInt2; + }else{ + return nInt; + } } void fillRect( const ::cppcanvas::CanvasSharedPtr& rCanvas, diff --git a/slideshow/source/inc/eventmultiplexer.hxx b/slideshow/source/inc/eventmultiplexer.hxx index 01722ee0b527..a1c932252d7b 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 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 e86db9c7a864..6b3ff7eb2057 100644 --- a/slideshow/source/inc/shapeimporter.hxx +++ b/slideshow/source/inc/shapeimporter.hxx @@ -82,7 +82,7 @@ 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< + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier>& xPagesSupplier, const SlideShowContext& rContext, sal_Int32 nOrdNumStart, diff --git a/slideshow/source/inc/userpainteventhandler.hxx b/slideshow/source/inc/userpainteventhandler.hxx index 1a9ab5fbb64a..8675ed4d5ae7 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; }; -- cgit From da9da1e422133df70aceb36c70540524fde0e840 Mon Sep 17 00:00:00 2001 From: ericb Date: Wed, 16 Dec 2009 07:25:56 +0100 Subject: eraser01: #i97972# fix variable renaming --- slideshow/source/engine/eventmultiplexer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index 6ad89b278286..ab36bf3d9e60 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -1098,7 +1098,7 @@ bool EventMultiplexer::notifyEraseAllInk( bool const& rEraseAllInk ) } //adding erasing features with UserPaintOverlay -bool EventMultiplexer::notifyEraseInk( sal_Int32 rEraseInkSize ) +bool EventMultiplexer::notifyEraseInkWidth( sal_Int32 rEraseInkSize ) { return mpImpl->maUserPaintEventHandlers.applyAll( boost::bind(&UserPaintEventHandler::eraseInkWidthChanged, -- cgit From 90ca57da108d6e933c19e690ce82ef8da722523e Mon Sep 17 00:00:00 2001 From: ericb Date: Wed, 16 Dec 2009 08:20:42 +0100 Subject: eraser01: #i97972# yet some build issues due to rebase --- slideshow/source/engine/tools.cxx | 11 +++++++++++ slideshow/source/inc/userpainteventhandler.hxx | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 249375f99032..2f3a18744144 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -710,6 +710,17 @@ 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( diff --git a/slideshow/source/inc/userpainteventhandler.hxx b/slideshow/source/inc/userpainteventhandler.hxx index 8675ed4d5ae7..01919e0ae7e0 100644 --- a/slideshow/source/inc/userpainteventhandler.hxx +++ b/slideshow/source/inc/userpainteventhandler.hxx @@ -52,8 +52,8 @@ 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 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; -- cgit From 967d3ca09c737d657e3efec4121c87ef39af64fa Mon Sep 17 00:00:00 2001 From: thb Date: Wed, 16 Dec 2009 14:47:09 +0100 Subject: eraser01: #i97972# - Fixed two minor bugs * ran autoconf, to get the --enable-extra-presenter-ui option * fixed thinko when selecting eraser width (slideshow was switching to eraser mode then, but context menu stayed at pen) --- sd/source/ui/slideshow/slideshowimpl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index eb4a430116ff..9fd9bd6694bc 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -3273,7 +3273,7 @@ void SAL_CALL SlideshowImpl::setEraseInk( sal_Int32 nEraseInkSize ) throw (Runti mbSwitchPenMode = false; mbSwitchEraserMode = true; if( maPresSettings.mbMouseAsPen ) - setUsePen( sal_True ); // update erase ink size + setUseEraser( sal_True ); // update erase ink size } #endif // -------------------------------------------------------------------- -- cgit From d30bcd05298ef4d1d07ba53f9a78941df0681b6c Mon Sep 17 00:00:00 2001 From: thb Date: Wed, 16 Dec 2009 15:02:20 +0100 Subject: eraser01: #i97972# - one more fix for erase all ink * make sd flags reflect the slideshow state after eraseAllInk was called. Fix is from Metrokid. --- sd/source/ui/slideshow/slideshowimpl.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 9fd9bd6694bc..a736f4a88a77 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -3261,6 +3261,8 @@ void SAL_CALL SlideshowImpl::setEraseAllInk( bool bEraseAllInk ) throw (RuntimeE { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); mbEraseAllInk=bEraseAllInk; + mbSwitchPenMode = true; + mbSwitchEraserMode = false; if( maPresSettings.mbMouseAsPen ) setUsePen( sal_True ); // update erase all ink bool } -- cgit From fcdda26bdb5285c2964987ab6243b495a6bb673e Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 6 Jan 2010 10:58:09 +0100 Subject: removed unused variable --- sd/source/ui/unoidl/unomodel.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index aaa6920749c2..4dab2fbac616 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1618,8 +1618,6 @@ void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDF uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW ); uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); - sal_Int32 nIndex = 1; - LanguageType eLanguage = Application::GetSettings().GetLanguage(); while( xAnnotationEnumeration->hasMoreElements() ) { -- cgit From 7e52f21b6b8717ebfd99f439eb8ffea8c121a363 Mon Sep 17 00:00:00 2001 From: ericb Date: Wed, 6 Jan 2010 16:41:04 +0100 Subject: eraser01: #i103174# cosmetic changes before RfQA --- slideshow/source/engine/eventmultiplexer.cxx | 2 +- slideshow/source/engine/slide/slideimpl.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index ab36bf3d9e60..f59a1cf6a4f0 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -1071,7 +1071,7 @@ bool EventMultiplexer::notifyUserPaintStrokeWidth( double rUserStrokeWidth ) _1, rUserStrokeWidth)); } -//NELLE a regarder de plus près + bool EventMultiplexer::notifyUserPaintDisabled() { return mpImpl->maUserPaintEventHandlers.applyAll( diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index c0302fd92909..ca90ae80427d 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -913,7 +913,7 @@ void SlideImpl::drawPolygons() const void SlideImpl::addPolygons(PolyPolygonVector aPolygons) { - if(!aPolygons.empty()) /* FIXME : was if(aPolygons.size() != 0) */ + if(!aPolygons.empty()) { for( PolyPolygonVector::iterator aIter=aPolygons.begin(), aEnd=aPolygons.end(); -- cgit From 5a57b4fbd058bb411ad38d37b4029b949fca1d20 Mon Sep 17 00:00:00 2001 From: ericb Date: Wed, 6 Jan 2010 16:41:36 +0100 Subject: eraser01: #i103174# cosmetic changes in sd before RfQA --- sd/source/ui/slideshow/slideshow.src | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sd/source/ui/slideshow/slideshow.src b/sd/source/ui/slideshow/slideshow.src index ee21508deb38..42459427f54f 100644 --- a/sd/source/ui/slideshow/slideshow.src +++ b/sd/source/ui/slideshow/slideshow.src @@ -147,11 +147,6 @@ Menu RID_SLIDESHOW_CONTEXTMENU Identifier = CM_ERASE_ALLINK ; Text [ en-US ] = "~Erase All Ink On Slide" ; }; - // MenuItem - // { - // Identifier = CM_ERASE_INK ; - // Text [ en-US ] = "~Erase Ink Mode ON/OFF" ; - // }; MenuItem { Separator = TRUE; -- cgit From 022eec80a272cddcf5ee6eda2b14236df1a4e30c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 12 Jan 2010 13:23:47 +0000 Subject: cmcfixes69: #i108261# fix mismatch ifdefs --- sd/source/ui/unoidl/facreg.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index b90832acaa51..959f22e30cf1 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -270,10 +270,8 @@ static ::boost::shared_ptr spFactoryMap; } // end of anonymous namespace -#ifdef __cplusplus extern "C" { -#endif SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, -- cgit From e9af447dcbc786acc2dcb8fff41d4d06a1f4c28d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 13 Jan 2010 17:55:09 +0100 Subject: swunolocking1: #i108161#: WeakReferenceHelper: Apple g++ 4.0.1 erroneously believes that it is ambiguous to use WeakReference::operator=(Reference). as a workaround, introduce WeakReferenceHelper::clear(), and fix all users. --- sd/source/ui/unoidl/unolayer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index 96dd05a01267..17fad0f5fdc1 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -826,8 +826,8 @@ uno::Reference SdLayerManager::GetLayer (SdrLayer* pLayer) xLayer = new SdLayer (this, pLayer); // Remember the new xLayer for future calls. - xRef = uno::Reference (xLayer, uno::UNO_QUERY); - mpLayers->insert (xRef); + uno::WeakReference wRef(xLayer); + mpLayers->insert(wRef); } return xLayer; -- cgit From b15930156ffd1eae186c9996f8d2979c2e097685 Mon Sep 17 00:00:00 2001 From: sj Date: Wed, 13 Jan 2010 19:13:55 +0100 Subject: impress181: #i107561#: now also exporting notes to pdf --- sd/source/ui/unoidl/unomodel.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 4dab2fbac616..89985f43f1dd 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1885,14 +1885,11 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r const sal_Int32 nPageNumber = nRenderer + 1; PageKind ePageKind = PK_STANDARD; sal_Bool bExportNotesPages = sal_False; - sal_Bool bExportNotes = sal_False; for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) { if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) rxOptions[ nProperty ].Value >>= xRenderDevice; - else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ) ) - rxOptions[ nProperty ].Value >>= bExportNotes; else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) ) { rxOptions[ nProperty].Value >>= bExportNotesPages; @@ -1988,7 +1985,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) ); if ( xPage.is() ) { - if ( bExportNotes ) + if ( pPDFExtOutDevData->GetIsExportNotes() ) ImplPDFExportComments( xPage, *pPDFExtOutDevData ); uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY ); if( xPagePropSet.is() ) -- cgit From b532272a17f8c0ba953a9c77590458521c3ba8f5 Mon Sep 17 00:00:00 2001 From: thb Date: Thu, 21 Jan 2010 11:30:03 +0100 Subject: #i10000# WaE: dummy-use extra parameter --- slideshow/source/engine/shapes/shapeimporter.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 98bda086286a..a524aa697935 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -661,6 +661,9 @@ ShapeImporter::ShapeImporter( uno::Reference const& mnAscendingPrio( nOrdNumStart ), mbConvertingMasterPage( bConvertingMasterPage ) { +#ifndef ENABLE_PRESENTER_EXTRA_UI + (void)xPagesSupplier; +#endif uno::Reference const xShapes( xPage, uno::UNO_QUERY_THROW ); maShapesStack.push( XShapesEntry(xShapes) ); -- cgit From f9279fa745422207350eabc8f67edc3eba94d6d3 Mon Sep 17 00:00:00 2001 From: thb Date: Tue, 26 Jan 2010 17:21:57 +0100 Subject: #i10000# Another WaE build fix --- slideshow/source/engine/slide/slideimpl.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index ca90ae80427d..b036c9373fc7 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -368,11 +368,7 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) : mxDrawPage( xDrawPage ), -#ifdef ENABLE_PRESENTER_EXTRA_UI - mxDrawPagesSupplier( xDrawPages ), -#else - mxDrawPagesSupplier( NULL ), -#endif + mxDrawPagesSupplier( xDrawPages ), mxRootNode( xRootNode ), mpLayerManager( new LayerManager( rViewContainer, @@ -1269,6 +1265,7 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& #ifdef ENABLE_PRESENTER_EXTRA_UI boost::shared_ptr pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, #else + (void)xDrawPages; boost::shared_ptr pRet( new SlideImpl( xDrawPage, NULL, xRootNode, rEventQueue, #endif rEventMultiplexer, rScreenUpdater, -- cgit From 02f1b698feb68c70166be96eae9f557fbf076ac2 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 1 Feb 2010 15:41:57 +0100 Subject: #i10000# removed ifdef --- sd/source/ui/slideshow/slideshow.hrc | 2 -- 1 file changed, 2 deletions(-) diff --git a/sd/source/ui/slideshow/slideshow.hrc b/sd/source/ui/slideshow/slideshow.hrc index 85b2cf0f3009..34dbd5c6536b 100644 --- a/sd/source/ui/slideshow/slideshow.hrc +++ b/sd/source/ui/slideshow/slideshow.hrc @@ -41,7 +41,6 @@ #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 @@ -61,6 +60,5 @@ #define CM_PEN_MODE 26 #define CM_ERASE_MODE 27 #define CM_POINTER_OPTION 28 -#endif //ENABLE_PRESENTER_EXTRA_UI #endif -- cgit