Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing
|Summary:||Macro Copy Paste does not work from a button|
|Product:||App Dev||Reporter:||bmarcelly <marcelly.bernard>|
|Status:||CLOSED FIXED||QA Contact:||issues@api <issues>|
|Version:||3.3.0 or older (OOo)|
|Issue Type:||DEFECT||Latest Confirmation in:||---|
Description bmarcelly 2005-07-06 09:28:43 UTC
Attached document bugCopyPaste contains two simple macros which are started from two buttons on the first sheet. The buttons are working OK in 1.1.4 but do not work as expected in 1.9.xxx First button executes a copy/paste frome one zone to another of the same Calc sheet. In 1.9.xxx there is no copy, and no paste. But, if the macro is started from menu Tools > Macros it works OK. Second button executes a copy from this document and a paste to another existing Calc document. Path of the other document : C:\Docs OpenOffice\target.sxc In 1.9.xxx there is no copy, but paste works (with the current clipboard content). But, if the macro is started from menu Tools > Macros it works OK. The same behaviour appears with a similar .ods document.
Comment 1 bmarcelly 2005-07-06 09:29:30 UTC
Created attachment 27738 [details] Calc document with two macros started by buttons.
Comment 2 bmarcelly 2005-07-06 09:30:13 UTC
Created attachment 27739 [details] Ordinary Calc document for use with 2nd button.
Comment 3 christianjunker 2005-07-08 21:08:28 UTC
Can confirm the first part: copying in the same document. However, copying to another document is working for me (1.9.m113 WinXP).
Comment 4 stephan.wunderlich 2005-07-11 12:34:35 UTC
sw->tbe: the first button has no effect and the second copies what is currently in the clipboard, if nothing is in there nothing happens here either. All seems to work fine when the macro are executed via "Tools-Macros". Setting target to OOo2.0.1 since this used to work for example in OOo1.1.4
Comment 5 thomas.benisch 2005-08-03 13:19:12 UTC
TBE->FS: The macro is executed in both cases, when pressing the button and via Tools/Macros/Run Macro. But when pressing the button, the executeDispatch() call fails. The reason for that is, that the macro runs in the wrong context. In this case the FmFormShell is on the shell stack. For more details, please ask CD.
Comment 6 Frank Schönheit 2005-08-19 09:01:06 UTC
for the records: workaround: Set the "Take focus in click" property of the button to "No"
Comment 7 Frank Schönheit 2005-08-19 10:47:18 UTC
fixed in CWS dba201c The problem here is that when you click onto the button, it grabs the focus. Now in 2.0, when a form control has a focus, certain actions from the menu/toolbar (for instance cut/copy/paste) are routed to this control, and not to the main document anymore. This makes sense for, for instance, text input fields: You can now operate them via the toolbox. However, it doesn't make sense for buttons (which can just realize that the desired functionality is not available). Speaking very strictly, this is a problem of the macro, since it uses the dispatch API to access cut/copy/paste functionality. The dispatch API is always dependent on the document state, and thus not 100 percent reliable. However, there is no other API for cut/copy/paste, and the macro recorder produces code which uses the dispatch API, so declaring this as "wrong" would not really be a good solution :) Fixed this by not routing cut/copy/paste (and a lot of other functionalities) to the active control, if this active control cannot serve the functionality, anyway.
Comment 8 Frank Schönheit 2005-10-11 08:22:44 UTC
fs-> msc: please verify in CWS dba201d re-open issue and reassign to msc
Comment 9 Frank Schönheit 2005-10-11 08:23:11 UTC
reassign to msc
Comment 10 Frank Schönheit 2005-10-11 08:23:25 UTC
reset resolution to FIXED
Comment 11 marc.neumann 2005-10-19 15:15:04 UTC
verified in cws dba201d