include/oox/core/filterbase.hxx | 9 ++++++++- oox/source/core/filterbase.cxx | 2 +- oox/source/export/shapes.cxx | 2 +- starmath/source/ooxmlexport.cxx | 2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 18 ++++++++++-------- 5 files changed, 21 insertions(+), 12 deletions(-)
New commits: commit 2c0c95af13662f37e7f217e0bd0fc87ebde36f1b Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Feb 1 11:12:19 2023 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 1 11:34:49 2023 +0000 tdf#107841 oox: rename ambiguous and confusing ECMA_DIALECT Change-Id: I731b3808896347332f938811715597ac814ae1d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146433 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index 73b8e2d8e7f2..4ef7018d5fda 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -73,7 +73,14 @@ namespace oox::core { enum OoxmlVersion { - ECMA_DIALECT, + /** There are currently 5 editions of ECMA-376, latest is from 2021. + * 1st edition allegedly corresponds to Word 2007 + * 2nd edition allegedly corresponds to ISO 29500:2008 + * it's unclear what changed in later editions; there is: + Annex M. Differences Between ECMA-376:2016 and ECMA-376:2006 + but that's relative to 1st edition. + */ + ECMA_376_1ST_EDITION, ISOIEC_29500_2008 }; diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 5357dae3f86b..cc00953685a0 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -168,7 +168,7 @@ struct FilterBaseImpl FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext ) : meDirection( FILTERDIRECTION_UNKNOWN ), - meVersion( ECMA_DIALECT ), + meVersion(ECMA_376_1ST_EDITION), mxComponentContext( rxContext, UNO_SET_THROW ), mbExportVBA(false), mbExportTemplate(false) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 1c828d438653..676d3f75c201 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2701,7 +2701,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) // pic element SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape)); // The spec doesn't allow <p:pic> here, but PowerPoint requires it. - bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT; + bool const bEcma = mpFB->getVersion() == oox::core::ECMA_376_1ST_EDITION; if (bEcma) if (auto pOle2Obj = dynamic_cast<SdrOle2Obj*>(pSdrOLE2)) { diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index d90f56cc488a..fd3a9498a681 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -107,7 +107,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/) m_pSerializer->singleElementNS(XML_m, XML_nor); m_pSerializer->endElementNS( XML_m, XML_rPr ); } - if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_DIALECT == version) + if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_376_1ST_EDITION == version) { // HACK: MSOffice2007 does not import characters properly unless this font is explicitly given m_pSerializer->startElementNS(XML_w, XML_rPr); m_pSerializer->singleElementNS( XML_w, XML_rFonts, FSNS( XML_w, XML_ascii ), "Cambria Math", diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3a0bfaf5baf7..05e0ea5f0479 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4307,7 +4307,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( ); - bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; + bool const bEcma = GetExport().GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; // Output any table cell redlines if there are any attached to this specific cell TableCellRedline( pTableTextNodeInfoInner ); @@ -4561,7 +4561,7 @@ sal_Int32 lcl_getWordCompatibilityMode(const DocxExport& rDocExport) void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { - bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; + bool const bEcma = GetExport().GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; // Write the table properties m_pSerializer->startElementNS(XML_w, XML_tblPr); @@ -4955,7 +4955,7 @@ void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::P const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); const SwFrameFormat * pFrameFormat = pTabBox->GetFrameFormat(); const SvxBoxItem& rBox = pFrameFormat->GetBox( ); - const bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; + const bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_376_1ST_EDITION; impl_cellMargins(m_pSerializer, rBox, XML_tblCellMar, !bEcma); } @@ -5748,8 +5748,10 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size 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 )); - if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT ) + if (GetExport().GetFilter().getVersion() != oox::core::ECMA_376_1ST_EDITION) + { docPrattrList->add( XML_title, OUStringToOString( pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle(), RTL_TEXTENCODING_UTF8 )); + } m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrattrList ); OUString sURL, sRelId; @@ -7774,7 +7776,7 @@ void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEnc aCharSet = "0" + aCharSet; pAttr->add(FSNS(XML_w, XML_val), aCharSet); - if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT ) + if (GetExport().GetFilter().getVersion() != oox::core::ECMA_376_1ST_EDITION) { if( const char* charset = rtl_getMimeCharsetFromTextEncoding( nEncoding )) pAttr->add( FSNS( XML_w, XML_characterSet ), charset ); @@ -8171,7 +8173,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, // justification const char *pJc; - bool ecmaDialect = ( m_rExport.GetFilter().getVersion() == oox::core::ECMA_DIALECT ); + bool const ecmaDialect = m_rExport.GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; switch ( eAdjust ) { case SvxAdjust::Center: pJc = "center"; break; @@ -9273,7 +9275,7 @@ void DocxAttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust ) { const char *pAdjustString; - bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; + bool const bEcma = GetExport().GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; const SfxItemSet* pItems = GetExport().GetCurItemSet(); const SvxFrameDirectionItem* rFrameDir = pItems? @@ -9586,7 +9588,7 @@ void DocxAttributeOutput::FormatPaperBin( const SvxPaperBinItem& ) void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) { - bool bEcma = m_rExport.GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; + bool const bEcma = m_rExport.GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; if (m_rExport.SdrExporter().getTextFrameSyntax()) {