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

List:       kde-commits
Subject:    koffice/filters/kpresenter/pptx
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2010-10-05 11:03:52
Message-ID: 20101005110352.1B8F33E1F2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1182677 by sebsauer:

Added logic to copy over the preview-image for atm unsupported oleObj's.
CC_MAIL:239560


 M  +26 -0     PptxXmlSlideReader.cpp  


--- trunk/koffice/filters/kpresenter/pptx/PptxXmlSlideReader.cpp #1182676:1182677
@@ -183,6 +183,7 @@
     //!set by read_t as true whenever some characters are copied to a textbox,
     //!used to figure out if a shape is a placeholder or not
     bool textBoxHasContent;
+    int numberOfOleObjects;
 };
 
 PptxXmlSlideReader::PptxXmlSlideReader(KoOdfWriters *writers)
@@ -207,6 +208,7 @@
     initDrawingML();
     documentReaderMode = false;
     m_defaultNamespace = QLatin1String(MSOOXML_CURRENT_NS ":");
+    d->numberOfOleObjects = 0;
 }
 
 KoFilter::ConversionStatus PptxXmlSlideReader::read(MSOOXML::MsooXmlReaderContext* context)
@@ -651,6 +653,11 @@
     TRY_READ_ATTR_WITHOUT_NS(progId);
     TRY_READ_ATTR_WITHOUT_NS(name);
 
+    /*
+    if(!imgW.isEmpty()) m_svgWidth = imgW.toInt();
+    if(!imgH.isEmpty()) m_svgHeight = imgH.toInt();
+    */
+
     while (!atEnd()) {
         readNext();
         BREAK_IF_END_OF(CURRENT_EL);
@@ -659,11 +666,26 @@
         }
     }
 
+    ++d->numberOfOleObjects;
+
     if (!r_id.isEmpty()) {
         QString sourceName(m_context->relationships->target(m_context->path, m_context->file, r_id));
         if (sourceName.isEmpty()) {
             return KoFilter::FileNotFound;
         }
+
+        if (progId == "PowerPoint.Show.12") {
+            // only copy over the preview-image for now
+            QString previewFileName = QString("image%1.emf").arg(d->numberOfOleObjects);
+            QString originalPreviewFilePath = "ppt/media/" + previewFileName;
+            if (copyFile(originalPreviewFilePath, "Pictures/", previewFileName) == KoFilter::OK) {
+                body->startElement("draw:image");
+                body->addAttribute("xlink:href", previewFileName);
+                body->addAttribute("xlink:show", "embed");
+                body->addAttribute("xlink:actuate", "onLoad");
+                body->endElement(); //draw:image
+            }
+        } else {
         QString destinationName;
 
         body->startElement("draw:object-ole");
@@ -692,7 +714,11 @@
             body->addAttribute("xlink:href", destinationName);
             body->endElement(); // draw:object
         }
+            else {
+                kWarning() << "Unhandled oleObj with progId=" << progId;
     }
+        }
+    }
 
     READ_EPILOGUE
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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