[Libreoffice-commits] core.git: 3 commits - include/xmloff xmloff/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Fri Aug 15 22:27:48 PDT 2014


 include/xmloff/xmlnumfe.hxx      |    9 ++++++---
 xmloff/source/style/xmlnumfe.cxx |   10 ++++------
 xmloff/source/style/xmlnumfi.cxx |    1 +
 3 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 66c6d1ef204f3507e7663a1b8b1be05b9ec71092
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Aug 16 07:14:28 2014 +0200

    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
    
    Change-Id: I3ad92b8a61a246b3dbc0132d9a2c367488a766d0

diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
index c6ff370..3c898d7 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"
 
@@ -59,7 +60,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 f24693a..d0f46fc 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;
@@ -336,11 +335,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,
                                   true, false );
         rExport.Characters( sTextContent.makeStringAndClear() );
     }
@@ -500,7 +500,7 @@ void SvXMLNumFmtExport::WriteMinutesElement_Impl( bool bLong )
 
 void SvXMLNumFmtExport::WriteRepeatedElement_Impl( sal_Unicode nChar )
 {
-    FinishTextElement_Impl();
+    FinishTextElement_Impl(true);
     SvXMLElementExport aElem( rExport, XML_NAMESPACE_LO_EXT, XML_FILL_CHARACTER,
                                   true, false );
     rExport.Characters( OUString( nChar ) );
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 676cd822..35778d4 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -494,6 +494,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    },
commit a772be514e783e232b13c9ff7cde93fb0529c278
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Aug 16 06:52:16 2014 +0200

    just use a typedef, don't inherit from boost::ptr_container
    
    Change-Id: I1a63802dfeb702f6f6e9506339fd299b98fd8604

diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
index e14ebcc..c6ff370 100644
--- a/include/xmloff/xmlnumfe.hxx
+++ b/include/xmloff/xmlnumfe.hxx
@@ -38,7 +38,9 @@ class SvXMLAttributeList;
 class SvNumberFormatter;
 class SvNumberformat;
 class SvXMLNumUsedList_Impl;
-class SvXMLEmbeddedTextEntryArr;
+
+struct SvXMLEmbeddedTextEntry;
+typedef boost::ptr_vector<SvXMLEmbeddedTextEntry> SvXMLEmbeddedTextEntryArr;
 
 class XMLOFF_DLLPUBLIC SvXMLNumFmtExport
 {
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 0cfb0cd..f24693a 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -98,8 +98,6 @@ struct SvXMLEmbeddedTextEntry
         nSourcePos(nSP), nFormatPos(nFP), aText(rT) {}
 };
 
-class SvXMLEmbeddedTextEntryArr : public boost::ptr_vector<SvXMLEmbeddedTextEntry> {};
-
 //! SvXMLNumUsedList_Impl should be optimized!
 
 SvXMLNumUsedList_Impl::SvXMLNumUsedList_Impl() :
commit 61294d454d8c03887aa5113884035700110b609a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Aug 16 06:43:08 2014 +0200

    remove unnecessary whitespace
    
    Change-Id: I9de4fdd28c6d75133289b1c8a655381ecc5675c7

diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
index 86f4351..e14ebcc 100644
--- a/include/xmloff/xmlnumfe.hxx
+++ b/include/xmloff/xmlnumfe.hxx
@@ -86,7 +86,7 @@ private:
     SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
                                     sal_Int32 nKey, sal_Int32 nPart );
 
-    SAL_DLLPRIVATE void  WriteRepeatedElement_Impl( sal_Unicode ch );
+    SAL_DLLPRIVATE void WriteRepeatedElement_Impl( sal_Unicode ch );
     SAL_DLLPRIVATE bool WriteTextWithCurrency_Impl( const OUString& rString,
                             const ::com::sun::star::lang::Locale& rLocale );
     SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,


More information about the Libreoffice-commits mailing list