sw/source/filter/ww8/docxattributeoutput.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 77f7f28df730d4720188a59e43ea58fc47880975 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Feb 1 12:31:46 2023 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Feb 2 08:58:29 2023 +0000 tdf#148952 sw: DOCX export: ECMA-376 1st ed does not allow title ... attribute, so fallback to merge the value with the description into the descr attribute. Change-Id: I4e83a67788d0c82dd762c075f06db358a7884675 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146444 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit d09996a0d66c51908103afef9c56679b891570d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146460 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7a203c85fbf4..538e861352c8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5682,9 +5682,22 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size rtl::Reference<::sax_fastparser::FastAttributeList> docPrattrList = FastSerializerHelper::createAttrList(); docPrattrList->add( XML_id, OString::number( m_anchorId++).getStr()); docPrattrList->add( XML_name, OUStringToOString( pFrameFormat->GetName(), RTL_TEXTENCODING_UTF8 ) ); - docPrattrList->add( XML_descr, OUStringToOString( pGrfNode ? pGrfNode->GetDescription() : pOLEFrameFormat->GetObjDescription(), RTL_TEXTENCODING_UTF8 )); + OUString const descr(pGrfNode ? pGrfNode->GetDescription() : pOLEFrameFormat->GetObjDescription()); + OUString const title(pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle()); if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT ) - docPrattrList->add( XML_title, OUStringToOString( pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle(), RTL_TEXTENCODING_UTF8 )); + { + docPrattrList->add(XML_descr, OUStringToOString(descr, RTL_TEXTENCODING_UTF8)); + docPrattrList->add(XML_title, OUStringToOString(title, RTL_TEXTENCODING_UTF8)); + } + else + { // tdf#148952 no title attribute, merge it into descr + OUString const value(title.isEmpty() + ? descr + : descr.isEmpty() + ? title + : title + OUString::Concat("\n") + descr); + docPrattrList->add(XML_descr, OUStringToOString(value, RTL_TEXTENCODING_UTF8)); + } m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrattrList ); OUString sURL, sRelId;