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

List:       kde-commits
Subject:    koffice/filters/kspread/excel
From:       Marijn Kruisselbrink <m.kruisselbrink () student ! tue ! nl>
Date:       2010-08-16 19:45:08
Message-ID: 20100816194508.63BD9AC854 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1164462 by mkruisselbrink:

add support for non cell-anchored shapes. Although in my test files the only shapes \
with no cell-anchor are actually supposed to be in a group, which currently means \
size&position of these shapes is wrong.

 M  +23 -0     import/excelimport.cc  
 M  +11 -0     sidewinder/sheet.cpp  
 M  +3 -0      sidewinder/sheet.h  
 M  +1 -0      sidewinder/worksheetsubstreamhandler.cpp  


--- trunk/koffice/filters/kspread/excel/import/excelimport.cc #1164461:1164462
@@ -133,6 +133,7 @@
 
     QList<ChartExport*> charts;
     QHash<Cell*, QByteArray> cellShapes;
+    QHash<Sheet*, QByteArray> sheetShapes;
 
     QHash<Row*,int> rowsRepeatedHash;
     int rowsRepeated(Row* row, int rowIndex);
@@ -703,6 +704,14 @@
        //xmlWriter->addAttribute("table:protection-key", uint(sheet->password()));
     }
 
+    QList<MSO::OfficeArtSpgrContainerFileBlock> objects = sheet->drawObjects();
+    if (!objects.empty()) {
+        xmlWriter->startElement("table:shapes");
+        xmlWriter->addCompleteElement(sheetShapes[sheet]);
+        xmlWriter->endElement(); // table:shapes
+    }
+
+
     const unsigned columnCount = qMin(maximalColumnCount, sheet->maxColumn());
     unsigned outlineLevel = 0;
     for (unsigned i = 0; i <= columnCount; ++i) {
@@ -772,7 +781,21 @@
     for (unsigned i = 0; i <= rowCount;) {
         i += processRowForStyle(sheet, i, xmlWriter);
     }
+
+    QList<MSO::OfficeArtSpgrContainerFileBlock> objects = sheet->drawObjects();
+    if (!objects.empty()) {
+        ODrawClient client = ODrawClient(sheet);
+        ODrawToOdf odraw(client);
+        QBuffer b;
+        KoXmlWriter xml(&b);
+        Writer writer(xml, *styles, false);
+        foreach (const MSO::OfficeArtSpgrContainerFileBlock& fb, objects) {
+            odraw.processDrawing(fb, writer);
 }
+        sheetShapes[sheet] = b.data();
+        //qDebug() << b.data();
+    }
+}
 
 // Processes headers and footers for a sheet.
 void ExcelImport::Private::processSheetForHeaderFooter(Sheet* sheet, KoXmlWriter* \
                xmlWriter)
--- trunk/koffice/filters/kspread/excel/sidewinder/sheet.cpp #1164461:1164462
@@ -87,6 +87,7 @@
 
     QList<VerticalPageBreak> verticalPageBreaks;
     QList<HorizontalPageBreak> horizontalPageBreaks;
+    QList<MSO::OfficeArtSpgrContainerFileBlock> sheetDrawObjects;
 };
 
 }
@@ -575,6 +576,16 @@
     setDrawObjects(column, row, objects);
 }
 
+QList<MSO::OfficeArtSpgrContainerFileBlock> Sheet::drawObjects() const
+{
+    return d->sheetDrawObjects;
+}
+
+void Sheet::addDrawObject(const MSO::OfficeArtSpgrContainerFileBlock& drawObject)
+{
+    d->sheetDrawObjects.append(drawObject);
+}
+
 #ifdef SWINDER_XLS2RAW
 void Sheet::dumpStats()
 {
--- trunk/koffice/filters/kspread/excel/sidewinder/sheet.h #1164461:1164462
@@ -176,6 +176,9 @@
     void addHorizontalPageBreak(const HorizontalPageBreak& pageBreak);
     QList<HorizontalPageBreak> horizontalPageBreaks();
 
+    QList<MSO::OfficeArtSpgrContainerFileBlock> drawObjects() const;
+    void addDrawObject(const MSO::OfficeArtSpgrContainerFileBlock& drawObject);
+
 #ifdef SWINDER_XLS2RAW
     void dumpStats();
 #endif
--- trunk/koffice/filters/kspread/excel/sidewinder/worksheetsubstreamhandler.cpp \
#1164461:1164462 @@ -812,6 +812,7 @@
                 } else {
                     // TODO
                     qDebug() << "unsupported not cell-anchored object";
+                    d->sheet->addDrawObject(fb);
                 }
             }
         }


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

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