diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-23 21:07:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 09:14:00 +0000 |
commit | 903a420609252aff12d9481b5fd8cc8d1f1d445f (patch) | |
tree | 1b5266949021523603134c793ae4f1d286980618 /sd | |
parent | 82f4f6b19febb607d8823923380777f27e0ab3d9 (diff) |
add GtkSwipeGesture support and implement swipe left/right to change slides
keep it simple for now.
deliver to the same target window that gets the MouseWheel events, maybe worth combining
MouseWheel and Gestures into the same thing
and use it in slideshows so swipe toward the left to advance to the next slide,
to the right to return to the previous slide.
swipes are followed by mouse up events, impress already has a similar hack
to hide an mouse-up from the (incredibly complicated) interaction with
the slideshow so simply use that
Change-Id: Ib34f6fa0f15f3aa34eef887eb9d5642de9e5cdd1
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/slideshow.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshow.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 21 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 10 |
5 files changed, 39 insertions, 0 deletions
diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx index f4cc6c2909c2..d6ef3ae77717 100644 --- a/sd/source/ui/inc/slideshow.hxx +++ b/sd/source/ui/inc/slideshow.hxx @@ -52,6 +52,7 @@ class Rectangle; namespace vcl { class Window; } class SfxRequest; class WorkWindow; +class CommandSwipeData; struct ImplSVEvent; // TODO: Remove @@ -154,6 +155,7 @@ public: /** sets or clears the pause state of the running slideshow. !!!! This should only be called by the SdShowWindow !!!!*/ bool pause( bool bPause ); + bool swipe(const CommandSwipeData &rSwipeData); // settings bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen() diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index ff04b309fa9d..cfcf5e36fc35 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -1059,6 +1059,11 @@ bool SlideShow::isDrawingPossible() return mxController.is() && mxController->getUsePen(); } +bool SlideShow::swipe(const CommandSwipeData& rSwipeData) +{ + return mxController.is() && mxController->swipe(rSwipeData); +} + void SlideShow::StartInPlacePresentationConfigurationCallback() { if( mnInPlaceConfigEvent != 0 ) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index b4220e299704..fdbff3f78d68 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1109,6 +1109,7 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp try { mxShow = Reference< XSlideShow >( createSlideShow(), UNO_QUERY_THROW ); + mxView = new SlideShowView( *mpShowWindow, mpDoc, @@ -1232,6 +1233,26 @@ void SlideshowImpl::slideEnded(const bool bReverse) gotoNextSlide(); } +bool SlideshowImpl::swipe(const CommandSwipeData &rSwipeData) +{ + if (mbUsePen) + return false; + + double nVelocityX = rSwipeData.getVelocityX(); + if (nVelocityX > 0) + { + gotoPreviousSlide(); + } + else + { + gotoNextEffect(); + } + //a swipe is followed by a mouse up, tell the view to ignore that mouse up as we've reacted + //to the swipe instead + mxView->ignoreNextMouseReleased(); + return true; +} + void SlideshowImpl::removeShapeEvents() { if( mxShow.is() && mxListenerProxy.is() ) try diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 5506007286f8..97fe5e3342f3 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -218,6 +218,7 @@ public: void slideEnded(const bool bReverse); void hyperLinkClicked(const OUString & hyperLink) throw (css::uno::RuntimeException); void click(const css::uno::Reference< css::drawing::XShape > & xShape, const css::awt::MouseEvent & aOriginalEvent); + bool swipe(const CommandSwipeData &rSwipeData); /// ends the presentation async void endPresentation(); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index feb3b11973c8..22fc056d9345 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -641,6 +641,16 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi switch( rCEvt.GetCommand() ) { + case COMMAND_SWIPE: + { + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); + if (xSlideShow.is()) + { + const CommandSwipeData* pSwipeData = rCEvt.GetSwipeData(); + bDone = xSlideShow->swipe(*pSwipeData); + } + } + break; case COMMAND_WHEEL: { Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) ); |