Bug 38955 - Macro recording, comented commands
Summary: Macro recording, comented commands
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: Other All
: high critical
Assignee: Kohei Yoshida
URL:
Whiteboard: target:3.4.3 target:3.3.4
Keywords:
: 39961 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-04 11:42 UTC by Olivier Hallot
Modified: 2011-08-09 11:34 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Hallot 2011-07-04 11:42:00 UTC
Hi

The recording of macros does catch the keyboard selection of cells to the sides left, right, up and down, but the commands are comented in the code: see this example: 

sub Formatacao3
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoRightSel", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoRightSel", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoRightSel", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, Array())

The issue is the "rem" in front of the command

This is a bug.

When selecting the same range with the mouse, the command is different and not "rem-ed". For example:

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$15:$D$22"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
Comment 1 Olivier Hallot 2011-07-21 12:02:04 UTC
OpenOffice.org 3.3.0 under Windows does not show this bug.
Comment 2 Olivier Hallot 2011-07-25 12:28:23 UTC
In OpenOffice 3.0 the uno command used for cursor selection is GoDown with property "Sel" as True:

rem ----------------------------------------------------------------------
dim args4(1) as new com.sun.star.beans.PropertyValue
args4(0).Name = "By"
args4(0).Value = 1
args4(1).Name = "Sel"
args4(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args4())

In LibreOffice, the uno command is GoDownSel, as shown above.
Comment 3 Olivier Hallot 2011-07-26 06:51:10 UTC
Re-targeting, rising criticality.

This prevent use of macro recording of basic cursor operations in the spreadsheet, turn it unreliable and thus useless with a severe loss of functionality for large companies.

As the macro programming of the LO API is so complex and hard to get familiar, most would-be macro programmers records macros and use it as a base for their macros. This loss of functionality is a no-go.

A regression to OOo macro recording is welcome.
Comment 4 Caolán McNamara 2011-07-27 03:01:40 UTC
Looks like the macro recorder distinguishes between such requests as "done" and "not done" by a flag set in it request after its processed. If its not marked as "done" it leaves it commented in the recording as "attempted but didn't succeed"

The commit of: http://cgit.freedesktop.org/libreoffice/calc/commit/?id=e6ffcc9e12567dbff3197d3976339aab59456107 should do the trick as far as I can see.

caolanm->kohei: I pushed the above fix to master, I'll reassign this to you for sanity check.
Comment 5 Kohei Yoshida 2011-07-27 06:19:53 UTC
Very interesting.

kohei->caolan: yes, the fix looks very sane.  In fact, I'm glad to learn that what the Done() method does which was mysteriously sprinkled across the event handling code.  Apparently I forgot to add that method there.
Comment 6 Olivier Hallot 2011-07-27 06:25:45 UTC
Can I ask your very kindness to also commit this patch in the forthcomming 3.3.4 maintenance release? A very large deployment depends on this release. 

Thank you guys.
Comment 7 Kohei Yoshida 2011-07-27 07:08:42 UTC
No problem.  I've cherry-picked Caolan's change to the 3-4 and 3-3 branches.  This is an extremely safe change even for the 3.3 branch.
Comment 8 Olivier Hallot 2011-08-09 11:34:43 UTC
*** Bug 39961 has been marked as a duplicate of this bug. ***