diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-07-01 22:01:39 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-07-01 22:01:39 +0000 |
commit | 621a3410f6ee9ab21bc6ff3b9cfa60fb7b9cf302 (patch) | |
tree | c38b14524ccbd59faff826976d6c4205c75d8822 /dtrans/source/aqua | |
parent | 615dba8819bf494c34f7986e4b012f83cea361bf (diff) |
INTEGRATION: CWS aquavcl08 (1.3.6); FILE MERGED
2008/06/24 16:34:12 pl 1.3.6.1: #i89329# cover the drop unsuccessful case of OOo datatransfer::dnd API
Diffstat (limited to 'dtrans/source/aqua')
-rw-r--r-- | dtrans/source/aqua/DragSource.cxx | 24 | ||||
-rw-r--r-- | dtrans/source/aqua/DragSource.hxx | 8 | ||||
-rw-r--r-- | dtrans/source/aqua/DropTarget.cxx | 21 |
3 files changed, 38 insertions, 15 deletions
diff --git a/dtrans/source/aqua/DragSource.cxx b/dtrans/source/aqua/DragSource.cxx index c4c627457f58..c0e7bd6ece94 100644 --- a/dtrans/source/aqua/DragSource.cxx +++ b/dtrans/source/aqua/DragSource.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DragSource.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -66,8 +66,10 @@ extern rtl_StandardModuleCount g_moduleCount; // For OOo internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut -Reference<XTransferable> g_XTransferable = Reference<XTransferable>(); -NSView* g_DragSourceView = nil; +Reference<XTransferable> DragSource::g_XTransferable = Reference<XTransferable>(); +NSView* DragSource::g_DragSourceView = nil; +bool DragSource::g_DropSuccessSet = false; +bool DragSource::g_DropSuccess = false; OUString dragSource_getImplementationName() @@ -128,11 +130,17 @@ Sequence<OUString> dragSource_getSupportedServiceNames() -(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { + // an internal drop can accept the drop but fail with dropComplete( false ) + // this is different than the Cocoa API + bool bDropSuccess = operation != NSDragOperationNone; + if( DragSource::g_DropSuccessSet ) + bDropSuccess = DragSource::g_DropSuccess; + DragSourceDropEvent dsde(static_cast<OWeakObject*>(mDragSource), new DragSourceContext(mDragSource), static_cast< XDragSource* >(mDragSource), SystemToOfficeDragActions(operation), - operation != NSDragOperationNone); + bDropSuccess ); mDragSource->mXDragSrcListener->dragDropEnd(dsde); mDragSource->mXDragSrcListener = Reference<XDragSourceListener>(); @@ -274,6 +282,10 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, p.x = p.x - sz.width/2; p.y = p.y - sz.height/2; + // reset drop success flags + g_DropSuccessSet = false; + g_DropSuccess = false; + [mView dragImage: dragImage at: p offset: NSMakeSize(0,0) @@ -286,6 +298,10 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger, g_XTransferable = Reference<XTransferable>(); g_DragSourceView = nil; + + // reset drop success flags + g_DropSuccessSet = false; + g_DropSuccess = false; } diff --git a/dtrans/source/aqua/DragSource.hxx b/dtrans/source/aqua/DragSource.hxx index 5ba617b1cd81..252b63fee41d 100644 --- a/dtrans/source/aqua/DragSource.hxx +++ b/dtrans/source/aqua/DragSource.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DragSource.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -133,6 +133,12 @@ public: // The mouse button that set off the drag and drop operation short m_MouseButton; sal_Int8 mDragSourceActions; + + static com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable > g_XTransferable; + static NSView* g_DragSourceView; + static bool g_DropSuccessSet; + static bool g_DropSuccess; + }; diff --git a/dtrans/source/aqua/DropTarget.cxx b/dtrans/source/aqua/DropTarget.cxx index 5cdd886e1368..5400b1a9757e 100644 --- a/dtrans/source/aqua/DropTarget.cxx +++ b/dtrans/source/aqua/DropTarget.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DropTarget.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -44,6 +44,8 @@ #include "DropTarget.hxx" #include "DragActionConversion.hxx" +#include "DragSource.hxx" + #include <rtl/ustring.h> #include <stdio.h> @@ -64,9 +66,6 @@ using namespace com::sun::star::uno; using namespace comphelper; extern rtl_StandardModuleCount g_moduleCount; -extern Reference<XTransferable> g_XTransferable; -extern NSView* g_DragSourceView; - OUString dropTarget_getImplementationName() { @@ -184,7 +183,7 @@ sal_Int8 DropTarget::determineDropAction(sal_Int8 dropActions, id sender) const { // Internal DnD NSView* destView = [[sender draggingDestinationWindow] contentView]; - srcAndDestEqual = (g_DragSourceView == destView); + srcAndDestEqual = (DragSource::g_DragSourceView == destView); } // If ACTION_DEFAULT is set this means NSDragOperationGeneric @@ -256,8 +255,8 @@ NSDragOperation DropTarget::draggingEntered(id sender) NSPasteboard* dragPboard = [sender draggingPasteboard]; mXCurrentDragClipboard = new AquaClipboard(mXComponentContext, dragPboard, false); - Reference<XTransferable> xTransferable = g_XTransferable.is() ? - g_XTransferable : mXCurrentDragClipboard->getContents(); + Reference<XTransferable> xTransferable = DragSource::g_XTransferable.is() ? + DragSource::g_XTransferable : mXCurrentDragClipboard->getContents(); DropTargetDragEnterEvent dtdee(static_cast<OWeakObject*>(this), 0, @@ -343,9 +342,9 @@ MacOSBOOL DropTarget::performDragOperation(id sender) if (mSelectedDropAction != DNDConstants::ACTION_NONE) { - Reference<XTransferable> xTransferable = g_XTransferable; + Reference<XTransferable> xTransferable = DragSource::g_XTransferable; - if (!g_XTransferable.is()) + if (!DragSource::g_XTransferable.is()) { xTransferable = mXCurrentDragClipboard->getContents(); } @@ -496,7 +495,9 @@ MacOSBOOL DropTarget::performDragOperation(id sender) { // Reset the internal transferable used as shortcut in case this is // an internal D&D operation - g_XTransferable = Reference<XTransferable>(); + DragSource::g_XTransferable = Reference<XTransferable>(); + DragSource::g_DropSuccessSet = true; + DragSource::g_DropSuccess = success; } |