public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-office/karbon/files: karbon-2.3.3-newlibwpd.patch
@ 2012-06-24 11:59 Andreas HAttel (dilfridge)
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas HAttel (dilfridge) @ 2012-06-24 11:59 UTC (permalink / raw
  To: gentoo-commits

dilfridge    12/06/24 11:59:25

  Removed:              karbon-2.3.3-newlibwpd.patch
  Log:
  Remove KOffice 2.3, superceded by Calligra 2.4



^ permalink raw reply	[flat|nested] 2+ messages in thread
* [gentoo-commits] gentoo-x86 commit in app-office/karbon/files: karbon-2.3.3-newlibwpd.patch
@ 2012-02-07 19:46 Andreas HAttel (dilfridge)
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas HAttel (dilfridge) @ 2012-02-07 19:46 UTC (permalink / raw
  To: gentoo-commits

dilfridge    12/02/07 19:46:21

  Added:                karbon-2.3.3-newlibwpd.patch
  Log:
  Add patch from Debian for newer libwpg support, bug 401463
  
  (Portage version: 2.1.10.44/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  app-office/karbon/files/karbon-2.3.3-newlibwpd.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-office/karbon/files/karbon-2.3.3-newlibwpd.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-office/karbon/files/karbon-2.3.3-newlibwpd.patch?rev=1.1&content-type=text/plain

Index: karbon-2.3.3-newlibwpd.patch
===================================================================
Description: porting to pwg & conversion as SVG output
 Reduced version of Calligra's commit 9cda7aed2ea103750172e61f5c800a474913fa59:
    make wpg import compile again, simplified code by using high level libwpg function to convert to svg,
    this makes us less dependent on libwpg API changes, code works with old an new libwpg versions
Author: Jan Hambrecht <jaham@gmx.net>
Author: Pino Toscano <pino@kde.org>
Last-Update: 2011-02-06
Applied-Upstream: Calligra 2.4

--- a/filters/karbon/wpg/import/CMakeLists.txt
+++ b/filters/karbon/wpg/import/CMakeLists.txt
@@ -4,13 +4,11 @@
 
 set(wpgimport_PART_SRCS 
 WPGImport.cpp 
-OdgExporter.cxx
-FileOutputHandler.cxx
-GraphicsElement.cxx)
+)
 
 kde4_add_plugin(wpgimport ${wpgimport_PART_SRCS})
 
-target_link_libraries(wpgimport komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES})
+target_link_libraries(wpgimport komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES} ${WPD_LIBRARIES})
 
 install(TARGETS wpgimport DESTINATION ${PLUGIN_INSTALL_DIR})
 install(FILES karbon_wpg_import.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- a/filters/karbon/wpg/import/WPGImport.cpp
+++ b/filters/karbon/wpg/import/WPGImport.cpp
@@ -23,6 +23,7 @@
 #include <QBuffer>
 #include <QByteArray>
 #include <QString>
+#include <QFile>
 
 #include <kdebug.h>
 #include <KoFilterChain.h>
@@ -37,11 +38,9 @@
 #include <libwpg/WPGStreamImplementation.h>
 #else
 #include <libwpd-stream/libwpd-stream.h>
+#include <libwpd/libwpd.h>
 #endif
 
-#include "FileOutputHandler.hxx"
-#include "OdgExporter.hxx"
-
 #include <iostream>
 
 K_PLUGIN_FACTORY(WPGImportFactory, registerPlugin<WPGImport>();)
@@ -56,35 +55,12 @@
 {
 }
 
-static QByteArray createManifest()
-{
-    KoXmlWriter* manifestWriter;
-    QByteArray manifestData;
-    QBuffer manifestBuffer(&manifestData);
-
-    manifestBuffer.open(QIODevice::WriteOnly);
-    manifestWriter = new KoXmlWriter(&manifestBuffer);
-
-    manifestWriter->startDocument("manifest:manifest");
-    manifestWriter->startElement("manifest:manifest");
-    manifestWriter->addAttribute("xmlns:manifest", "urn:oasis:names:tc:openoffice:xmlns:manifest:1.0");
-    manifestWriter->addManifestEntry("/", "application/vnd.oasis.opendocument.graphics");
-    //manifestWriter->addManifestEntry( "styles.xml", "text/xml" );
-    manifestWriter->addManifestEntry("content.xml", "text/xml");
-    manifestWriter->endElement();
-    manifestWriter->endDocument();
-    delete manifestWriter;
-
-    return manifestData;
-}
-
-
 KoFilter::ConversionStatus WPGImport::convert(const QByteArray& from, const QByteArray& to)
 {
     if (from != "application/x-wpg")
         return KoFilter::NotImplemented;
 
-    if (to != "application/vnd.oasis.opendocument.graphics")
+    if (to != "image/svg+xml")
         return KoFilter::NotImplemented;
 
 #if LIBWPG_VERSION_MINOR<2
@@ -96,6 +72,7 @@
             input = olestream;
         }
     }
+    libwpg::WPGString output;
 #else
     WPXInputStream* input = new WPXFileStream(m_chain->inputFile().toLocal8Bit());
     if (input->isOLEStream()) {
@@ -105,6 +82,7 @@
             input = olestream;
         }
      }
+     ::WPXString output;
 #endif
 
     if (!libwpg::WPGraphics::isSupported(input)) {
@@ -113,51 +91,21 @@
         return KoFilter::NotImplemented;
     }
 
-    // do the conversion
-    std::ostringstream tmpStringStream;
-    FileOutputHandler tmpHandler(tmpStringStream);
-    OdgExporter exporter(&tmpHandler);
-    libwpg::WPGraphics::parse(input, &exporter);
-    delete input;
-
-
-    // create output store
-    KoStore* storeout;
-    storeout = KoStore::createStore(m_chain->outputFile(), KoStore::Write,
-                                    "application/vnd.oasis.opendocument.graphics", KoStore::Zip);
-
-    if (!storeout) {
-        kWarning() << "Couldn't open the requested file.";
-        return KoFilter::FileNotFound;
-    }
-
-#if 0
-    if (!storeout->open("styles.xml")) {
-        kWarning() << "Couldn't open the file 'styles.xml'.";
-        return KoFilter::CreationError;
-    }
-    //storeout->write( createStyles() );
-    storeout->close();
-#endif
-
-    if (!storeout->open("content.xml")) {
-        kWarning() << "Couldn't open the file 'content.xml'.";
-        return KoFilter::CreationError;
-    }
-    storeout->write(tmpStringStream.str().c_str());
-    storeout->close();
-
-    // store document manifest
-    storeout->enterDirectory("META-INF");
-    if (!storeout->open("manifest.xml")) {
-        kWarning() << "Couldn't open the file 'META-INF/manifest.xml'.";
-        return KoFilter::CreationError;
+    if (!libwpg::WPGraphics::generateSVG(input, output)) {
+        kWarning() << "ERROR: SVG Generation failed!";
+        delete input;
+        return KoFilter::ParsingError;
     }
-    storeout->write(createManifest());
-    storeout->close();
-
-    // we are done!
-    delete storeout;
 
+    delete input;
+ 
+    QFile outputFile(m_chain->outputFile());
+    if(!outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+        kWarning() << "ERROR: Could not open output file" << m_chain->outputFile();
+        return KoFilter::InternalError;
+    }
+    outputFile.write(output.cstr());
+    outputFile.close();
+ 
     return KoFilter::OK;
 }
--- a/filters/karbon/wpg/import/karbon_wpg_import.desktop
+++ b/filters/karbon/wpg/import/karbon_wpg_import.desktop
@@ -42,7 +42,7 @@
 Name[x-test]=xxKarbon WPG Import Filterxx
 Name[zh_CN]=Karbon WPG 导入过滤器
 Name[zh_TW]=Karbon WPG 匯入過濾程式
-X-KDE-Export=application/vnd.oasis.opendocument.graphics
+X-KDE-Export=image/svg+xml
 X-KDE-Import=application/x-wpg
 X-KDE-Weight=1
 X-KDE-Library=wpgimport






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-24 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-24 11:59 [gentoo-commits] gentoo-x86 commit in app-office/karbon/files: karbon-2.3.3-newlibwpd.patch Andreas HAttel (dilfridge)
  -- strict thread matches above, loose matches on Subject: below --
2012-02-07 19:46 Andreas HAttel (dilfridge)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox