https://bugs.documentfoundation.org/show_bug.cgi?id=106973

            Bug ID: 106973
           Summary: Dragging FileList out of LO fails
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: sdk
          Assignee: [email protected]
          Reporter: [email protected]

Hello

I try to implement drag and drop via Java UNO from an LO control
(XTreeControl). 
Dropping of Text/Files onto the control works fine. 
However, dragging a "FileList" type
(application/x-openoffice-filelist;windows_formatname="FileList") from LO to
any 
application accepting files (FileList) fails with a crash of the receiving
application e.g. Explorer/Notepad.

Dragging text from LO however works (sort of).

Due to little documentation I am not sure if I do this correctly.

Tried a number of different options returning raw byte[], many combinations of
Any etc.

Debugging the receiving application crashes here (win32 api):

DragQueryFile(hDropInfo, 0, szFileName, _MAX_PATH);

The call succeeds however, szFileName contains garbage.

I use the following test Java code to implement the drag source:

//////////////////////////////////////////////////////////////// 
private static final String MIME_FILE_LIST =
"application/x-openoffice-filelist;windows_formatname=\"FileList\"";

@Override
public void dragGestureRecognized(DragGestureEvent evt)
{

                        evt.DragSource.startDrag(evt, DNDConstants.ACTION_COPY,
0, 0, new XTransferable()
                        {
                            @Override
                            public Object getTransferData(DataFlavor
dataFlavor) throws UnsupportedFlavorException, IOException
                            {
                                String s =  "C:\\Users\\xxx\\file.log";
                                if(dataFlavor.MimeType.equals(MIME_FILE_LIST))
{
                                    return new Any(byte[].class, s.getBytes()); 
                                } 
                                return null;

                            }

                            @Override
                            public DataFlavor[] getTransferDataFlavors()
                            {
                                return new DataFlavor[]{
                                    new DataFlavor(MIME_FILE_LIST, "FileList",
new Type(byte[].class)),
                                };
                            }

                            @Override
                            public boolean isDataFlavorSupported(DataFlavor
dataFlavor)
                            {
                                return true;
                            }

////
}
////////////////////////////////////////////////////////////////////////////////////////////////

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to