summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-11-07 15:50:21 +0200
committerMichael Stahl <mstahl@redhat.com>2012-11-07 22:07:03 +0000
commit6d425d93fd842f74d84bdcd65bce6a77c1c8821d (patch)
tree3f4c155936b45a952656846ffe7a1299f52f85ee
parent6968966d5f8506c14626cbd1fcfaafcbd68593f5 (diff)
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 Reviewed-on: https://gerrit.libreoffice.org/1000 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 605749c0c1f2..11a892b6fc2c 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -261,10 +261,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);
@@ -311,10 +318,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);
@@ -827,6 +843,7 @@ void SelectionFunction::SwitchToDragAndDropMode (const Point aMousePosition)
{
if (mpModeHandler->GetMode() != DragAndDropMode)
{
+#ifndef MACOSX
::boost::shared_ptr<DragAndDropModeHandler> handler(
new DragAndDropModeHandler(mrSlideSorter, *this));
SwitchMode(handler);
@@ -834,6 +851,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<ModeHandler>(
+ new DragAndDropModeHandler(mrSlideSorter, *this, aMousePosition, mpWindow)));
+#endif
}
}
@@ -845,6 +866,7 @@ void SelectionFunction::SwitchToMultiSelectionMode (
const sal_uInt32 nEventCode)
{
if (mpModeHandler->GetMode() != MultiSelectionMode)
+#ifndef MACOSX
{
::boost::shared_ptr<MultiSelectionModeHandler> handler(
new MultiSelectionModeHandler(mrSlideSorter, *this, aMousePosition));
@@ -853,6 +875,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<ModeHandler>(
+ new MultiSelectionModeHandler(mrSlideSorter, *this, aMousePosition, nEventCode)));
+#endif
}
@@ -1569,7 +1595,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),
@@ -1578,11 +1609,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);
@@ -1822,13 +1855,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)
{