Bug Hunting Session
Bug 83522 - getTransferable copy content to system clipboard when content is removed
Summary: getTransferable copy content to system clipboard when content is removed
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.3.1.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-05 08:32 UTC by serj621
Modified: 2016-09-17 17:42 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
test case (9.22 KB, application/vnd.oasis.opendocument.text)
2014-11-07 17:21 UTC, raal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description serj621 2014-09-05 08:32:22 UTC
cur = ThisComponent.Text.createTextCursor()
cur.goRight(3, True)	
ThisComponent.CurrentController.select(cur)       
transferable = ThisComponent.CurrentController.getTransferable()
cur.String = "" ' here


System clipboard now contains transferable text.

P.S. Does getTransferable really works through system clipboard? O_o
Comment 1 raal 2014-11-07 17:21:35 UTC
Reproducible with Version: 4.3.4.0.0+
Build ID: fae7fed54206b98cc3aac24abcdac384d3bd9437
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:libreoffice-4-3, Time: 2014-11-06_02:16:12
don't know if it's bug or not, leaving unconfirmed
Comment 2 raal 2014-11-07 17:21:56 UTC
Created attachment 109095 [details]
test case
Comment 3 Buovjaga 2014-11-16 18:25:37 UTC
(In reply to raal from comment #2)
> Created attachment 109095 [details]
> test case

Yep, reproduced.

Win 7 64-bit Version: 4.4.0.0.alpha2+
Build ID: b021b5983c62e266b82d9f0c5c6d8d8900553827
TinderBox: Win-x86@39, Branch:master, Time: 2014-11-12_01:10:08
Comment 4 Jean-Baptiste Faure 2016-02-03 05:43:12 UTC
Please, could you be more explicit and describe what is the current behavior and what would be the expected behavior?

Best regards. JBF
Comment 5 pierre-yves samyn 2016-02-03 08:38:28 UTC
Hi

I reproduce but getTransferable get access to a transferable representation of *a selected part* of an object. The following line *removes* the selection:

cur.String = ""

If you comment this line the selection is still active and the content of the clipboard is preserved.

Steps to reproduce:

1. Open your test case
2. Comment cur.String = ""
3. Select and copy "Bugzilla – Bug 83522"  to the top left of this page
4. Click at the beginning of your document (before the text)
5. Run your macro
6. Goto the end of your document, paste

Expected & actual result: "Bugzilla – Bug 83522" pasted

So you have to do the insertTransferable before you change the selection, e.g.

oSource = ThisComponent
cur = oSource.Text.createTextCursor()
cur.goRight(3, True)	
oSource.CurrentController.select(cur)       
transferable = ThisComponent.CurrentController.getTransferable()
oTarget = stardesktop.loadcomponentfromurl("private:factory/swriter", "_blank", 0, array())
oTarget.currentController.insertTransferable(transferable)
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
transferable = ThisComponent.CurrentController.getTransferable()
cur.String = "" 


HTH

Regards
Pierre-Yves.
Comment 6 Xisco Faulí 2016-09-11 22:14:25 UTC Comment hidden (obsolete)
Comment 7 Jean-Baptiste Faure 2016-09-17 12:43:36 UTC
Well, what is the conclusion after comment #5 ?

Best regards. JBF
Comment 8 Buovjaga 2016-09-17 17:42:22 UTC
I guess it's notabug, then.. Original reporter is free to protest with an eloquent explanation.