From c148ab4b535a6e85bdaaabd487983999c4a023d7 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 17 Sep 2010 12:12:53 +0200 Subject: [PATCH] cws-vmiklos01.diff: Better RTF export filter --- sax/source/tools/fastserializer.cxx | 45 +++++++++++++++++++++++++++++ sax/source/tools/fastserializer.hxx | 7 +++++ svtools/inc/rtfkeywd.hxx | 12 ++++++++ 3 files changed, 64 insertions(+) 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 ); diff --git a/svtools/inc/rtfkeywd.hxx b/svtools/inc/rtfkeywd.hxx index 5ccd9149bd68..60963c58abbc 100644 --- a/svtools/inc/rtfkeywd.hxx +++ b/svtools/inc/rtfkeywd.hxx @@ -39,6 +39,7 @@ #define OOO_STRING_SVTOOLS_RTF_ALT "\\alt" #define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation" #define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi" +#define OOO_STRING_SVTOOLS_RTF_ATNDATE "\\atndate" #define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid" #define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author" #define OOO_STRING_SVTOOLS_RTF_B "\\b" @@ -976,12 +977,15 @@ #define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn" #define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin" #define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage" +#define OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE "\\shpbxignore" #define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin" #define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage" #define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara" +#define OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE "\\shpbyignore" #define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt" #define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr" #define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp" +#define OOO_STRING_SVTOOLS_RTF_SHPINST "\\shpinst" #define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft" #define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid" #define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor" @@ -993,6 +997,7 @@ #define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk" #define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr" #define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz" +#define OOO_STRING_SVTOOLS_RTF_SP "\\sp" #define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp" #define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp" #define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm" @@ -1138,4 +1143,11 @@ #define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave" #define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave" +// Support for nested tables +#define OOO_STRING_SVTOOLS_RTF_ITAP "\\itap" +#define OOO_STRING_SVTOOLS_RTF_NESTCELL "\\nestcell" +#define OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS "\\nesttableprops" +#define OOO_STRING_SVTOOLS_RTF_NESTROW "\\nestrow" +#define OOO_STRING_SVTOOLS_RTF_NONESTTABLES "\\nonesttables" + #endif // _RTFKEYWD_HXX