diff --git main/vcl/aqua/source/dtrans/DropTarget.cxx main/vcl/aqua/source/dtrans/DropTarget.cxx index 4ced22f7abf3..ce847d54c804 100644 --- main/vcl/aqua/source/dtrans/DropTarget.cxx +++ main/vcl/aqua/source/dtrans/DropTarget.cxx @@ -328,40 +328,44 @@ BOOL DropTarget::prepareForDragOperation(id /*sender*/) BOOL DropTarget::performDragOperation(id sender) { - bool bSuccess = false; - - if (mSelectedDropAction != DNDConstants::ACTION_NONE) + // emulate dtrans' dndOleKeysToAction() on Mac + sal_Int8 nFilteredDropAction = mSelectedDropAction; + if( (mpFrame->mnLastModifierFlags & (NSShiftKeyMask|NSCommandKeyMask)) == 0 ) { - uno::Reference xTransferable = DragSource::g_XTransferable; + nFilteredDropAction &= ~DNDConstants::ACTION_LINK; + nFilteredDropAction |= DNDConstants::ACTION_COPY; + } - if (!DragSource::g_XTransferable.is()) - { - xTransferable = mXCurrentDragClipboard->getContents(); - } - - NSRect bounds = [mView bounds]; - NSPoint dragLocation = [sender draggedImageLocation]; + // short circut if there is nothing to do + if( mSelectedDropAction == DNDConstants::ACTION_NONE) + return false; - CocoaToVCL(dragLocation, bounds); + // create the DropTargetEvent - sal_Int32 posX = static_cast(dragLocation.x); - sal_Int32 posY = static_cast(dragLocation.y); + uno::Reference xTransferable = DragSource::g_XTransferable; + if (!DragSource::g_XTransferable.is()) + xTransferable = mXCurrentDragClipboard->getContents(); + + const NSRect bounds = [mView bounds]; + NSPoint dragLocation = [sender draggedImageLocation]; + + CocoaToVCL(dragLocation, bounds); - DropTargetDropEvent dtde(static_cast(this), + const sal_Int32 posX = static_cast(dragLocation.x); + const sal_Int32 posY = static_cast(dragLocation.y); + + DropTargetDropEvent dtde(static_cast(this), 0, this, - mSelectedDropAction, + nFilteredDropAction, posX, posY, mDragSourceSupportedActions, xTransferable); - - fire_drop(dtde); - - bSuccess = true; - } + // handle the event + fire_drop(dtde); - return bSuccess; + return true; }