From 1210f27b660efb7b37ff43ec68763e85a403471f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 25 Sep 2010 05:12:22 +0000 Subject: [PATCH] Fix Oasis format document saving git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1179320 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kword/KWDocument.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kword/KWDocument.cpp b/kword/KWDocument.cpp index a1bf0c892..eb4f14618 100644 --- a/kword/KWDocument.cpp +++ b/kword/KWDocument.cpp @@ -2844,9 +2844,13 @@ bool KWDocument::saveOasisHelper( KoStore* store, KoXmlWriter* manifestWriter, S QBuffer buffer( headerFooterContent ); buffer.open( IO_WriteOnly ); KoXmlWriter headerFooterTmpWriter( &buffer ); // TODO pass indentation level - QPtrListIterator fit = framesetsIterator(); + + // The order we write out header, header-left, etc. is important. So, we go here + // the dirty way to collect them first and then flush them ordered out. + TQMap tempmap; + // ## This loop is duplicated in saveOasisDocumentStyles - for ( ; fit.current() ; ++fit ) { + for (TQPtrListIterator fit = framesetsIterator(); fit.current() ; ++fit ) { const KWFrameSet* fs = fit.current(); if ( fs->isVisible() && // HACK to avoid saving [hidden] headers/footers framesets for now !fs->isFloating() && @@ -2854,12 +2858,25 @@ bool KWDocument::saveOasisHelper( KoStore* store, KoXmlWriter* manifestWriter, S fs->type() == FT_TEXT && fs->isHeaderOrFooter() ) { + tempmap.insert(fs->frameSetInfo(), fs); + } + } + + TQValueList order; + order << KWFrameSet::FI_FIRST_HEADER << KWFrameSet::FI_ODD_HEADER << KWFrameSet::FI_EVEN_HEADER + << KWFrameSet::FI_FIRST_FOOTER << KWFrameSet::FI_ODD_FOOTER << KWFrameSet::FI_EVEN_FOOTER; + for (uint i=0; iheaderFooterTag() ); // e.g. style:header static_cast(fs)->saveOasisContent( headerFooterTmpWriter, savingContext ); headerFooterTmpWriter.endElement(); } } + // Add trailing '0' (Qt4: remove) headerFooterContent.resize( headerFooterContent.size() + 1 ); headerFooterContent[headerFooterContent.size()-1] = '\0';