diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-08-16 07:14:28 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-12-02 12:40:35 +0100 |
commit | 2af6880c44cd9d4083c1258d5ad46238f53a6c4f (patch) | |
tree | 7d3403430335067c8dc24a171f21203d032896ae | |
parent | 53824b05f99ac7c68e6d48b53e2bd98c0fe274c7 (diff) |
prevent invalid ods files with loext:fill-character
ODF specifies that extension elements in a document are removed before
the validation. With our old implementation of the number format export
this could result in two number:text elements following each other.
According to the spec a number:text element may not follow another
number:text element.
The number:text element before loext:fill is actually not that
interesting so it makes more sense to make this one an extension
element.
Possible documents showing issues:
fdo45268-1.xlsx
fdo49150-1.xlsx
and many more
Conflicts:
xmloff/source/style/xmlnumfe.cxx
Change-Id: I3ad92b8a61a246b3dbc0132d9a2c367488a766d0
-rw-r--r-- | include/xmloff/xmlnumfe.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfi.cxx | 1 |
3 files changed, 7 insertions, 5 deletions
diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index e047de32b623..bc2517dfa18f 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustrbuf.hxx> +#include <boost/ptr_container/ptr_vector.hpp> #define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles" @@ -57,7 +58,7 @@ private: SAL_DLLPRIVATE void AddLanguageAttr_Impl( sal_Int32 nLang ); SAL_DLLPRIVATE void AddToTextElement_Impl( const OUString& rString ); - SAL_DLLPRIVATE void FinishTextElement_Impl(); + SAL_DLLPRIVATE void FinishTextElement_Impl(bool bUseExtensionNS = false); SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor ); SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger, diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 6658a3eb3aab..e6d0faee7435 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -46,7 +46,6 @@ #include <xmloff/xmlexp.hxx> #include <set> -#include <boost/ptr_container/ptr_vector.hpp> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -338,11 +337,12 @@ void SvXMLNumFmtExport::AddToTextElement_Impl( const OUString& rString ) sTextContent.append( rString ); } -void SvXMLNumFmtExport::FinishTextElement_Impl() +void SvXMLNumFmtExport::FinishTextElement_Impl(bool bUseExtensionNS) { if ( !sTextContent.isEmpty() ) { - SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, XML_TEXT, + sal_uInt16 nNS = bUseExtensionNS ? XML_NAMESPACE_LO_EXT : XML_NAMESPACE_NUMBER; + SvXMLElementExport aElem( rExport, nNS, XML_TEXT, sal_True, sal_False ); rExport.Characters( sTextContent.makeStringAndClear() ); } @@ -502,7 +502,7 @@ void SvXMLNumFmtExport::WriteMinutesElement_Impl( sal_Bool bLong ) void SvXMLNumFmtExport::WriteRepeatedElement_Impl( sal_Unicode nChar ) { - FinishTextElement_Impl(); + FinishTextElement_Impl(sal_True); SvXMLElementExport aElem( rExport, XML_NAMESPACE_LO_EXT, XML_FILL_CHARACTER, sal_True, sal_False ); rExport.Characters( OUString( nChar ) ); diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 8773f3aff2a8..9a108cd595c5 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -496,6 +496,7 @@ const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemTokenMap() static const SvXMLTokenMapEntry aStyleElemMap[] = { // elements in a style + { XML_NAMESPACE_LO_EXT, XML_TEXT, XML_TOK_STYLE_TEXT }, { XML_NAMESPACE_NUMBER, XML_TEXT, XML_TOK_STYLE_TEXT }, { XML_NAMESPACE_LO_EXT, XML_FILL_CHARACTER, XML_TOK_STYLE_FILL_CHARACTER }, { XML_NAMESPACE_NUMBER, XML_FILL_CHARACTER, XML_TOK_STYLE_FILL_CHARACTER }, |