Bug 113789 - ActiveX button's icon is not saved back to DOCX file
Summary: ActiveX button's icon is not saved back to DOCX file
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:docx
Depends on:
Blocks: DOCX-ActiveX-Legacy
  Show dependency treegraph
Reported: 2017-11-12 17:15 UTC by Tamás Zolnai
Modified: 2019-04-03 12:00 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

A document with one push button having a small icon (13.89 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-11-12 17:23 UTC, Tamás Zolnai

Note You need to log in before you can comment on or make changes to this bug.
Description Tamás Zolnai 2017-11-12 17:15:32 UTC
From version 6.0 LibreOffice can load / save ActiveX controls from / to DOCX format in general. However pictures attached to ActiveX buttons are not handled by the export code.

Steps to Reproduce:
1. Open attached document
2. Save it to a DOCX file
3. Open the save file in LO or MSO

Actual Results:  
After opening the saved DOCX file the picture is missing from the button.

Expected Results:
Picture of the putton should be there after saved to DOCX format.

Reproducible: Always

User Profile Reset: No

Additional Info:

User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Comment 1 Tamás Zolnai 2017-11-12 17:23:00 UTC
Created attachment 137695 [details]
A document with one push button having a small icon
Comment 2 Tamás Zolnai 2017-11-12 17:28:21 UTC
Let's turn this into a easy hack. The code is here:
Check AxCommandButtonModel class.
Also might need to check the activex documentation:
Comment 3 Manuj Vashist 2017-12-04 23:41:43 UTC Comment hidden (obsolete)
Comment 4 Tamás Zolnai 2017-12-08 01:45:03 UTC
ActiveX controls' properties are stored in a binary file inside the DOCX file (which is a zipped file structure). You can find this binary here \word\activeX\activex2.bin, inside the DOCX file.
All types of form controls have an importBinaryModel() and exportBinaryModel() method which do the reading and writing of this binary file. The imported value are stored as the specific class member variable (e.g. AxCommandButtonModel::maPictureData) and later this value is converted to an API property (convertProperties), which leads to apply this properties on the opened document. During export we have the same workflow in the oposite direction. We have convertFromProperties() method which gets the currently opened document's properties and sets the member variables based on that. Later the exportBinaryModel() will write this values out into the binary file.
So you will need to set AxCommandButtonModel::maPictureData based on API properties inside convertFromProperties() method and also export this member variable inside exportBinaryModel(). For how to do that you should check what happens by import and you can do the same in the oposite direction.
Comment 5 Tamás Zolnai 2017-12-08 03:27:09 UTC Comment hidden (obsolete)
Comment 6 Xisco Faulí 2018-01-18 03:32:20 UTC Comment hidden (obsolete)
Comment 7 Xisco Faulí 2018-02-18 03:36:51 UTC Comment hidden (obsolete)
Comment 8 Xisco Faulí 2018-03-21 03:34:06 UTC Comment hidden (obsolete)
Comment 9 Xisco Faulí 2018-04-21 02:32:33 UTC Comment hidden (obsolete)
Comment 10 Tamás Zolnai 2018-04-22 12:40:21 UTC Comment hidden (obsolete)
Comment 11 Xisco Faulí 2018-11-04 03:55:18 UTC Comment hidden (obsolete)
Comment 12 Xisco Faulí 2018-12-05 03:47:09 UTC Comment hidden (obsolete)
Comment 13 Xisco Faulí 2019-01-05 03:39:52 UTC Comment hidden (obsolete)
Comment 14 Xisco Faulí 2019-02-05 03:44:16 UTC Comment hidden (obsolete)
Comment 15 Aditya Sahu 2019-03-01 08:39:50 UTC Comment hidden (obsolete)
Comment 16 Aditya Sahu 2019-03-02 21:05:24 UTC Comment hidden (obsolete)
Comment 17 Xisco Faulí 2019-04-02 02:47:19 UTC Comment hidden (obsolete)
Comment 18 Aditya Sahu 2019-04-03 11:57:44 UTC
Un-assigning myself from this bug due to lack of knowledge in the bug that is not too easy. Looking at the bug more closely, Tamás and I found it to be more difficult than thought. I suggest to change the keyword from "difficultyBeginner" to "difficultyInteresting" and add "needsDevEval" to it.