From 807782cd52d5751bfb98f6e5cb42add2bc679c0c Mon Sep 17 00:00:00 2001 From: alonso Date: Wed, 28 May 2014 15:55:39 +0200 Subject: [PATCH 02/18] enable new handlers Change-Id: I1c07a44e7d318478bcb2561d29ea53a9475e4b1f (cherry picked from commit 6cae6d682cfdec0104f68552def2d1b5719c8fbe) --- .../source/writer/MSWorksImportFilter.cxx | 12 +++++ .../source/writer/MSWorksImportFilter.hxx | 1 + writerperfect/source/writer/MWAWImportFilter.cxx | 52 +++++++++++++++++----- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx index 7567294..2d253fb 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.cxx +++ b/writerperfect/source/writer/MSWorksImportFilter.cxx @@ -24,6 +24,13 @@ using com::sun::star::uno::Exception; using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; +static bool handleEmbeddedWKSObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return libwps::WPSDocument::parse(const_cast(data.getDataStream()), &exporter)==libwps::WPS_OK; +} + bool MSWorksImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &, librevenge::RVNGTextInterface &rGenerator ) { return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator); @@ -43,6 +50,11 @@ bool MSWorksImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, O return false; } +void MSWorksImportFilter::doRegisterHandlers( OdtGenerator &rGenerator ) +{ + rGenerator.registerEmbeddedObjectHandler("image/wks-ods", &handleEmbeddedWKSObject); +} + OUString MSWorksImportFilter_getImplementationName () throw (RuntimeException) { diff --git a/writerperfect/source/writer/MSWorksImportFilter.hxx b/writerperfect/source/writer/MSWorksImportFilter.hxx index b5ddfe4..9bddf08 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.hxx +++ b/writerperfect/source/writer/MSWorksImportFilter.hxx @@ -35,6 +35,7 @@ public: private: virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &rFilterName, librevenge::RVNGTextInterface &rGenerator ) SAL_OVERRIDE; + virtual void doRegisterHandlers( OdtGenerator &rGenerator ) SAL_OVERRIDE; }; OUString MSWorksImportFilter_getImplementationName() diff --git a/writerperfect/source/writer/MWAWImportFilter.cxx b/writerperfect/source/writer/MWAWImportFilter.cxx index ad656c9..d55a645 100644 --- a/writerperfect/source/writer/MWAWImportFilter.cxx +++ b/writerperfect/source/writer/MWAWImportFilter.cxx @@ -24,13 +24,20 @@ using com::sun::star::uno::Exception; using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; -static bool handleEmbeddedMWAWObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +static bool handleEmbeddedMWAWGraphicObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) { OdgGenerator exporter; exporter.addDocumentHandler(pHandler, streamType); return MWAWDocument::decodeGraphic(data, &exporter); } +static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return MWAWDocument::decodeSpreadsheet(data, &exporter); +} + bool MWAWImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &, librevenge::RVNGTextInterface &rGenerator ) { return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator); @@ -65,12 +72,12 @@ bool MWAWImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUSt case MWAWDocument::MWAW_T_EDOC: rTypeName = "writer_eDoc_Document"; break; - case MWAWDocument::MWAW_T_GREATWORKS: - rTypeName = "writer_Great_Works"; - break; case MWAWDocument::MWAW_T_FULLWRITE: rTypeName = "writer_FullWrite_Professional"; break; + case MWAWDocument::MWAW_T_GREATWORKS: + rTypeName = "writer_Great_Works"; + break; case MWAWDocument::MWAW_T_HANMACWORDJ: rTypeName = "writer_HanMac_Word_J"; break; @@ -83,24 +90,24 @@ bool MWAWImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUSt case MWAWDocument::MWAW_T_MACDOC: rTypeName = "writer_MacDoc"; break; - case MWAWDocument::MWAW_T_MARINERWRITE: - rTypeName = "writer_Mariner_Write"; - break; - case MWAWDocument::MWAW_T_MINDWRITE: - rTypeName = "writer_MindWrite"; - break; case MWAWDocument::MWAW_T_MACWRITE: rTypeName = "writer_MacWrite"; break; case MWAWDocument::MWAW_T_MACWRITEPRO: rTypeName = "writer_MacWritePro"; break; + case MWAWDocument::MWAW_T_MARINERWRITE: + rTypeName = "writer_Mariner_Write"; + break; case MWAWDocument::MWAW_T_MICROSOFTWORD: rTypeName = "writer_Mac_Word"; break; case MWAWDocument::MWAW_T_MICROSOFTWORKS: rTypeName = "writer_Mac_Works"; break; + case MWAWDocument::MWAW_T_MINDWRITE: + rTypeName = "writer_MindWrite"; + break; case MWAWDocument::MWAW_T_MORE: rTypeName = "writer_Mac_More"; break; @@ -123,13 +130,35 @@ bool MWAWImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUSt rTypeName = "writer_ZWrite"; break; + case MWAWDocument::MWAW_T_ADOBEILLUSTRATOR: + case MWAWDocument::MWAW_T_CLARISRESOLVE: + case MWAWDocument::MWAW_T_DBASE: + case MWAWDocument::MWAW_T_FAMILYTREEMAKER: + case MWAWDocument::MWAW_T_FILEMAKER: + case MWAWDocument::MWAW_T_FOXBASE: + case MWAWDocument::MWAW_T_FULLIMPACT: + case MWAWDocument::MWAW_T_FULLPAINT: case MWAWDocument::MWAW_T_FRAMEMAKER: + case MWAWDocument::MWAW_T_INFOGENIE: + case MWAWDocument::MWAW_T_KALEIDAGRAPH: + case MWAWDocument::MWAW_T_MACDRAFT: case MWAWDocument::MWAW_T_MACDRAW: + case MWAWDocument::MWAW_T_MACDRAWPRO: case MWAWDocument::MWAW_T_MACPAINT: + case MWAWDocument::MWAW_T_MICROSOFTFILE: + case MWAWDocument::MWAW_T_MICROSOFTMULTIPLAN: + case MWAWDocument::MWAW_T_OVERVUE: case MWAWDocument::MWAW_T_PAGEMAKER: + case MWAWDocument::MWAW_T_PIXELPAINT: case MWAWDocument::MWAW_T_READYSETGO: case MWAWDocument::MWAW_T_RAGTIME: + case MWAWDocument::MWAW_T_SUPERPAINT: + case MWAWDocument::MWAW_T_SYMPOSIUM: + case MWAWDocument::MWAW_T_TRAPEZE: + case MWAWDocument::MWAW_T_WINGZ: case MWAWDocument::MWAW_T_XPRESS: + case MWAWDocument::MWAW_T_4DIMENSION: + case MWAWDocument::MWAW_T_RESERVED1: case MWAWDocument::MWAW_T_RESERVED2: case MWAWDocument::MWAW_T_RESERVED3: @@ -151,7 +180,8 @@ bool MWAWImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUSt void MWAWImportFilter::doRegisterHandlers( OdtGenerator &rGenerator ) { - rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWObject); + rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject); + rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods", &handleEmbeddedMWAWSpreadsheetObject); } OUString MWAWImportFilter_getImplementationName () -- 1.9.3