// For LibreOffice internal D&D we provide the Transferable without NSDragPboard // interference as a shortcut, see tdf#100097 for how dbaccess depends on this
uno::Reference<XTransferable> DragSource::g_XTransferable;
NSView* DragSource::g_DragSourceView = nil; bool DragSource::g_DropSuccessSet = false; bool DragSource::g_DropSuccess = false;
-(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
(void)anImage;
(void)aPoint; // 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(mDragSource->getXWeak(), new DragSourceContext, static_cast< XDragSource* >(mDragSource),
SystemToOfficeDragActions(operation),
bDropSuccess );
/* All SalFrameView the base class for all VCL system views inherits from NSViewinordertogetmouseandotherevents.Thisistheonlywayto gettheseevents.Inordertostartadragoperationweneedtoprovide themouseeventwhichwasthetrigger.SalFrameViewthereforeimplements ahookmechanismsothatwecangetmouseeventsforourpurpose.
*/ if (![mView respondsToSelector: @selector(registerMouseEventListener:)] ||
![mView respondsToSelector: @selector(unregisterMouseEventListener:)])
{ throw Exception("DragSource::initialize: Provided view doesn't support mouse listener",
getXWeak());
}
NSWindow* pWin = [mView window]; if( ! pWin || ![pWin respondsToSelector: @selector(getSalFrame)] )
{ throw Exception("DragSource::initialize: Provided view is not attached to a vcl frame",
getXWeak());
}
mpFrame = reinterpret_cast<AquaSalFrame*>([pWin performSelector: @selector(getSalFrame)]);
// In order to initiate a D&D operation we need to // provide the triggering mouse event which we get // from the SalFrameView that is associated with // this DragSource void DragSource::saveMouseEvent(NSEvent* theEvent)
{ if (mLastMouseEventBeforeStartDrag != nil)
{
[mLastMouseEventBeforeStartDrag release];
}
mLastMouseEventBeforeStartDrag = theEvent;
if (mLastMouseEventBeforeStartDrag != nil)
{
[mLastMouseEventBeforeStartDrag retain];
}
}
/* isLocal indicates whether or not the DnD operation is OOo internal.
*/ unsignedint DragSource::getSupportedDragOperations(bool isLocal) const
{ unsignedint srcActions = OfficeToSystemDragActions(mDragSourceActions);
if (isLocal)
{ // Support NSDragOperation generic which means we can // decide which D&D operation to choose. We map // NSDragOperationGeneric to DNDConstants::ACTION_DEFAULT // in SystemToOfficeDragActions to signal this and // use it in DropTarget::determineDropAction
srcActions |= NSDragOperationGeneric;
} else
{ // Mask out link and move operations on external DnD
srcActions &= ~(NSDragOperationMove | NSDragOperationLink);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.