Bug 158582 - FILEOPEN DOCX Dropdown Content Controls are opened as legacy fields
Summary: FILEOPEN DOCX Dropdown Content Controls are opened as legacy fields
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.1.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: DOCX-Content_Control
  Show dependency treegraph
 
Reported: 2023-12-07 17:46 UTC by Gabor Kelemen (allotropia)
Modified: 2023-12-28 03:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
The example file in Word 2016 and Writer master (98.20 KB, image/png)
2023-12-07 17:47 UTC, Gabor Kelemen (allotropia)
Details
The second example file with problematic dropdown inside table (21.01 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-12-07 17:50 UTC, Gabor Kelemen (allotropia)
Details
The first example file (20.25 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-12-07 17:51 UTC, Gabor Kelemen (allotropia)
Details
Screenshot of the second document in Word and Writer (108.87 KB, image/png)
2023-12-07 17:51 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-12-07 17:46:54 UTC
In some cases the dropdown/listbox type content controls are opened as legacy fields.

This was added in bug 134043 in 7.1, to cover a special "legacy field in odt" -> docx -> Writer use case. Export already used sdt controls.

However this behavior was largely removed in 7.4 with commit:

https://git.libreoffice.org/core/+/24417d8c3c9e1c619936e85fa7a20481a24e3530
author	Miklos Vajna <vmiklos@collabora.com>	Wed May 11 08:17:32 2022 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	Wed May 11 09:25:27 2022 +0200

sw content controls, drop-down: add DOCX import

For example if the example file from bug 134043 attachment 162064 [details] is saved in 7.1, then reopened in 7.4, the fields open as proper content controls and not as legacy fields anymore. 

However there are still corner cases where the old hack is triggered. One such case is the unit test example file sw/qa/extras/ooxmlexport/data/combobox-control.docx which was added in bug 134043 and contains only a single dropdown content control. The attachment is a reproduction of this file to show it's nothing special.

Another case is when this content control is inside a table. I'm not sure why are these special, but overall I think this SdtHelper::createDropDownControl() method has outlived its usefulness. 
Also its behavior can be modified with the officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown config key: turning it off makes the content controls import as UNO form control, which  existed before the above hack to turn them into fields was added - another obsolete approach now that we have viable content control implementation.

1. Open attached document
-> Check in the Navigator that it contains a field
2. Go to Options - Advanced - Expert configuration
3. Search for the key ImportComboBoxAsDropDown and turn it off
4. Reload the document
-> Check in the Navigator that it no longer contains a field, but there is a form control

The same steps apply for the second example file.

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 43967453e15e1d054972a7586cfef8f8e0866270
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: threaded
Comment 1 Gabor Kelemen (allotropia) 2023-12-07 17:47:27 UTC
Created attachment 191295 [details]
The example file in Word 2016 and Writer master
Comment 2 Gabor Kelemen (allotropia) 2023-12-07 17:50:01 UTC
Created attachment 191296 [details]
The second example file with problematic dropdown inside table

Note that the very first dropdown is the same as in the other file, which is now a normal content control.
Comment 3 Gabor Kelemen (allotropia) 2023-12-07 17:51:00 UTC
Created attachment 191297 [details]
The first example file

somehow this got lost...
Comment 4 Gabor Kelemen (allotropia) 2023-12-07 17:51:49 UTC
Created attachment 191298 [details]
Screenshot of the second document in Word and Writer
Comment 5 Dieter 2023-12-27 11:15:51 UTC
I confirm for both axample files with

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 40617d867346956588ac023511f31210107217f4
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded