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

List:       kde-commits
Subject:    koffice/filters/kpresenter/pptx
From:       Lassi Taneli Nieminen <lassniem () gmail ! com>
Date:       2010-11-17 13:42:32
Message-ID: 20101117134232.19EFFAC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1198117 by lassin:

Fixed a pptx bug where sometimes placeholders form slidelayout were in slides when \
they shouldn't have.


 M  +13 -8     PptxXmlSlideReader.cpp  


--- trunk/koffice/filters/kpresenter/pptx/PptxXmlSlideReader.cpp #1198116:1198117
@@ -1140,19 +1140,20 @@
 
     bool potentiallyAddToLayoutFrames = false;
 
-    QBuffer shapeBuf;
-    KoXmlWriter shapeWriter(&shapeBuf);
+    QBuffer* shapeBuf;
+    KoXmlWriter *shapeWriter;
     KoXmlWriter *bodyBackup = body;
 
-    if (m_context->type == SlideLayout) {
-        body = &shapeWriter;
-    }
-
     while (!atEnd()) {
         readNext();
         kDebug() << *this;
         BREAK_IF_END_OF(CURRENT_EL);
         if (isStartElement()) {
+            if (m_context->type == SlideLayout) {
+                shapeBuf = new QBuffer;
+                shapeWriter = new KoXmlWriter(shapeBuf);
+                body = shapeWriter;
+            }
             if (qualifiedName() == "p:sp") {
                 TRY_READ(sp)
                 potentiallyAddToLayoutFrames = true;
@@ -1176,15 +1177,19 @@
             else {
                 potentiallyAddToLayoutFrames = false;
             }
+            if (m_context->type == SlideLayout) {
             // Checking, whether we are in layout, if so, we may have to forward \
some shapes to slides +                // An alternative approach is to put these to \
masterslides, but it could in practise mean that there are +                // \
slidemaster * slideLayout masterslides, ie ~40, and it's bit trickier  if \
(potentiallyAddToLayoutFrames) {  potentiallyAddToLayoutFrames = false;
-                if (m_context->type == SlideLayout) {
                     if (!d->phRead) {
-                        const QString elementContents = \
QString::fromUtf8(shapeBuf.buffer(), shapeBuf.buffer().size()); +                     \
const QString elementContents = QString::fromUtf8(shapeBuf->buffer(), \
                shapeBuf->buffer().size());
                         \
m_context->slideLayoutProperties->layoutFrames.push_back(elementContents);  }
                 }
+                delete shapeBuf;
+                delete shapeWriter;
             }
 //! @todo add ELSE_WRONG_FORMAT
         }


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

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