diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2019-09-24 11:14:43 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-09-24 12:52:54 +0200 |
commit | 417d993b8b8a86c019758ee0850e4b42967e2afa (patch) | |
tree | f05a0fee79ea348c469a2cf831c000e272f54850 | |
parent | 22743603384ebc65643336b165087124f1834e8e (diff) |
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 <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf107784.docx | bin | 0 -> 14852 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf107784.docx b/sw/qa/extras/ooxmlimport/data/tdf107784.docx Binary files differnew file mode 100644 index 000000000000..2dc868246ac0 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf107784.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f90d894b0f1e..f5c85890e3b2 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -685,6 +685,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 c46e5bfd3824..0d8894141506 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() == SwFieldTypesEnum::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); |