Bug 99571 - FILEOPEN: Cannot click on docx checkbox (content control)
Summary: FILEOPEN: Cannot click on docx checkbox (content control)
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:docx, implementationError
: 118236 147356 (view as bug list)
Depends on:
Blocks: DOCX-Content_Control
  Show dependency treegraph
Reported: 2016-04-29 10:58 UTC by Alvaro Soliverez
Modified: 2022-06-30 22:42 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:

docx file with troublesome checkbox (236.46 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-04-29 10:58 UTC, Alvaro Soliverez
Simplified Test Case with only Checkbox (11.33 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-07-08 19:22 UTC, Luke
CheckboxContentControl2.docx : can't use OLE checkboxes are replacement (11.83 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-10-02 06:44 UTC, Justin L
tdf99571_badAssumptions.patch: convert Sdt to interactive 12pt checkbox (9.06 KB, patch)
2018-10-02 07:11 UTC, Justin L
Sample with most Content Controls available in Word 2016 (28.14 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-10-02 17:57 UTC, Luke

Note You need to log in before you can comment on or make changes to this bug.
Description Alvaro Soliverez 2016-04-29 10:58:56 UTC
Created attachment 124723 [details]
docx file with troublesome checkbox

We received a docx file with selectors and checkboxes. Unfortunately, the checkboxes cannot be operated on. When you click on them, nothing happens.

Expected result:
Click on a checkbox, it should display an X, fill with color or else to show it's selected.
Comment 1 raal 2016-04-29 11:29:01 UTC
I see boxes on page 3 (Norma(s) de Auditoría), but these are not checkboxes, only some drawings - I can not select it in word. What is the selector?
Comment 2 Luke 2016-07-08 19:22:02 UTC
Created attachment 126130 [details]
Simplified Test Case with only Checkbox

The Checkboxs on page 3 of attachment 124723 [details] in Word 2013 are disabled for editing. 

Here is a sample docx with Check Box Content Controls that work. We already handle Combo Box Content Controls correctly. Check Box Content Controls should be handled in a similar fashion.
Comment 3 Alvaro Soliverez 2016-07-15 09:37:06 UTC Comment hidden (obsolete)
Comment 4 Luke 2016-07-15 15:34:38 UTC
Comment on attachment 124723 [details]
docx file with troublesome checkbox

You discovered a valid bug. Check Box Content Controls don't work, while Combo Boxes do. It's just your initial bug doc was invalid. Let's keep it open with my example.
Comment 5 Aron Budea 2016-08-09 01:12:51 UTC
Same in 3.5.0, but no checkbox at all in 3.3.
Comment 6 Luke 2016-09-07 17:41:24 UTC Comment hidden (obsolete)
Comment 7 Tamás Zolnai 2017-08-23 08:56:27 UTC
It's (In reply to Luke from comment #6)
> *** This bug has been marked as a duplicate of bug 91384 ***

It's not a duplicate, because the other bug is about ActiveX controls, why this bug is about content control.
Comment 8 QA Administrators 2018-09-10 02:37:30 UTC Comment hidden (obsolete)
Comment 9 Luke 2018-09-10 03:11:41 UTC
content controls not working in Version: (x64)
Build ID: dff829e863fd05bedd5bcb713cd80c10fa582932
Comment 10 Luke 2018-09-29 22:19:35 UTC Comment hidden (obsolete)
Comment 11 Justin L 2018-10-01 14:35:51 UTC
I tried this in Word 2003, and there it also acts like a picture. So this is a fairly new feature in Word - at least the interactive part of content controls.

In word 2016, I tried to save as .doc format where it warns that the controls will be turned into static content.

It looks like we fall back on inserting a literal 0x2610 / 0x2612 Unicode character because of <w:t>☐</w:t>  or   <w:t>☒</w:t> (although that isn't strictly necessary because the code specifies the checked/unchecked possibility).
  <w14:checked w14:val="0"/>
  <w14:checkedState w14:val="2612" w14:font="MS Gothic"/>
  <w14:uncheckedState w14:val="2610" w14:font="MS Gothic"/>
Comment 12 Justin L 2018-10-02 06:44:04 UTC
Created attachment 145313 [details]
CheckboxContentControl2.docx : can't use OLE checkboxes are replacement

To fix this will require designing backend and UI code specifically for this situation (which appears to be for Word only). Although for most documents simply substituting our normal interactive checkbox would look fine (since it uses a 12pt sized ballot box), it lacks the flexibility of these unique checkboxes. CheckboxContentControl2.docx presents the challenging aspects of this (which looks fine in the current implementation since the checkbox is just simple text).

Perhaps the best way to fix this would be to adapt the existing checkbox to handle different presentation (Unicode characters) and scaling. That would remove the need to add interactive UI code.
Comment 13 Justin L 2018-10-02 07:11:13 UTC
Created attachment 145314 [details]
tdf99571_badAssumptions.patch: convert Sdt to interactive 12pt checkbox

I don't plan to continue working on this, so I'll post my failed, rough proof of concept patch here.

Although the original document looks great with this patch (and so probably would most documents), it fails miserably on comment 12's test.
Comment 14 Luke 2018-10-02 17:57:57 UTC
Created attachment 145334 [details]
Sample with most Content Controls available in Word 2016

Justin L,
Thanks for looking into this. One thing that I don't understand is what is unique about the checkbox content control from all other content controls? As you can see from this example, all of these other content controls are not only imported, but they are also functional.
Comment 15 Justin L 2018-10-03 07:20:45 UTC
(In reply to Luke from comment #14)
> As you can see from this example, all of these other content controls are
> not only imported, but they are also functional.

Luke, you didn't try to do anything special to the items in your example. I can break almost every one of them.
1.) Rich text control: set as "do not allow content modification". In LO, this is just plain text and not in any kind of textbox at all.  The text can be modified. So really this control is not at all imported nor functional.

2.) Plain text control: set a title.  In LO there is no title that appears when you click in the text.

3.) Image: set "contents cannot be edited." It can be edited in LO because it is just an image, and not even the Protect:Contents/Position/Size options have been set in LO.

4.) Choose an item.:  Change the color and size of the text. In LO those settings are ignored. Plus, in Word there is no border/dropdown showing until you click on the control. That is because in Word this is just text until you click in the "area" of the control, and then it becomes something special.

6.) Empty Date picker: In Word we see "Click or tap to enter a date" and in LO we see an ugly, empty box.

But I guess your main point is that the other items choose functionality over beauty, so why not do the same for the checkboxes? Well, that's one reason why I posted my patch - anyone who wants to take responsibility for the change can take the code, clean it up, and submit it.  :-)

My biggest concern is with the spacing used (to prevent layout regressions), and I think I covered that OK in my example patch. Probably a good addition would be to center the control in the available space.
Comment 16 Luke 2019-02-16 17:49:53 UTC Comment hidden (obsolete)
Comment 17 Xisco Faulí 2019-07-17 08:31:42 UTC Comment hidden (obsolete)
Comment 18 Tamás Zolnai 2019-07-17 09:36:41 UTC
(In reply to Xisco Faulí from comment #17)
> Hello Luke, Justin L, Tamás,
> Is the issue fixed in master after the recent MSForms fixes done by Tamás ?

It's not fixed as I know. Only the date picker content control is touched. (and the legacy form fields earlier)
Comment 19 NISZ LibreOffice Team 2020-03-30 16:21:29 UTC
*** Bug 118236 has been marked as a duplicate of this bug. ***
Comment 20 raal 2022-02-20 18:15:46 UTC
*** Bug 147356 has been marked as a duplicate of this bug. ***
Comment 21 Gabor Kelemen (allotropia) 2022-06-30 22:42:10 UTC
These are clickable since:


author	Miklos Vajna <vmiklos@collabora.com>	2022-04-29 08:12:25 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	2022-04-29 09:03:01 +0200
commit c53d3a1f4b8430507d54f5fac336870df7a700af (patch)

sw content controls, checkbox: add DOCX import

Thanks Miklos!