sw/qa/extras/ooxmlimport/data/tdf107784.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 17 +++++++++++++++++ sw/source/core/fields/fldbas.cxx | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit fadce0c9a7ccbd7222df90e41d8fc16d9d67045f Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Sep 24 11:14:43 2019 +0200 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Tue Sep 24 14:54:11 2019 +0200 tdf#107784: DOCX Import: Show citation's title in fields Regression from 06f7d1a96eef5aa69d4872ff6d96eb5085296d09 The problem is ConditionalExpandAuthIdentifier method uses AUTH_FIELD_IDENTIFIER while we want to use AUTH_FIELD_TITLE for citations, as we do in DomainMapper_Impl::SetFieldResult Change-Id: I30dcceba79dda3532ce10732e43303233d2ee441 Reviewed-on: https://gerrit.libreoffice.org/79441 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 417d993b8b8a86c019758ee0850e4b42967e2afa) Reviewed-on: https://gerrit.libreoffice.org/79450 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ooxmlimport/data/tdf107784.docx b/sw/qa/extras/ooxmlimport/data/tdf107784.docx new file mode 100644 index 000000000000..2dc868246ac0 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf107784.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b49583b3b4d0..4ee66606b7a6 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -687,6 +687,23 @@ DECLARE_OOXMLIMPORT_TEST(testTdf105975formula, "tdf105975.docx") CPPUNIT_ASSERT_EQUAL(OUString("25"), xEnumerationAccess->getPresentation(false).trim()); } +DECLARE_OOXMLIMPORT_TEST(testTdf107784, "tdf107784.docx") +{ + // Make sure the field displays the citation's title and not the identifier + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference<text::XTextField> xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Bibliography entry"), xEnumerationAccess->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("(Smith, 1950)"), xEnumerationAccess->getPresentation(false).trim()); +} + DECLARE_OOXMLIMPORT_TEST(testTdf115883, "tdf115883.docx") { // Import failed due to an unhandled exception when getting the Surround diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index a5008b4c4e3a..f24542012707 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -418,7 +418,7 @@ SwField::ExpandField(bool const bCached, SwRootFrame const*const pLayout) const if (GetTypeId() == TYP_AUTHORITY) { const SwAuthorityField* pAuthorityField = static_cast<const SwAuthorityField*>(this); - m_Cache = pAuthorityField->ConditionalExpandAuthIdentifier(pLayout); + m_Cache = pAuthorityField->ExpandCitation(AUTH_FIELD_TITLE, pLayout); } else m_Cache = ExpandImpl(pLayout); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits