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

List:       kde-commits
Subject:    koffice/filters/kspread/excel/import
From:       Marijn Kruisselbrink <m.kruisselbrink () student ! tue ! nl>
Date:       2010-09-08 8:05:20
Message-ID: 20100908080520.B80C3AC896 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1172922 by mkruisselbrink:

make it possible to compile the filter in such a way that it doesn't depend on the \
kspread kpart being around (and being able to be found). Just having libkspreadodf \
installed is enough now

 M  +15 -1     ExcelImport.cpp  


--- trunk/koffice/filters/kspread/excel/import/ExcelImport.cpp #1172921:1172922
@@ -71,6 +71,9 @@
 #include "ODrawClient.h"
 #include "ImportUtils.h"
 
+// enable this definition to make the filter output to an ods file instead of using \
m_chain.outputDocument() to write the spreadsheet to +// #define OUTPUT_AS_ODS_FILE
+
 typedef KGenericFactory<ExcelImport> ExcelImportFactory;
 K_EXPORT_COMPONENT_FACTORY(libexcelimporttodoc, \
ExcelImportFactory("kofficefilters"))  
@@ -126,7 +129,7 @@
 {
 public:
     QString inputFile;
-    KSpread::Doc* outputDoc;
+    KSpread::DocBase* outputDoc;
 
     Workbook *workbook;
 
@@ -195,6 +198,7 @@
 
     d->inputFile = m_chain->inputFile();
 
+#ifndef OUTPUT_AS_ODS_FILE
     KoDocument* document = m_chain->outputDocument();
     if (!document)
         return KoFilter::StupidError;
@@ -204,6 +208,9 @@
         kWarning() << "document isn't a KSpread::Doc but a " << \
document->metaObject()->className();  return KoFilter::WrongFormat;
     }
+#else
+    d->outputDoc = new KSpread::DocBase();
+#endif
 
     emit sigProgress(0);
     
@@ -303,6 +310,12 @@
 
     delete store;
 
+#ifdef OUTPUT_AS_ODS_FILE
+    d->outputDoc->setOutputMimeType(to);
+    d->outputDoc->saveNativeFormat(m_chain->outputFile());
+    delete d->outputDoc;
+#endif
+
     delete d->workbook;
     delete d->shapeStyles;
     delete d->dataStyles;
@@ -310,6 +323,7 @@
     d->outputDoc = 0;
     d->shapesXml = 0;
 
+
     emit sigProgress(100);
     return KoFilter::OK;
 }


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

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