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

List:       kde-commits
Subject:    koffice/filters/kspread/excel/sidewinder
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2009-12-16 0:03:10
Message-ID: 1260921790.972840.32186.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1062787 by sebsauer:

Provides either the embedded storage's url or the offset+size in the controlstream \
for the raw picture data

 M  +37 -5     excel.cpp  
 M  +34 -1     objects.h  


--- trunk/koffice/filters/kspread/excel/sidewinder/excel.cpp #1062786:1062787
@@ -27,6 +27,7 @@
 #include <map>
 #include <stdlib.h>
 #include <string.h>
+#include <sstream>
 
 #include <QDebug>
 #include <QDateTime>
@@ -1321,6 +1322,10 @@
     //const unsigned long unused9 = readU32(startFtCmo + 14);
     //const unsigned long unused10 = readU32(startFtCmo + 18);
 
+    bool fDde = false; // dynamic data exchange reference?
+    bool fCtl = false; // ActiveX control?
+    bool fPrstm = false; // false=embedded store or true=control stream
+    
     const unsigned char* startPict = data + 22;
     switch (ot) {
     case Object::Group: // gmo
@@ -1355,12 +1360,12 @@
         Q_ASSERT(cb2 == 0x0002);
         const unsigned long opts2 = readU16(startPict + 10);
         //const bool fAutoPict = opts2 & 0x01;
-        const bool fDde = opts2 & 0x02; // dynamic data exchange reference?
+        fDde = opts2 & 0x02; // dynamic data exchange reference?
         //const bool dPrintCalc = opts2 & 0x04;
         //const bool fIcon = opts2 & 0x08;
-        const bool FCtl = opts2 & 0x10; // ActiveX control?
-        Q_ASSERT( ! (FCtl && fDde) );
-        const bool fPrstm = opts2 & 0x20; // false=embedded store or true=control \
stream +        fCtl = opts2 & 0x10; // ActiveX control?
+        Q_ASSERT( ! (fCtl && fDde) );
+        fPrstm = opts2 & 0x20;
         //const bool unused1 = opts2 & 0x60;
         //const bool fCamera = opts2 & 0xC0;
         //const bool fDefaultSize = opts2 & 0x180;
@@ -1371,7 +1376,7 @@
         //const bool unused5 = opts2 & 0x3000;
         //const bool unused6 = opts2 & 0x6000;
         //const bool unused7 = opts2 & 0xC000;
-        printf("ObjRecord::setData picture fDde=%i FCtl=%i \
fPrstm=%i\n",fDde,FCtl,fPrstm); +        printf("ObjRecord::setData picture fDde=%i \
FCtl=%i fPrstm=%i\n",fDde,fCtl,fPrstm);  startPict += 12;
     }
     break;
@@ -1508,6 +1513,33 @@
             }
         }
         startPict += cbFmla - cbFmlaSize - embedInfoSize; // padding
+        
+        // IPosInCtlStm variable
+        if(token.id() == FormulaToken::Table) {
+            const unsigned int iposInCtlStm = readU32(startPict);
+            if(fPrstm) { // iposInCtlStm specifies the zero-based offset of this \
object's data within the control stream. +                const unsigned int \
cbBufInCtlStm = readU32(startPict + 4); +                \
static_cast<PictureObject*>(m_object)->setControlStream(iposInCtlStm, cbBufInCtlStm); \
+            } else { // The object‘s data MUST reside in an embedding storage. +   \
std::stringstream out; +                out << std::hex << iposInCtlStm;
+                std::string filename = "MBD" + out.str();
+                static_cast<PictureObject*>(m_object)->setEmbeddedStorage(filename);
+            }
+        }
+        
+        // key variable, PictFmlaKey
+        if(fCtl) {
+            std::string key;
+            const unsigned int cbKey = readU32(startPict + 4);
+            for(uint i = 0; i < cbKey; ++i) {
+                if(key.size() > 0) key += ".";
+                key = readU32(startPict + 4 +  (i * 4));
+            }
+            //fmlaLinkedCell
+            //fmlaListFillRange
+            printf("ObjRecord::setData: Runtime license key is \"%s\"\n", key);
+        }
     }
     
 }
--- trunk/koffice/filters/kspread/excel/sidewinder/objects.h #1062786:1062787
@@ -82,8 +82,10 @@
 class PictureObject : public Object
 {
 public:
-    PictureObject(unsigned long id) : Object(Picture, id) {}
+    PictureObject(unsigned long id) : Object(Picture, id), m_offset(0), m_size(0) {}
     virtual ~PictureObject() {}
+    
+    /// Enumeration of possible image types.
     enum Type { EnhancedMetafile, Bitmap, Unspecified };
     /// Returns the type of the image.
     Type type() const {
@@ -93,8 +95,39 @@
     void setType(const Type &t) {
         m_type = t;
     }
+    
+    /// Returns the offset of the picture in the control stream.
+    uint controlStreamOffset() {
+        return m_offset;
+    }
+    /// Returns the size of the picture in the control stream.
+    uint controlStreamSize() {
+        return m_size;
+    }
+    /// Sets the offset and size of the picture in the control stream.
+    void setControlStream(uint offset, uint size) {
+        m_offset = offset;
+        m_size = size;
+    }
+    
+    /**
+     * Returns the filename of the embedded storage. This can be empty if the
+     * picture is not located in an embedded but e.g. in a control stream.
+     * If not empty then thís is usually a concatenation of "MBD" and a eight
+     * byte hexadecimal representation.
+     */
+    std::string embeddedStorage() const {
+        return m_storage;
+    }
+    /// Set the filename of the embedded storage.
+    void setEmbeddedStorage(const std::string &filename) {
+        m_storage = filename;
+    }
 private:
     Type m_type;
+    uint m_offset, m_size;
+    std::string m_storage;
+    
 };
 
 /**


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

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