diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 10:20:34 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-26 14:48:13 +0000 |
commit | 873141fb5be5fa49b56ea413bc912af33f758a0b (patch) | |
tree | e996d17f50a08c82bb469448886d0198a065d2b4 /sd | |
parent | 1c78277801f377458e8cb1d04fae0578a60c69b7 (diff) |
add GtkLongPressGesture support and implement long-press in slideshow
so a long press shows the context menu to e.g. allow switching on/off
draw-on-slide mode
Change-Id: Icd6ea52d2172217794f4fc802246ccf13020e134
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 | 13 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 11 |
5 files changed, 31 insertions, 1 deletions
diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx index d6ef3ae77717..2f19ca0e3ff1 100644 --- a/sd/source/ui/inc/slideshow.hxx +++ b/sd/source/ui/inc/slideshow.hxx @@ -53,6 +53,7 @@ namespace vcl { class Window; } class SfxRequest; class WorkWindow; class CommandSwipeData; +class CommandLongPressData; struct ImplSVEvent; // TODO: Remove @@ -156,6 +157,7 @@ public: !!!! This should only be called by the SdShowWindow !!!!*/ bool pause( bool bPause ); bool swipe(const CommandSwipeData &rSwipeData); + bool longpress(const CommandLongPressData& rLongPressData); // 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 cfcf5e36fc35..b21680eb9714 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -1064,6 +1064,11 @@ bool SlideShow::swipe(const CommandSwipeData& rSwipeData) return mxController.is() && mxController->swipe(rSwipeData); } +bool SlideShow::longpress(const CommandLongPressData& rLongPressData) +{ + return mxController.is() && mxController->longpress(rLongPressData); +} + void SlideShow::StartInPlacePresentationConfigurationCallback() { if( mnInPlaceConfigEvent != 0 ) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 4e9959bf978e..38eee1f0f680 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1235,7 +1235,7 @@ void SlideshowImpl::slideEnded(const bool bReverse) bool SlideshowImpl::swipe(const CommandSwipeData &rSwipeData) { - if (mbUsePen) + if (mbUsePen || mnContextMenuEvent) return false; double nVelocityX = rSwipeData.getVelocityX(); @@ -1253,6 +1253,17 @@ bool SlideshowImpl::swipe(const CommandSwipeData &rSwipeData) return true; } +bool SlideshowImpl::longpress(const CommandLongPressData &rLongPressData) +{ + if (mnContextMenuEvent) + return false; + + maPopupMousePos = Point(rLongPressData.getX(), rLongPressData.getY()); + mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) ); + + 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 97fe5e3342f3..b39c4ede6c9a 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -219,6 +219,7 @@ public: 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); + bool longpress(const CommandLongPressData& rLongPressData); /// ends the presentation async void endPresentation(); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 22fc056d9345..91efc8ff0c8f 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -651,6 +651,17 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi } } break; + case COMMAND_LONGPRESS: + { + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); + if (xSlideShow.is()) + { + const CommandLongPressData* pLongPressData = rCEvt.GetLongPressData(); + bDone = xSlideShow->longpress(*pLongPressData); + } + } + break; + case COMMAND_WHEEL: { Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) ); |