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
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
* OpenOffice.org - a multi-platform office productivity suite
|
* OpenOffice.org - a multi-platform office productivity suite
|
||||||
*
|
*
|
||||||
* $RCSfile: DragSource.cxx,v $
|
* $RCSfile: DragSource.cxx,v $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* This file is part of OpenOffice.org.
|
* 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
|
// For OOo internal D&D we provide the Transferable without NSDragPboard
|
||||||
// interference as a shortcut
|
// interference as a shortcut
|
||||||
Reference<XTransferable> g_XTransferable = Reference<XTransferable>();
|
Reference<XTransferable> DragSource::g_XTransferable = Reference<XTransferable>();
|
||||||
NSView* g_DragSourceView = nil;
|
NSView* DragSource::g_DragSourceView = nil;
|
||||||
|
bool DragSource::g_DropSuccessSet = false;
|
||||||
|
bool DragSource::g_DropSuccess = false;
|
||||||
|
|
||||||
|
|
||||||
OUString dragSource_getImplementationName()
|
OUString dragSource_getImplementationName()
|
||||||
@@ -128,11 +130,17 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
|
|||||||
|
|
||||||
-(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
|
-(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),
|
DragSourceDropEvent dsde(static_cast<OWeakObject*>(mDragSource),
|
||||||
new DragSourceContext(mDragSource),
|
new DragSourceContext(mDragSource),
|
||||||
static_cast< XDragSource* >(mDragSource),
|
static_cast< XDragSource* >(mDragSource),
|
||||||
SystemToOfficeDragActions(operation),
|
SystemToOfficeDragActions(operation),
|
||||||
operation != NSDragOperationNone);
|
bDropSuccess );
|
||||||
|
|
||||||
mDragSource->mXDragSrcListener->dragDropEnd(dsde);
|
mDragSource->mXDragSrcListener->dragDropEnd(dsde);
|
||||||
mDragSource->mXDragSrcListener = Reference<XDragSourceListener>();
|
mDragSource->mXDragSrcListener = Reference<XDragSourceListener>();
|
||||||
@@ -274,6 +282,10 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
|
|||||||
p.x = p.x - sz.width/2;
|
p.x = p.x - sz.width/2;
|
||||||
p.y = p.y - sz.height/2;
|
p.y = p.y - sz.height/2;
|
||||||
|
|
||||||
|
// reset drop success flags
|
||||||
|
g_DropSuccessSet = false;
|
||||||
|
g_DropSuccess = false;
|
||||||
|
|
||||||
[mView dragImage: dragImage
|
[mView dragImage: dragImage
|
||||||
at: p
|
at: p
|
||||||
offset: NSMakeSize(0,0)
|
offset: NSMakeSize(0,0)
|
||||||
@@ -286,6 +298,10 @@ void SAL_CALL DragSource::startDrag(const DragGestureEvent& trigger,
|
|||||||
|
|
||||||
g_XTransferable = Reference<XTransferable>();
|
g_XTransferable = Reference<XTransferable>();
|
||||||
g_DragSourceView = nil;
|
g_DragSourceView = nil;
|
||||||
|
|
||||||
|
// reset drop success flags
|
||||||
|
g_DropSuccessSet = false;
|
||||||
|
g_DropSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* OpenOffice.org - a multi-platform office productivity suite
|
* OpenOffice.org - a multi-platform office productivity suite
|
||||||
*
|
*
|
||||||
* $RCSfile: DragSource.hxx,v $
|
* $RCSfile: DragSource.hxx,v $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* This file is part of OpenOffice.org.
|
* This file is part of OpenOffice.org.
|
||||||
*
|
*
|
||||||
@@ -133,6 +133,12 @@ public:
|
|||||||
// The mouse button that set off the drag and drop operation
|
// The mouse button that set off the drag and drop operation
|
||||||
short m_MouseButton;
|
short m_MouseButton;
|
||||||
sal_Int8 mDragSourceActions;
|
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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* OpenOffice.org - a multi-platform office productivity suite
|
* OpenOffice.org - a multi-platform office productivity suite
|
||||||
*
|
*
|
||||||
* $RCSfile: DropTarget.cxx,v $
|
* $RCSfile: DropTarget.cxx,v $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* This file is part of OpenOffice.org.
|
* This file is part of OpenOffice.org.
|
||||||
*
|
*
|
||||||
@@ -44,6 +44,8 @@
|
|||||||
#include "DropTarget.hxx"
|
#include "DropTarget.hxx"
|
||||||
#include "DragActionConversion.hxx"
|
#include "DragActionConversion.hxx"
|
||||||
|
|
||||||
|
#include "DragSource.hxx"
|
||||||
|
|
||||||
#include <rtl/ustring.h>
|
#include <rtl/ustring.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -64,9 +66,6 @@ using namespace com::sun::star::uno;
|
|||||||
using namespace comphelper;
|
using namespace comphelper;
|
||||||
|
|
||||||
extern rtl_StandardModuleCount g_moduleCount;
|
extern rtl_StandardModuleCount g_moduleCount;
|
||||||
extern Reference<XTransferable> g_XTransferable;
|
|
||||||
extern NSView* g_DragSourceView;
|
|
||||||
|
|
||||||
|
|
||||||
OUString dropTarget_getImplementationName()
|
OUString dropTarget_getImplementationName()
|
||||||
{
|
{
|
||||||
@@ -184,7 +183,7 @@ sal_Int8 DropTarget::determineDropAction(sal_Int8 dropActions, id sender) const
|
|||||||
{
|
{
|
||||||
// Internal DnD
|
// Internal DnD
|
||||||
NSView* destView = [[sender draggingDestinationWindow] contentView];
|
NSView* destView = [[sender draggingDestinationWindow] contentView];
|
||||||
srcAndDestEqual = (g_DragSourceView == destView);
|
srcAndDestEqual = (DragSource::g_DragSourceView == destView);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If ACTION_DEFAULT is set this means NSDragOperationGeneric
|
// If ACTION_DEFAULT is set this means NSDragOperationGeneric
|
||||||
@@ -256,8 +255,8 @@ NSDragOperation DropTarget::draggingEntered(id sender)
|
|||||||
NSPasteboard* dragPboard = [sender draggingPasteboard];
|
NSPasteboard* dragPboard = [sender draggingPasteboard];
|
||||||
mXCurrentDragClipboard = new AquaClipboard(mXComponentContext, dragPboard, false);
|
mXCurrentDragClipboard = new AquaClipboard(mXComponentContext, dragPboard, false);
|
||||||
|
|
||||||
Reference<XTransferable> xTransferable = g_XTransferable.is() ?
|
Reference<XTransferable> xTransferable = DragSource::g_XTransferable.is() ?
|
||||||
g_XTransferable : mXCurrentDragClipboard->getContents();
|
DragSource::g_XTransferable : mXCurrentDragClipboard->getContents();
|
||||||
|
|
||||||
DropTargetDragEnterEvent dtdee(static_cast<OWeakObject*>(this),
|
DropTargetDragEnterEvent dtdee(static_cast<OWeakObject*>(this),
|
||||||
0,
|
0,
|
||||||
@@ -343,9 +342,9 @@ MacOSBOOL DropTarget::performDragOperation(id sender)
|
|||||||
|
|
||||||
if (mSelectedDropAction != DNDConstants::ACTION_NONE)
|
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();
|
xTransferable = mXCurrentDragClipboard->getContents();
|
||||||
}
|
}
|
||||||
@@ -496,7 +495,9 @@ MacOSBOOL DropTarget::performDragOperation(id sender)
|
|||||||
{
|
{
|
||||||
// Reset the internal transferable used as shortcut in case this is
|
// Reset the internal transferable used as shortcut in case this is
|
||||||
// an internal D&D operation
|
// an internal D&D operation
|
||||||
g_XTransferable = Reference<XTransferable>();
|
DragSource::g_XTransferable = Reference<XTransferable>();
|
||||||
|
DragSource::g_DropSuccessSet = true;
|
||||||
|
DragSource::g_DropSuccess = success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user