Bug 107784 - FILEOPEN: DOCX: Citation incorrectly displayed
Summary: FILEOPEN: DOCX: Citation incorrectly displayed
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:6.4.0 target:6.3.3
Keywords: bibisected, bisected, filter:docx, regression
: 94913 127672 (view as bug list)
Depends on:
Blocks: DOCX
  Show dependency treegraph
 
Reported: 2017-05-11 21:37 UTC by Xisco Faulí
Modified: 2021-07-19 08:09 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
sample (20.39 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-05-11 21:37 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2017-05-11 21:37:38 UTC
Created attachment 133246 [details]
sample

Steps to reproduce:
1. Open attached document

Citation displays  [CITATION Moz17 \l 1033] instead of (Mozilla, 1998-2017)

Reproduced in

Version: 5.3.3.2
Build ID: 1:5.3.3~rc2-0ubuntu0.16.10.1~lo0
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk3; Layout Engine: new; 
Locale: es-ES (ca_ES.UTF-8); Calc: group
Comment 1 Xisco Faulí 2017-05-11 21:38:55 UTC
Regression introduced by:

author	Rohit Deshmukh <rohit.deshmukh@synerzip.com>	2014-03-12 09:37:38 (GMT)
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-03-14 09:45:33 (GMT)
commit 06f7d1a96eef5aa69d4872ff6d96eb5085296d09 (patch)
tree 7b155faff164f15c78492b46a9c5586d05195e96
parent 7545a9054cd8fbca0073b4603b833080b4810a94 (diff)
fdo#74775: Preseved Citation after round trip.

Bisected with bibisect-43max.
Comment 2 QA Administrators 2018-08-22 02:38:05 UTC Comment hidden (obsolete)
Comment 3 Xisco Faulí 2019-09-23 15:53:03 UTC
*** Bug 127672 has been marked as a duplicate of this bug. ***
Comment 4 Xisco Faulí 2019-09-23 15:53:51 UTC
Hi Justin,
I thought you might be interested in this issue...
Comment 5 Xisco Faulí 2019-09-23 16:37:57 UTC
*** Bug 94913 has been marked as a duplicate of this bug. ***
Comment 6 Xisco Faulí 2019-09-23 16:39:21 UTC
@Tamás, I thought you might also be interested in this issue...
Comment 7 Xisco Faulí 2019-09-23 18:13:17 UTC
I believe the problem is in https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/fldbas.cxx?r=ebdf70cc#412 where it calls https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/authfld.cxx?r=3c6cb83b#487, thus we use AUTH_FIELD_IDENTIFIER instead of AUTH_FIELD_TITLE, which is the right value for citations... I might take a deeper look at it if I find some time...
Comment 9 Xisco Faulí 2019-09-23 18:18:39 UTC
I feel brave enough to take a look at it :D
Comment 10 Commit Notification 2019-09-24 10:53:49 UTC Comment hidden (obsolete)
Comment 11 Commit Notification 2019-09-24 12:54:57 UTC Comment hidden (obsolete)
Comment 12 Commit Notification 2019-09-24 16:01:10 UTC Comment hidden (obsolete)
Comment 13 Xisco Faulí 2019-09-24 17:07:48 UTC
I'm going to revert the fix -> https://gerrit.libreoffice.org/#/c/79472/
I've realized it's too aggressive and it affects bibliography citations in general.

I'll try to find another solution, for instance:

--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -51,6 +51,7 @@
 #include <fmtmeta.hxx>
 #include <reffld.hxx>
 #include <flddat.hxx>
+#include <authfld.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <sfx2/docfile.hxx>
 #include <svl/itemiter.hxx>
@@ -252,6 +253,14 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf,
             else if( subType == REF_SETREFATTR )
                 static_cast<SwFieldPortion*>(pRet)->m_nAttrFieldType = ATTR_SETREFATTRFLD;
             break;
+        case SwFieldIds::TableOfAuthorities:
+            {
+                OUString const aStr( bName
+                    ? pField->GetFieldName()
+                    : static_cast<SwAuthorityField const*>(pField)->ExpandCitation(AUTH_FIELD_TITLE, pFrame->getRootFrame()) );
+                pRet = new SwFieldPortion(aStr);
+            }
+            break;

but the test doesn't pass
Comment 14 Commit Notification 2019-09-24 19:00:52 UTC
Xisco Faulí committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/332a37ebf3eeb7546ef0972035d72c6e836bcc7d

Revert "tdf#107784: DOCX Import: Show citation's title in fields"

It will be available in 6.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2019-09-25 11:59:02 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c02b5cf6472ccb45a916369db493a40ed3e21d60

tdf#107784: DOCX Import: Show citation's title in fields (2nd take)

It will be available in 6.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2019-10-10 08:50:28 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/420c306394ff781fb361f1fb12b5b993a67dd36b

tdf#107784: DOCX Import: Show citation's title in fields (2nd take)

It will be available in 6.3.3.

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

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