Bug 63846 - FILEOPEN: sometime import controls in xlsm document don't fire macros
Summary: FILEOPEN: sometime import controls in xlsm document don't fire macros
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.1.0.3 release
Hardware: Other All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:5.3.0 target:5.2.4
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2013-04-23 15:14 UTC by Noel Power
Modified: 2017-05-18 19:02 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
test file (24.70 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2013-04-23 15:14 UTC, Noel Power
Details
macro.xlsm: macro.xls saved by MSO2013 into xlsm format (49.40 KB, application/vnd.ms-excel.sheet.macroenabled.12)
2016-10-27 09:03 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Noel Power 2013-04-23 15:14:39 UTC
Created attachment 78376 [details]
test file

Seems sometime we get a situation where an import ole control won't fire, event bindings in vba for ole controls are dynamic, in other words the existence of the appropriately named VBA event handler procedure is enough to ensure that handler is associated/bound to various events of the associated control.

However to prevent 'normal' controls behaving the same way there is a mechanism to prevent that event handling being exercised. It's controlled by the 'GenerateVbaEvents' property for each control. The GenerateVbaEvents property is examined by the forms layer when inserting controls. However it seems that in some cases the order in which things are called is not quite expected, e.g. normally we would expect that all the controls are read ( and properties including GenerateVbaEvents applied ) before the forms layer code that examines 'GenerateVbaEvents' ( see OInterfaceContainer::implInsert in forms/source/misc/InterfaceContainer.cxx ) is called. I have come across at least one example where this is causing problem ( see attachment )
Comment 1 QA Administrators 2015-09-04 02:49:52 UTC Comment hidden (obsolete)
Comment 2 Xisco Faulí 2016-09-10 16:05:56 UTC
Hi Noel,
I'm setting this ticket back to NEW as it has been inactive for more than 3
months.
Feel free to assign it back to you if you're still working on this.
Regards
Comment 3 Justin L 2016-10-27 09:03:40 UTC
Created attachment 128296 [details]
macro.xlsm: macro.xls saved by MSO2013 into xlsm format

The original test document (noclick.xlsm) works now (thanks to Bug 53042??), but mine still doesn't. The complication here is that it originated life as a .xls file.  The buttons work in both Word2003 and Word2013, but not in LO.

Tested from Linux/Windows using LO5.3/5.1.
Comment 4 Justin L 2016-10-27 13:45:50 UTC
(In reply to Justin L from comment #3)
caused by a regression in LO5.1 by author Markus Mohrhard <markus.mohrhard@googlemail.com> 2015-10-24 07:45:58 (GMT)
commit d4743045a0b320449d07a957463a76bb8b13f939
    the cells need to be imported before we handle charts, tdf#81396

fix:  vbaproject::attachMacros needs to run AFTER the shapes are imported since macros can attach to the shaps.
Comment 5 Commit Notification 2016-10-28 16:14:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b41e7b817e1e214582505d28d0cc36d741fa9979

tdf#63846 assign macros after VBA project fully loaded.

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2016-10-29 16:47:53 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=255c751c48955b56b96e1cf945b800ee4c1c917c&h=libreoffice-5-2

tdf#63846 assign macros after VBA project fully loaded.

It will be available in 5.2.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.