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
After opening the saved DOCX file the picture is missing from the button.
Picture of the putton should be there after saved to DOCX format.
User Profile Reset: No
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
Created attachment 137695 [details]
A document with one push button having a small icon
Let's turn this into a easy hack. The code is here:
Check AxCommandButtonModel class.
Also might need to check the activex documentation:
I am new to libre office and want to work on this bug.
Can you help how can I start on this.
from my understanding I think we have to initialize AxCommandButtonModel::maPictureData in the constructor.
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.
(In reply to Manuj Vashist from comment #3)
> I am new to libre office and want to work on this bug.
> Can you help how can I start on this.
> from my understanding I think we have to initialize
> AxCommandButtonModel::maPictureData in the constructor.
Hi Manuj Vashist,
Please also assign the bug yourself (see assignee field), if you are working on this issue. So other developers can see that somebody already working on a fix.
A polite ping, still working on this bug?
I reset assignee due to inactivity.
I'm interested in resolving this bug. Thanks for the code pointers and explanation Tamás.
I have tried to export the picture data of the ActiveX's button, but I don't know why it does not seem to work properly (the text of the button also disappears).
For now, I have submitted a not-so-working patch for the bug. It would be really nice if someone reviews the change. In any case, I assure you that I want to fix this bug and I'm still getting to know the code better.
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.