[Libreoffice-commits] .: comphelper/inc sax/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Nov 15 07:00:42 PST 2010


 comphelper/inc/comphelper/sequenceasvector.hxx |    5 +++++
 sax/source/tools/fastserializer.cxx            |   13 ++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 56f9f77f2190b92e07114e593b417385088f7afe
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Wed Nov 10 09:45:11 2010 +0100

    Docx Export: fixed some elements ordering problem
    
    Nested elements that weren't in the order sequence weren't appended to
    the parent... and then skipped.

diff --git a/comphelper/inc/comphelper/sequenceasvector.hxx b/comphelper/inc/comphelper/sequenceasvector.hxx
index 730c5e1..a9115cf 100644
--- a/comphelper/inc/comphelper/sequenceasvector.hxx
+++ b/comphelper/inc/comphelper/sequenceasvector.hxx
@@ -68,6 +68,11 @@ class SequenceAsVector : public ::std::vector< TElementType >
                     types from the base! */
         typedef typename ::std::vector< TElementType >::const_iterator const_iterator;
 
+        //---------------------------------------
+        /** @short  When inheriting from a template using typename is generally required when using
+                    types from the base! */
+        typedef typename ::std::vector< TElementType >::iterator iterator;
+
     //-------------------------------------------
     // interface
     public:
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 7e83940..5f31a23 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -30,6 +30,8 @@
 #include <rtl/ustrbuf.hxx>
 #include <rtl/byteseq.hxx>
 
+#include <comphelper/sequenceasvector.hxx>
+
 #include <com/sun/star/xml/Attribute.hpp>
 #include <com/sun/star/xml/FastAttribute.hpp>
 #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
@@ -40,6 +42,7 @@
 #include <cstdio>
 #endif
 
+using ::comphelper::SequenceAsVector;
 using ::rtl::OString;
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -465,9 +468,13 @@ namespace sax_fastparser {
 
     void FastSaxSerializer::ForSort::setCurrentElement( sal_Int32 nElement )
     {
-        mnCurrentElement = nElement;
-        if ( maData.find( nElement ) == maData.end() )
-            maData[ nElement ] = Int8Sequence();
+        SequenceAsVector< sal_Int32 > aOrder( maOrder );
+        if( std::find( aOrder.begin(), aOrder.end(), nElement ) != aOrder.end() )
+        {
+            mnCurrentElement = nElement;
+            if ( maData.find( nElement ) == maData.end() )
+                maData[ nElement ] = Int8Sequence();
+        }
     }
 
     void FastSaxSerializer::ForSort::prepend( const Int8Sequence &rWhat )


More information about the Libreoffice-commits mailing list