From c148ab4b535a6e85bdaaabd487983999c4a023d7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 17 Sep 2010 12:12:53 +0200 Subject: cws-vmiklos01.diff: Better RTF export filter --- sax/source/tools/fastserializer.cxx | 45 +++++++++++++++++++++++++++++++++++++ sax/source/tools/fastserializer.hxx | 7 ++++++ 2 files changed, 52 insertions(+) (limited to 'sax/source') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index b0318516b72c..d88e3140f956 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -34,6 +34,10 @@ #include +#if DEBUG +#include +#endif + using ::rtl::OString; using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -321,6 +325,28 @@ namespace sax_fastparser { maMarkStack.push( ForMerge() ); } +#if DEBUG + void FastSaxSerializer::printMarkStack( ) + { + ::std::stack< ForMerge > aCopy( maMarkStack ); + int nSize = aCopy.size(); + int i = 0; + while ( !aCopy.empty() ) + { + fprintf( stderr, "%d\n", nSize - i ); + + ForMerge aMarks = aCopy.top( ); + aMarks.print(); + + + fprintf( stderr, "\n" ); + + aCopy.pop( ); + i++; + } + } +#endif + void FastSaxSerializer::mergeTopMarks( sax_fastparser::MergeMarksEnum eMergeType ) { if ( maMarkStack.empty() ) @@ -360,6 +386,25 @@ namespace sax_fastparser { return maData; } +#if DEBUG + void FastSaxSerializer::ForMerge::print( ) + { + fprintf( stderr, "Data: " ); + for ( sal_Int32 i=0, len=maData.getLength(); i < len; i++ ) + { + fprintf( stderr, "%c", maData[i] ); + } + + fprintf( stderr, "\nPostponed: " ); + for ( sal_Int32 i=0, len=maPostponed.getLength(); i < len; i++ ) + { + fprintf( stderr, "%c", maPostponed[i] ); + } + + fprintf( stderr, "\n" ); + } +#endif + void FastSaxSerializer::ForMerge::prepend( const Int8Sequence &rWhat ) { merge( maData, rWhat, false ); diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index a98a0ff7a67d..39f471fd7009 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -134,6 +134,9 @@ private: ForMerge() : maData(), maPostponed() {} Int8Sequence& getData(); +#if DEBUG + void print(); +#endif void prepend( const Int8Sequence &rWhat ); void append( const Int8Sequence &rWhat ); @@ -143,6 +146,10 @@ private: static void merge( Int8Sequence &rTop, const Int8Sequence &rMerge, bool bAppend ); }; +#if DEBUG + void printMarkStack( ); +#endif + ::std::stack< ForMerge > maMarkStack; void writeFastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ); -- cgit v1.2.3