summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-25 05:12:22 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-25 05:12:22 +0000
commit1210f27b660efb7b37ff43ec68763e85a403471f (patch)
treefe42430788221f3a506f99f7ff18243b3b4e91ca
parent298f81ac353c4d7c8afa490d7979d3883b355e44 (diff)
downloadkoffice-1210f27b660efb7b37ff43ec68763e85a403471f.tar.gz
koffice-1210f27b660efb7b37ff43ec68763e85a403471f.zip
Fix Oasis format document saving
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1179320 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--kword/KWDocument.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/kword/KWDocument.cpp b/kword/KWDocument.cpp
index a1bf0c89..eb4f1461 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<KWFrameSet> 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<KWFrameSet::Info,const KWFrameSet*> tempmap;
+
// ## This loop is duplicated in saveOasisDocumentStyles
- for ( ; fit.current() ; ++fit ) {
+ for (TQPtrListIterator<KWFrameSet> 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<KWFrameSet::Info> 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; i<order.count(); ++i) {
+ KWFrameSet::Info info = order[i];
+ if (tempmap.contains(info)) {
+ const KWFrameSet* fs = tempmap[info];
+
// Save content
headerFooterTmpWriter.startElement( fs->headerFooterTag() ); // e.g. style:header
static_cast<const KWTextFrameSet *>(fs)->saveOasisContent( headerFooterTmpWriter, savingContext );
headerFooterTmpWriter.endElement();
}
}
+
// Add trailing '0' (Qt4: remove)
headerFooterContent.resize( headerFooterContent.size() + 1 );
headerFooterContent[headerFooterContent.size()-1] = '\0';