[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/filters
From:       Lassi Taneli Nieminen <lassniem () gmail ! com>
Date:       2010-10-11 13:54:06
Message-ID: 20101011135406.97496AC7E4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1184828 by lassin:

Fixed several docx readers to have correct context to allow them read pictures etc.


 M  +0 -1      kpresenter/pptx/CMakeLists.txt  
 M  +0 -1      kspread/xlsx/CMakeLists.txt  
 M  +29 -15    kword/docx/DocxImport.cpp  
 M  +31 -9     kword/docx/DocxXmlNumberingReader.cpp  
 M  +4 -2      kword/docx/DocxXmlNumberingReader.h  
 M  +4 -0      libmsooxml/MsooXmlCommonReader.h  
 M  +0 -3      libmsooxml/MsooXmlCommonReaderDrawingMLMethods.h  
 M  +2 -2      libmsooxml/VmlDrawingReader.h  


--- trunk/koffice/filters/kpresenter/pptx/CMakeLists.txt #1184827:1184828
@@ -12,7 +12,6 @@
     PptxXmlSlideReader.cpp
     PptxXmlCommentsReader.cpp
     PptxXmlCommentAuthorsReader.cpp
-    ${CMAKE_SOURCE_DIR}/filters/libmsooxml/VmlDrawingReader.cpp
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml/pole.cpp
     ${CMAKE_SOURCE_DIR}/filters/kspread/xlsx/ChartExport.cpp
     ${CMAKE_SOURCE_DIR}/filters/kspread/xlsx/XlsxXmlChartReader.cpp
--- trunk/koffice/filters/kspread/xlsx/CMakeLists.txt #1184827:1184828
@@ -19,7 +19,6 @@
     ChartExport.cpp
     FormulaParser.cpp
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml/pole.cpp
-    ${CMAKE_SOURCE_DIR}/filters/libmsooxml/VmlDrawingReader.cpp
 )
 
 kde4_add_plugin(xlsximport WITH_PREFIX ${xlsximport_PART_SRCS})
--- trunk/koffice/filters/kword/docx/DocxImport.cpp #1184827:1184828
@@ -291,49 +291,63 @@
 
     // 4. parse numbering
     {
-        const QString numberingPath(relationships->targetForType(documentPath, \
documentFile, +        const QString \
                numberingPathAndFile(relationships->targetForType(documentPath, \
                documentFile,
         QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + \
                "/numbering"));
-        kDebug() << "numberingPath:" << numberingPath;
         DocxXmlNumberingReader numberingReader(writers);
-        if (!numberingPath.isEmpty()) {
+        if (!numberingPathAndFile.isEmpty()) {
+            QString numberingPath, numberingFile;
+            MSOOXML::Utils::splitPathAndFile(numberingPathAndFile, &numberingPath, \
&numberingFile); +            DocxXmlDocumentReaderContext context(*this, \
numberingPath, numberingFile, *relationships, &themes); +
             RETURN_IF_ERROR( loadAndParseDocumentFromFileIfExists(
-                numberingPath, &numberingReader, writers, errorMessage) )
+                numberingPathAndFile, &numberingReader, writers, errorMessage, \
&context) )  }
     }
 
     // 5. parse footnotes
     {
-        const QString footnotePath(relationships->targetForType(documentPath, \
documentFile, +        const QString \
                footnotePathAndFile(relationships->targetForType(documentPath, \
                documentFile,
         QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + \
                "/footnotes"));
         //! @todo use m_contentTypes.values() when multiple paths are expected, e.g. \
                for ContentTypes::wordHeader
-        DocxXmlDocumentReaderContext context(
-            *this, documentPath, documentFile, *relationships, &themes);
         DocxXmlFootnoteReader footnoteReader(writers);
-        if (!footnotePath.isEmpty()) {
+        if (!footnotePathAndFile.isEmpty()) {
+            QString footnotePath, footnoteFile;
+            MSOOXML::Utils::splitPathAndFile(footnotePathAndFile, &footnotePath, \
&footnoteFile); +            DocxXmlDocumentReaderContext context(*this, \
footnotePath, footnoteFile, *relationships, &themes); +
             RETURN_IF_ERROR( loadAndParseDocumentFromFileIfExists(
-                footnotePath, &footnoteReader, writers, errorMessage, &context) )
+                footnotePathAndFile, &footnoteReader, writers, errorMessage, \
&context) )  }
 
     // 6. parse comments
-        const QString commentPath(relationships->targetForType(documentPath, \
documentFile, +        const QString \
                commentPathAndFile(relationships->targetForType(documentPath, \
                documentFile,
         QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + \
"/comments"));  DocxXmlCommentReader commentReader(writers);
-        if (!commentPath.isEmpty()) {
+        if (!commentPathAndFile.isEmpty()) {
+            QString commentPath, commentFile;
+            MSOOXML::Utils::splitPathAndFile(commentPathAndFile, &commentPath, \
&commentFile); +            DocxXmlDocumentReaderContext context(*this, commentPath, \
commentFile, *relationships, &themes); +
             RETURN_IF_ERROR( loadAndParseDocumentFromFileIfExists(
-                commentPath, &commentReader, writers, errorMessage, &context) )
+                commentPathAndFile, &commentReader, writers, errorMessage, &context) \
)  }
 
     // 7. parse endnotes
-        const QString endnotePath(relationships->targetForType(documentPath, \
documentFile, +        const QString \
                endnotePathAndFile(relationships->targetForType(documentPath, \
                documentFile,
         QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + \
"/endnotes"));  DocxXmlEndnoteReader endnoteReader(writers);
-        if (!endnotePath.isEmpty()) {
+        if (!endnotePathAndFile.isEmpty()) {
+            QString endnotePath, endnoteFile;
+            MSOOXML::Utils::splitPathAndFile(endnotePathAndFile, &endnotePath, \
&endnoteFile); +            DocxXmlDocumentReaderContext context(*this, endnotePath, \
endnoteFile, *relationships, &themes); +
             RETURN_IF_ERROR( loadAndParseDocumentFromFileIfExists(
-                endnotePath, &endnoteReader, writers, errorMessage, &context) )
+                endnotePathAndFile, &endnoteReader, writers, errorMessage, &context) \
)  }
 
     // 8. parse document
         DocxXmlDocumentReader documentReader(writers);
+        DocxXmlDocumentReaderContext context(*this, documentPath, documentFile, \
*relationships, &themes);  RETURN_IF_ERROR( loadAndParseDocument(
             d->mainDocumentContentType(), &documentReader, writers, errorMessage, \
&context) )  }
--- trunk/koffice/filters/kword/docx/DocxXmlNumberingReader.cpp #1184827:1184828
@@ -38,16 +38,14 @@
 class DocxXmlNumberingReader::Private
 {
 public:
-    Private() : counter(0) {
+    Private() {
     }
     ~Private() {
     }
-    QString pathAndFile;
-    int counter;
 };
 
 DocxXmlNumberingReader::DocxXmlNumberingReader(KoOdfWriters *writers)
-    : MSOOXML::MsooXmlCommonReader(writers)
+    : DocxXmlDocumentReader(writers)
     , d(new Private)
 {
     init();
@@ -60,13 +58,14 @@
 
 void DocxXmlNumberingReader::init()
 {
-    d->counter = 0;
+    m_insideGroup = false;
+    m_outputFrames = false;
 }
 
 KoFilter::ConversionStatus \
DocxXmlNumberingReader::read(MSOOXML::MsooXmlReaderContext* context)  {
-    Q_UNUSED(context)
-    kDebug() << "=============================";
+    m_context = static_cast<DocxXmlDocumentReaderContext*>(context);
+
     readNext();
     if (!isStartDocument()) {
         return KoFilter::WrongFormat;
@@ -197,6 +196,30 @@
 }
 
 #undef CURRENT_EL
+#define CURRENT_EL numPicBullet
+//! w:numPicBullet handler (Number picture bullet)
+/*!
+
+ Parent elements:
+
+ Child elements:
+*/
+KoFilter::ConversionStatus DocxXmlNumberingReader::read_numPicBullet()
+{
+    READ_PROLOGUE
+
+    while (!atEnd()) {
+        readNext();
+        BREAK_IF_END_OF(CURRENT_EL)
+        if (isStartElement()) {
+            TRY_READ_IF(pict)
+        }
+    }
+
+    READ_EPILOGUE
+}
+
+#undef CURRENT_EL
 #define CURRENT_EL numbering
 //! w:numbering handler (Numbering)
 /*!
@@ -215,6 +238,7 @@
         BREAK_IF_END_OF(CURRENT_EL)
         if (isStartElement()) {
             TRY_READ_IF(abstractNum)
+            ELSE_TRY_READ_IF(numPicBullet)
             ELSE_TRY_READ_IF(num)
         }
     }
@@ -354,8 +378,6 @@
         QString name = "NumStyle" + numId;
         KoGenStyles::InsertionFlags insertionFlags = \
KoGenStyles::DontAddNumberToName | KoGenStyles::AllowDuplicates;  \
                mainStyles->insert(m_currentListStyle, name, insertionFlags);
-        // Maybe this should go to styles.xml?
-        //mainStyles->markStyleForStylesXml(name);
     }
 
     READ_EPILOGUE
--- trunk/koffice/filters/kword/docx/DocxXmlNumberingReader.h #1184827:1184828
@@ -26,9 +26,10 @@
 
 #include <KoGenStyle.h>
 #include <KoListLevelProperties.h>
-#include <MsooXmlCommonReader.h>
 #include <QMap>
 
+#include "DocxXmlDocumentReader.h"
+
 //! A context structure for DocxXmlNumberingReader
 class DocxXmlNumberingReaderContext : public MSOOXML::MsooXmlReaderContext
 {
@@ -36,7 +37,7 @@
 };
 
 //! A class reading MSOOXML numbering markup - numbering.xml part.
-class DocxXmlNumberingReader : public MSOOXML::MsooXmlCommonReader
+class DocxXmlNumberingReader : public DocxXmlDocumentReader
 {
 public:
     explicit DocxXmlNumberingReader(KoOdfWriters *writers);
@@ -54,6 +55,7 @@
     KoFilter::ConversionStatus read_num();
     KoFilter::ConversionStatus read_abstractNumId();
     KoFilter::ConversionStatus read_lvlJc();
+    KoFilter::ConversionStatus read_numPicBullet();
 
     // Note we read pPr here for now because we are only interested in subset of pPr \
features  // which can be used with lists.
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReader.h #1184827:1184828
@@ -105,6 +105,10 @@
 
     bool m_moveToStylesXml;
 
+    QSize m_imageSize;
+
+    QMap<QString, QSize> m_imageSizes; //!< collects image sizes to avoid multiple \
checks +
     QPen m_currentPen;
 
     QSet<QString> m_copiedFiles; //!< collects source names to avoid multiple \
                copying of media files
--- trunk/koffice/filters/libmsooxml/MsooXmlCommonReaderDrawingMLMethods.h \
#1184827:1184828 @@ -232,14 +232,11 @@
 bool m_noFill;
 
 QString m_xlinkHref; //!< set by read_blip()
-QSize m_imageSize; //!< set by read_blip()
 QString m_recentSourceName; //!< set by read_blip()
 QString m_cNvPrId; //!< set by read_cNvPr()
 QString m_cNvPrName; //!< set by read_cNvPr()
 QString m_cNvPrDescr; //!< set by read_cNvPr()
 
-QMap<QString, QSize> m_imageSizes; //!< collects image sizes to avoid multiple \
                checks
-
 //! When dealing with colors there's no way to know what type of attribute
 //! we are setting. While MSOOXML doesn't need to know the context in which a
 //! color is used, ODF does need to know this.
--- trunk/koffice/filters/libmsooxml/VmlDrawingReader.h #1184827:1184828
@@ -27,7 +27,7 @@
 #include <MsooXmlCommonReader.h>
 #include <MsooXmlImport.h>
 
-class VmlDrawingReaderContext : public MSOOXML::MsooXmlReaderContext
+class MSOOXML_EXPORT VmlDrawingReaderContext : public MSOOXML::MsooXmlReaderContext
 {
 public:
     //! Creates the context object.
@@ -40,7 +40,7 @@
 };
 
 //! A class reading headers
-class VmlDrawingReader : public MSOOXML::MsooXmlCommonReader
+class MSOOXML_EXPORT VmlDrawingReader : public MSOOXML::MsooXmlCommonReader
 {
 public:
     explicit VmlDrawingReader(KoOdfWriters *writers);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic