From 1faae1f37521df7734462443936e1469820fd489 Mon Sep 17 00:00:00 2001 From: osnola Date: Wed, 10 Aug 2016 12:43:56 +0200 Subject: integrate libstaroffice Change-Id: I85913f1bd1af5d102573040588cca9d8ddeebb5d --- writerperfect/Library_wpftcalc.mk | 2 + writerperfect/Library_wpftdraw.mk | 2 + writerperfect/Library_wpftwriter.mk | 2 + .../source/calc/StarOfficeCalcImportFilter.cxx | 96 +++++++++++++++++ .../source/calc/StarOfficeCalcImportFilter.hxx | 45 ++++++++ writerperfect/source/calc/wpftcalc.component | 5 + writerperfect/source/common/WPXSvInputStream.cxx | 4 +- .../source/draw/StarOfficeDrawImportFilter.cxx | 98 +++++++++++++++++ .../source/draw/StarOfficeDrawImportFilter.hxx | 45 ++++++++ writerperfect/source/draw/wpftdraw.component | 5 + .../source/writer/StarOfficeWriterImportFilter.cxx | 116 +++++++++++++++++++++ .../source/writer/StarOfficeWriterImportFilter.hxx | 45 ++++++++ writerperfect/source/writer/wpftwriter.component | 5 + 13 files changed, 468 insertions(+), 2 deletions(-) create mode 100644 writerperfect/source/calc/StarOfficeCalcImportFilter.cxx create mode 100644 writerperfect/source/calc/StarOfficeCalcImportFilter.hxx create mode 100644 writerperfect/source/draw/StarOfficeDrawImportFilter.cxx create mode 100644 writerperfect/source/draw/StarOfficeDrawImportFilter.hxx create mode 100644 writerperfect/source/writer/StarOfficeWriterImportFilter.cxx create mode 100644 writerperfect/source/writer/StarOfficeWriterImportFilter.hxx (limited to 'writerperfect') diff --git a/writerperfect/Library_wpftcalc.mk b/writerperfect/Library_wpftcalc.mk index 1672e63f2c33..3d378cb82dd0 100644 --- a/writerperfect/Library_wpftcalc.mk +++ b/writerperfect/Library_wpftcalc.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_externals,wpftcalc,\ odfgen \ revenge \ mwaw \ + staroffice \ wps \ zlib \ lcms2 \ @@ -61,6 +62,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftcalc,\ writerperfect/source/calc/MSWorksCalcImportFilter \ writerperfect/source/calc/MWAWCalcImportFilter \ writerperfect/source/calc/NumbersImportFilter \ + writerperfect/source/calc/StarOfficeCalcImportFilter \ )) # vim: set noet sw=4 ts=4: diff --git a/writerperfect/Library_wpftdraw.mk b/writerperfect/Library_wpftdraw.mk index cdec02962383..23d294518466 100644 --- a/writerperfect/Library_wpftdraw.mk +++ b/writerperfect/Library_wpftdraw.mk @@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_externals,wpftdraw,\ odfgen \ pagemaker \ revenge \ + staroffice \ visio \ wpg \ wpd \ @@ -70,6 +71,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftdraw,\ writerperfect/source/draw/MSPUBImportFilter \ writerperfect/source/draw/MWAWDrawImportFilter \ writerperfect/source/draw/PageMakerImportFilter \ + writerperfect/source/draw/StarOfficeDrawImportFilter \ writerperfect/source/draw/VisioImportFilter \ writerperfect/source/draw/WPGImportFilter \ writerperfect/source/draw/ZMFImportFilter \ diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 9ec43c4491c9..b260dc4fe419 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -57,6 +57,7 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ mwaw \ odfgen \ revenge \ + staroffice \ wpd \ wpg \ wps \ @@ -69,6 +70,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/MSWorksImportFilter \ writerperfect/source/writer/MWAWImportFilter \ writerperfect/source/writer/PagesImportFilter \ + writerperfect/source/writer/StarOfficeWriterImportFilter \ writerperfect/source/writer/WordPerfectImportFilter \ )) diff --git a/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx b/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx new file mode 100644 index 000000000000..5accde1e1cd9 --- /dev/null +++ b/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include +#include + +#include "StarOfficeCalcImportFilter.hxx" + +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XInterface; +using com::sun::star::uno::RuntimeException; +using com::sun::star::uno::XComponentContext; + +static bool handleEmbeddedSTOFFGraphicObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeGraphic(data, &exporter); +} + +static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeSpreadsheet(data, &exporter); +} + +bool StarOfficeCalcImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &) +{ + return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator); +} + +bool StarOfficeCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) +{ + rTypeName.clear(); + STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN; + const STOFFDocument::Confidence confidence = STOFFDocument::isFileFormatSupported(&rInput, docKind); + if (confidence == STOFFDocument::STOFF_C_EXCELLENT || confidence == STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION) + { + switch (docKind) + { + case STOFFDocument::STOFF_K_DATABASE: + case STOFFDocument::STOFF_K_SPREADSHEET: + rTypeName = "StarOffice_Spreadsheet"; + break; + default: + break; + } + } + + return !rTypeName.isEmpty(); +} + +void StarOfficeCalcImportFilter::doRegisterHandlers(OdsGenerator &rGenerator) +{ + rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFGraphicObject); + rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", &handleEmbeddedSTOFFSpreadsheetObject); +} + +// XServiceInfo +OUString SAL_CALL StarOfficeCalcImportFilter::getImplementationName() +throw (RuntimeException, std::exception) +{ + return OUString("org.libreoffice.comp.Calc.StarOfficeCalcImportFilter"); +} + +sal_Bool SAL_CALL StarOfficeCalcImportFilter::supportsService(const OUString &rServiceName) +throw (RuntimeException, std::exception) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > SAL_CALL StarOfficeCalcImportFilter::getSupportedServiceNames() +throw (RuntimeException, std::exception) +{ + return Sequence< OUString >{"com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection"}; +} + +extern "C" +SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL +org_libreoffice_comp_Calc_StarOfficeCalcImportFilter_get_implementation( + css::uno::XComponentContext *const context, + const css::uno::Sequence &) +{ + return cppu::acquire(new StarOfficeCalcImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx b/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx new file mode 100644 index 000000000000..bcf457fd5bae --- /dev/null +++ b/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_CALC_STAROFFICECALCIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_CALC_STAROFFICECALCIMPORTFILTER_HXX + +#include +#include + +#include "ImportFilter.hxx" + +#include "DocumentHandlerForOds.hxx" + +/* This component will be instantiated for both import or export. Whether it calls + * setSourceDocument or setTargetDocument determines which Impl function the filter + * member calls */ +class StarOfficeCalcImportFilter : public writerperfect::ImportFilter +{ +public: + explicit StarOfficeCalcImportFilter(const css::uno::Reference< css::uno::XComponentContext > &rxContext) + : writerperfect::ImportFilter(rxContext) {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) override; + virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) + throw (css::uno::RuntimeException, std::exception) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override; + virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &) override; + virtual void doRegisterHandlers(OdsGenerator &rGenerator) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/calc/wpftcalc.component b/writerperfect/source/calc/wpftcalc.component index 117ec1f80288..404d09b6ca6a 100644 --- a/writerperfect/source/calc/wpftcalc.component +++ b/writerperfect/source/calc/wpftcalc.component @@ -24,4 +24,9 @@ + + + + diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index d52c696e0f23..c5e344850475 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -44,8 +44,8 @@ class PositionHolder public: explicit PositionHolder(const Reference &rxSeekable); ~PositionHolder(); - PositionHolder(const PositionHolder&) = delete; - PositionHolder& operator=(const PositionHolder&) = delete; + PositionHolder(const PositionHolder &) = delete; + PositionHolder &operator=(const PositionHolder &) = delete; private: const Reference mxSeekable; diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx new file mode 100644 index 000000000000..57dfb7f070b2 --- /dev/null +++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include +#include + +#include "StarOfficeDrawImportFilter.hxx" + +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XInterface; +using com::sun::star::uno::RuntimeException; +using com::sun::star::uno::XComponentContext; + +static bool handleEmbeddedSTOFFGraphicObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeGraphic(data, &exporter); +} + +static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFGraphicObject); + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeSpreadsheet(data, &exporter); +} + +bool StarOfficeDrawImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &) +{ + return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator); +} + +bool StarOfficeDrawImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) +{ + rTypeName.clear(); + + STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN; + const STOFFDocument::Confidence confidence = STOFFDocument::isFileFormatSupported(&rInput, docKind); + + if (confidence == STOFFDocument::STOFF_C_EXCELLENT || confidence == STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION) + { + switch (docKind) + { + case STOFFDocument::STOFF_K_DRAW: + rTypeName = "StarOffice_Drawing"; + break; + default: + break; + } + } + + return !rTypeName.isEmpty(); +} + +void StarOfficeDrawImportFilter::doRegisterHandlers(OdgGenerator &rGenerator) +{ + rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFGraphicObject); + rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", &handleEmbeddedSTOFFSpreadsheetObject); +} + +// XServiceInfo +OUString SAL_CALL StarOfficeDrawImportFilter::getImplementationName() +throw (RuntimeException, std::exception) +{ + return OUString("org.libreoffice.comp.Draw.StarOfficeDrawImportFilter"); +} + +sal_Bool SAL_CALL StarOfficeDrawImportFilter::supportsService(const OUString &rServiceName) +throw (RuntimeException, std::exception) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > SAL_CALL StarOfficeDrawImportFilter::getSupportedServiceNames() +throw (RuntimeException, std::exception) +{ + return Sequence< OUString >{"com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection"}; +} + +extern "C" +SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL +org_libreoffice_comp_Draw_StarOfficeDrawImportFilter_get_implementation( + css::uno::XComponentContext *const context, + const css::uno::Sequence &) +{ + return cppu::acquire(new StarOfficeDrawImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx new file mode 100644 index 000000000000..2fd9b7bb24e8 --- /dev/null +++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_STAROFFICEDRAWIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_STAROFFICEDRAWIMPORTFILTER_HXX + +#include +#include + +#include "ImportFilter.hxx" + +#include "DocumentHandlerForOdg.hxx" + +/* This component will be instantiated for both import or export. Whether it calls + * setSourceDocument or setTargetDocument determines which Impl function the filter + * member calls */ +class StarOfficeDrawImportFilter : public writerperfect::ImportFilter +{ +public: + explicit StarOfficeDrawImportFilter(const css::uno::Reference< css::uno::XComponentContext > &rxContext) + : writerperfect::ImportFilter(rxContext) {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) override; + virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) + throw (css::uno::RuntimeException, std::exception) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override; + virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &) override; + virtual void doRegisterHandlers(OdgGenerator &rGenerator) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/wpftdraw.component b/writerperfect/source/draw/wpftdraw.component index c315fa9f4dd3..72330b24de70 100644 --- a/writerperfect/source/draw/wpftdraw.component +++ b/writerperfect/source/draw/wpftdraw.component @@ -34,6 +34,11 @@ + + + + diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx new file mode 100644 index 000000000000..e0580dc4d05c --- /dev/null +++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +#include + +#include "StarOfficeWriterImportFilter.hxx" + +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XInterface; +using com::sun::star::uno::RuntimeException; +using com::sun::star::uno::XComponentContext; + +static bool handleEmbeddedSTOFFWriterGraphicObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeGraphic(data, &exporter); +} + +static bool handleEmbeddedSTOFFWriterSpreadsheetObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFWriterGraphicObject); + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeSpreadsheet(data, &exporter); +} + +bool StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &) +{ + STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN; + const STOFFDocument::Confidence confidence = STOFFDocument::isFileFormatSupported(&rInput, docKind); + OString aUtf8Passwd; + if (confidence==STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION) { + // try to ask for a password + try { + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(nullptr); + aPasswdDlg->SetMinLen(0); + if (!aPasswdDlg->Execute()) + return false; + OUString aPasswd = aPasswdDlg->GetPassword(); + aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8); + } + catch (...) { + // ok, we will probably guess it + } + } + return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator, !aUtf8Passwd.isEmpty() ? aUtf8Passwd.getStr() : nullptr); +} + +bool StarOfficeWriterImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) +{ + rTypeName.clear(); + + STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN; + const STOFFDocument::Confidence confidence = STOFFDocument::isFileFormatSupported(&rInput, docKind); + + if (confidence == STOFFDocument::STOFF_C_EXCELLENT|| confidence == STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION) + { + switch (docKind) + { + case STOFFDocument::STOFF_K_TEXT: + rTypeName = "StarOffice_Writer"; + break; + default: + break; + } + } + + return !rTypeName.isEmpty(); +} + +void StarOfficeWriterImportFilter::doRegisterHandlers(OdtGenerator &rGenerator) +{ + rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFWriterGraphicObject); + rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", &handleEmbeddedSTOFFWriterSpreadsheetObject); +} + +// XServiceInfo +OUString SAL_CALL StarOfficeWriterImportFilter::getImplementationName() +throw (RuntimeException, std::exception) +{ + return OUString("org.libreoffice.comp.Writer.StarOfficeWriterImportFilter"); +} + +sal_Bool SAL_CALL StarOfficeWriterImportFilter::supportsService(const OUString &rServiceName) +throw (RuntimeException, std::exception) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > SAL_CALL StarOfficeWriterImportFilter::getSupportedServiceNames() +throw (RuntimeException, std::exception) +{ + return Sequence< OUString >{"com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection"}; +} + +extern "C" +SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL +org_libreoffice_comp_Writer_StarOfficeWriterImportFilter_get_implementation( + css::uno::XComponentContext *const context, + const css::uno::Sequence &) +{ + return cppu::acquire(new StarOfficeWriterImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx new file mode 100644 index 000000000000..65805e049aee --- /dev/null +++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_STAROFFICEWRITERIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_STAROFFICEWRITERIMPORTFILTER_HXX + +#include +#include + +#include "ImportFilter.hxx" + +#include "DocumentHandlerForOdt.hxx" + +/* This component will be instantiated for both import or export. Whether it calls + * setSourceDocument or setTargetDocument determines which Impl function the filter + * member calls */ +class StarOfficeWriterImportFilter : public writerperfect::ImportFilter +{ +public: + explicit StarOfficeWriterImportFilter(const css::uno::Reference< css::uno::XComponentContext > &rxContext) + : writerperfect::ImportFilter(rxContext) {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) override; + virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) + throw (css::uno::RuntimeException, std::exception) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override; + virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &) override; + virtual void doRegisterHandlers(OdtGenerator &rGenerator) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/wpftwriter.component b/writerperfect/source/writer/wpftwriter.component index 4c5f37fa4ceb..ace6b687363c 100644 --- a/writerperfect/source/writer/wpftwriter.component +++ b/writerperfect/source/writer/wpftwriter.component @@ -48,4 +48,9 @@ + + + + -- cgit