From 7ec1ae356a6b06a31fca68eb30c706b906d75fdd Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 7 Nov 2012 15:50:21 +0200 Subject: fdo51023: Revert e4450c54aee85b295b933e91d207fd8220c01107 for Mac OS X See bug for discussion. Basically, the root cause to the problem is that on the Mac, all the drag-and-drop action happens during the call to pSlideSorterViewShell->StartDrag() in the Initialize method. Thus no wonder that mpDragAndDropContext is null in the ProcessDragEvent() as it has not been initialized yet, and is in fact initialised pointlessly only after the drag-and-drop already has finished. Reverted just for Mac OS X and ifdefified in a straightforward even if ugly fashion. Change-Id: Icfb62fb24a5c72fda39c8bcea125267c99ecf624 Signed-off-by: Michael Meeks --- .../controller/SlsSelectionFunction.cxx | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'sd') diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 0d3fc63bd1f3..4220a0ecf8aa 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -251,10 +251,17 @@ public: MultiSelectionModeHandler ( SlideSorter& rSlideSorter, SelectionFunction& rSelectionFunction, +#ifndef MACOSX const Point& rMouseModelPosition); +#else + const Point& rMouseModelPosition, + const sal_uInt32 nEventCode); +#endif virtual ~MultiSelectionModeHandler (void); +#ifndef MACOSX void Initialize(const sal_uInt32 nEventCode); +#endif virtual SelectionFunction::Mode GetMode (void) const; virtual void Abort (void); @@ -301,10 +308,19 @@ class DragAndDropModeHandler : public SelectionFunction::ModeHandler public: DragAndDropModeHandler ( SlideSorter& rSlideSorter, +#ifndef MACOSX SelectionFunction& rSelectionFunction); +#else + SelectionFunction& rSelectionFunction, + const Point& rMousePosition, + ::Window* pWindow); +#endif virtual ~DragAndDropModeHandler (void); +#ifndef MACOSX void Initialize(const Point& rMousePosition, ::Window* pWindow); +#endif + virtual SelectionFunction::Mode GetMode (void) const; virtual void Abort (void); @@ -817,6 +833,7 @@ void SelectionFunction::SwitchToDragAndDropMode (const Point aMousePosition) { if (mpModeHandler->GetMode() != DragAndDropMode) { +#ifndef MACOSX ::boost::shared_ptr handler( new DragAndDropModeHandler(mrSlideSorter, *this)); SwitchMode(handler); @@ -824,6 +841,10 @@ void SelectionFunction::SwitchToDragAndDropMode (const Point aMousePosition) // could already trigger DND events, which would recursively trigger this code again, // and without mpModeHandler set it would again try to set a new handler. handler->Initialize(aMousePosition, mpWindow); +#else + SwitchMode(::boost::shared_ptr( + new DragAndDropModeHandler(mrSlideSorter, *this, aMousePosition, mpWindow))); +#endif } } @@ -835,6 +856,7 @@ void SelectionFunction::SwitchToMultiSelectionMode ( const sal_uInt32 nEventCode) { if (mpModeHandler->GetMode() != MultiSelectionMode) +#ifndef MACOSX { ::boost::shared_ptr handler( new MultiSelectionModeHandler(mrSlideSorter, *this, aMousePosition)); @@ -843,6 +865,10 @@ void SelectionFunction::SwitchToMultiSelectionMode ( // is non-trivial, so it could possibly recurse just like the DND handler above. handler->Initialize(nEventCode); } +#else + SwitchMode(::boost::shared_ptr( + new MultiSelectionModeHandler(mrSlideSorter, *this, aMousePosition, nEventCode))); +#endif } @@ -1513,7 +1539,12 @@ void NormalModeHandler::ResetButtonDownLocation (void) MultiSelectionModeHandler::MultiSelectionModeHandler ( SlideSorter& rSlideSorter, SelectionFunction& rSelectionFunction, +#ifndef MACOSX const Point& rMouseModelPosition) +#else + const Point& rMouseModelPosition, + const sal_uInt32 nEventCode) +#endif : ModeHandler(rSlideSorter, rSelectionFunction, false), meSelectionMode(SM_Normal), maSecondCorner(rMouseModelPosition), @@ -1522,11 +1553,13 @@ MultiSelectionModeHandler::MultiSelectionModeHandler ( mnSecondIndex(-1), maButtonBarLock(rSlideSorter) { +#ifndef MACOSX } void MultiSelectionModeHandler::Initialize(const sal_uInt32 nEventCode) { +#endif const Pointer aSelectionPointer (POINTER_TEXT); mrSlideSorter.GetContentWindow()->SetPointer(aSelectionPointer); SetSelectionModeFromModifier(nEventCode); @@ -1766,13 +1799,22 @@ void MultiSelectionModeHandler::UpdateSelection (void) DragAndDropModeHandler::DragAndDropModeHandler ( SlideSorter& rSlideSorter, +#ifndef MACOSX SelectionFunction& rSelectionFunction) +#else + SelectionFunction& rSelectionFunction, + const Point& rMousePosition, + ::Window* pWindow) +#endif : ModeHandler(rSlideSorter, rSelectionFunction, false) { +#ifndef MACOSX } + void DragAndDropModeHandler::Initialize(const Point& rMousePosition, ::Window* pWindow) { +#endif SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; if (pDragTransferable==NULL && mrSlideSorter.GetViewShell() != NULL) { -- cgit v1.2.3