From 297cf4e13895f8d6b68fbc474e908a901992327c Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Mon, 20 Apr 2026 13:12:15 +0200 Subject: [PATCH] Prevent warnings on attributes handled by base class SdXMLNumberFormatImportContext iterated the attribute list a second time after its SvXMLNumFormatContext base had already consumed it, emitting XMLOFF_WARN_UNKNOWN for everything except number:automatic-order. This prevents warnings like: warn:xmloff:...:XMLNumberStyles.cxx:595: unknown attribute urn:oasis:names:tc:opendocument:xmlns:style:1.0 style:name value=D6 for attributes the base class already handles correctly. Change-Id: I9d99d9fa72f4a174a2c16fdc5cb8901377bd8d3f Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1183 Tested-by: Jenkins CPCI Reviewed-by: Stephan Bergmann Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1451 Reviewed-by: Noel Grandin (cherry picked from commit 7a06eb6187c252aae52c40ad9dc6a6b9f8c1a07c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207069 Tested-by: Jenkins Reviewed-by: Julien Nabet --- include/xmloff/xmlnumfi.hxx | 1 + xmloff/inc/XMLNumberStylesImport.hxx | 1 - xmloff/source/draw/XMLNumberStyles.cxx | 11 +---------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx index c6a3159d796e..7cb3617fdb62 100644 --- a/include/xmloff/xmlnumfi.hxx +++ b/include/xmloff/xmlnumfi.hxx @@ -188,6 +188,7 @@ public: bool HasLongDoW() const { return m_bHasLongDoW; } void SetHasLongDoW(bool bSet) { m_bHasLongDoW = bSet; } + bool IsAutoOrder() const { return m_bAutoOrder; } void SetHasTrailingEmptyText(bool bSet) { m_bHasTrailingEmptyText = bSet; } void UpdateCalendar( const OUString& rNewCalendar ); diff --git a/xmloff/inc/XMLNumberStylesImport.hxx b/xmloff/inc/XMLNumberStylesImport.hxx index 7ff731245da2..46d20fd7822b 100644 --- a/xmloff/inc/XMLNumberStylesImport.hxx +++ b/xmloff/inc/XMLNumberStylesImport.hxx @@ -32,7 +32,6 @@ class SdXMLNumberFormatImportContext final : public SvXMLNumFormatContext friend class SdXMLNumberFormatMemberImportContext; bool mbTimeStyle; - bool mbAutomatic; DataStyleNumber mnElements[16]; sal_Int16 mnIndex; diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx index 5c5a0e63c584..fc245fc8c5c6 100644 --- a/xmloff/source/draw/XMLNumberStyles.cxx +++ b/xmloff/source/draw/XMLNumberStyles.cxx @@ -580,20 +580,11 @@ void SdXMLNumberFormatMemberImportContext::characters( const OUString& rChars ) SdXMLNumberFormatImportContext::SdXMLNumberFormatImportContext( SdXMLImport& rImport, sal_Int32 nElement, SvXMLNumImpData* pNewData, SvXMLStylesTokens nNewType, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, SvXMLStylesContext& rStyles) : SvXMLNumFormatContext(rImport, nElement, pNewData, nNewType, xAttrList, rStyles), - mbAutomatic( false ), mnElements{}, mnIndex(0), mnKey( -1 ) { mbTimeStyle = (nElement & TOKEN_MASK) == XML_TIME_STYLE; - - for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList )) - { - if( aIter.getToken() == XML_ELEMENT(NUMBER, XML_AUTOMATIC_ORDER) ) - mbAutomatic = IsXMLToken( aIter, XML_TRUE ); - else - XMLOFF_WARN_UNKNOWN("xmloff", aIter); - } } SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext() @@ -623,7 +614,7 @@ void SdXMLNumberFormatImportContext::add( std::u16string_view rNumberStyle, bool bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const { - if( (pStyle->mbAutomatic != mbAutomatic) && (nIndex == 0)) + if( (pStyle->mbAutomatic != IsAutoOrder()) && (nIndex == 0)) return false; sal_Int16 nCompareIndex;