[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: RE: fix for lists in msword-odf filter
From: Nohaj Miroslav <miroslav.nohaj () ixonos ! com>
Date: 2010-03-02 14:04:36
Message-ID: C495228385CC1D409A54846080C9CBA56802703055 () jklmail01 ! ixonos ! local
[Download RAW message or body]
I've noticed that I had a small coding convention issue (missing m_ prefix), the \
fixed version is attached.
BR,
Miroslav Nohaj
-----Original Message-----
From: Nohaj Miroslav [mailto:miroslav.nohaj@ixonos.com]
Sent: 2. marca 2010 14:50
To: For developer's discussion about KOffice
Subject: fix for lists in msword-odf filter
Hello all,
I've managed to make a small fix for msword-odf filter which solves the crash of \
KWord and/or koconverter when opening specific MS Word document... The original code \
selected 1 of 4 xmlWriters for starting and ending the list, and in that one \
particular case it selected different writer for ending the list as it selected for \
starting the list and therefore it crashed. It used the flags for the right writer \
selection, I've replaced that with QStack to store the writers and get them back in \
the opposite order when closing the lists.
Please see the attached diff and post any comments to the fix.
Best regards,
Miroslav Nohaj
["fix158091.diff" (application/octet-stream)]
Index: filters/kword/msword-odf/texthandler.cpp
===================================================================
--- filters/kword/msword-odf/texthandler.cpp (revision 1097940)
+++ filters/kword/msword-odf/texthandler.cpp (working copy)
@@ -57,7 +57,6 @@
return 0xad; // soft hyphen, according to kword.dtd
}
-
KWordTextHandler::KWordTextHandler(wvWare::SharedPtr<wvWare::Parser> parser, \
KoXmlWriter* bodyWriter, KoGenStyles* mainStyles) : m_writingHeader(false)
, m_writeMasterStyleName(false)
@@ -846,6 +845,9 @@
if (listInfo->lsid() == 1 && nfc == 255) {
return false;
}
+
+ m_usedListWriters.push(writer); // put the currently used writer in the stack
+
//process the different places we could be in a list
if (m_currentListID == 0) {
//we're starting a new list...
@@ -1078,17 +1080,7 @@
kDebug(30513);
// Set the correct XML writer.
//
- // TODO create m_writer, and just keep it pointing to the current writer
- KoXmlWriter *writer;
- if (m_insideFootnote) {
- writer = m_footnoteWriter;
- } else if (m_writingHeader) {
- writer = m_headerWriter;
- } else if (m_insideAnnotation) {
- writer = m_annotationWriter;
- } else {
- writer = m_bodyWriter;
- }
+ KoXmlWriter *writer = m_usedListWriters.pop(); // get the last used writer from \
stack
//TODO should probably test this more, to make sure it does work this way
//for level 0, we need to close the last item and the list
Index: filters/kword/msword-odf/texthandler.h
===================================================================
--- filters/kword/msword-odf/texthandler.h (revision 1097940)
+++ filters/kword/msword-odf/texthandler.h (working copy)
@@ -34,6 +34,7 @@
#include <QObject>
#include <QDomElement>
#include <QBuffer>
+#include <QStack>
#include <KoXmlWriter.h>
#include <KoGenStyles.h>
@@ -173,6 +174,7 @@
void saveState();
void restoreState();
+ QStack <KoXmlWriter*> m_usedListWriters;
// Current paragraph
wvWare::SharedPtr<const wvWare::Word97::SEP> m_sep; //store section info for \
section end
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic