diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-02-01 12:31:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-02 08:58:29 +0000 |
commit | 77f7f28df730d4720188a59e43ea58fc47880975 (patch) | |
tree | 3d5475cf98e7c53ebef362d1b87630dcddda7b2d /sw | |
parent | 1ca9f7fc85db66c7c6ba25d43f05476ea787dfc4 (diff) |
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.stahl@allotropia.de>
(cherry picked from commit d09996a0d66c51908103afef9c56679b891570d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146460
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
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; |