From 1edc1eab10c7666afcfef01f86e00f1e773a6048 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sat, 24 May 2014 14:21:21 +0200 Subject: rebase all import libs Change-Id: I9e1fc613816c943f4fb1033185e34e3acf317f1d (cherry picked from commit 48c9d7ac7ccdad27067efe0d168e96ff48372631) --- writerperfect/CppunitTest_writerperfect_stream.mk | 2 +- writerperfect/Library_wpftdraw.mk | 2 +- writerperfect/Library_wpftimpress.mk | 3 +- writerperfect/Library_wpftwriter.mk | 6 +- writerperfect/Library_writerperfect.mk | 4 +- writerperfect/qa/unit/WPXSvStreamTest.cxx | 135 +++++++++++---------- writerperfect/qa/unit/WpftImpressFilterTest.cxx | 2 +- writerperfect/qa/unit/WpftWriterFilterTest.cxx | 4 +- writerperfect/source/common/DirectoryStream.cxx | 34 +++++- writerperfect/source/common/DocumentHandler.cxx | 6 +- writerperfect/source/common/WPXSvInputStream.cxx | 43 +++---- writerperfect/source/draw/CDRImportFilter.cxx | 4 +- writerperfect/source/draw/CDRImportFilter.hxx | 4 +- writerperfect/source/draw/CMXImportFilter.cxx | 4 +- writerperfect/source/draw/CMXImportFilter.hxx | 4 +- writerperfect/source/draw/FreehandImportFilter.cxx | 4 +- writerperfect/source/draw/FreehandImportFilter.hxx | 4 +- writerperfect/source/draw/ImportFilterBase.cxx | 3 +- writerperfect/source/draw/ImportFilterBase.hxx | 8 +- writerperfect/source/draw/MSPUBImportFilter.cxx | 4 +- writerperfect/source/draw/MSPUBImportFilter.hxx | 4 +- writerperfect/source/draw/VisioImportFilter.cxx | 4 +- writerperfect/source/draw/VisioImportFilter.hxx | 4 +- writerperfect/source/draw/WPGImportFilter.cxx | 6 +- writerperfect/source/draw/WPGImportFilter.hxx | 4 +- .../source/impress/KeynoteImportFilter.cxx | 18 +-- .../source/writer/AbiWordImportFilter.cxx | 4 +- .../source/writer/AbiWordImportFilter.hxx | 4 +- writerperfect/source/writer/EBookImportFilter.cxx | 58 ++++++--- writerperfect/source/writer/EBookImportFilter.hxx | 4 +- writerperfect/source/writer/ImportFilterBase.cxx | 3 +- writerperfect/source/writer/ImportFilterBase.hxx | 8 +- .../source/writer/MSWorksImportFilter.cxx | 11 +- .../source/writer/MSWorksImportFilter.hxx | 4 +- writerperfect/source/writer/MWAWImportFilter.cxx | 9 +- writerperfect/source/writer/MWAWImportFilter.hxx | 4 +- .../source/writer/WordPerfectImportFilter.cxx | 49 ++++---- 37 files changed, 261 insertions(+), 217 deletions(-) (limited to 'writerperfect') diff --git a/writerperfect/CppunitTest_writerperfect_stream.mk b/writerperfect/CppunitTest_writerperfect_stream.mk index 1d8ae928ccbe..8416008d00b3 100644 --- a/writerperfect/CppunitTest_writerperfect_stream.mk +++ b/writerperfect/CppunitTest_writerperfect_stream.mk @@ -23,7 +23,7 @@ $(eval $(call gb_CppunitTest_use_ure,writerperfect_stream)) $(eval $(call gb_CppunitTest_use_externals,writerperfect_stream,\ boost_headers \ - wpd \ + revenge \ )) $(eval $(call gb_CppunitTest_use_libraries,writerperfect_stream,\ diff --git a/writerperfect/Library_wpftdraw.mk b/writerperfect/Library_wpftdraw.mk index 2f730eafddde..807afc984bec 100644 --- a/writerperfect/Library_wpftdraw.mk +++ b/writerperfect/Library_wpftdraw.mk @@ -38,10 +38,10 @@ $(eval $(call gb_Library_use_libraries,wpftdraw,\ $(eval $(call gb_Library_use_externals,wpftdraw,\ cdr \ - etonyek \ freehand \ mspub \ odfgen \ + revenge \ visio \ wpg \ wpd \ diff --git a/writerperfect/Library_wpftimpress.mk b/writerperfect/Library_wpftimpress.mk index db7218c2740c..39ef718d1e74 100644 --- a/writerperfect/Library_wpftimpress.mk +++ b/writerperfect/Library_wpftimpress.mk @@ -41,8 +41,7 @@ $(eval $(call gb_Library_use_externals,wpftimpress,\ boost_headers \ etonyek \ odfgen \ - wpd \ - wpg \ + revenge \ zlib \ libxml2 \ )) diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index c8a16313b0e9..db6afdf49d46 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -43,15 +43,15 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\ abw \ boost_headers \ ebook \ - etonyek \ icui18n \ icuuc \ libxml2 \ mwaw \ odfgen \ - wps \ - wpg \ + revenge \ wpd \ + wpg \ + wps \ zlib \ )) diff --git a/writerperfect/Library_writerperfect.mk b/writerperfect/Library_writerperfect.mk index bd8d258e6918..3089b5a0add8 100644 --- a/writerperfect/Library_writerperfect.mk +++ b/writerperfect/Library_writerperfect.mk @@ -25,10 +25,8 @@ $(eval $(call gb_Library_add_defs,writerperfect,\ $(eval $(call gb_Library_use_externals,writerperfect,\ boost_headers \ - etonyek \ odfgen \ - wpd \ - wpg \ + revenge \ )) $(eval $(call gb_Library_use_sdk_api,writerperfect)) diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index 1d28ec814d30..d75f201f1395 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -34,6 +34,11 @@ namespace uno = com::sun::star::uno; using boost::shared_ptr; +using librevenge::RVNGInputStream; +using librevenge::RVNG_SEEK_CUR; +using librevenge::RVNG_SEEK_END; +using librevenge::RVNG_SEEK_SET; + using std::equal; using writerperfect::WPXSvInputStream; @@ -64,21 +69,21 @@ static const char aText[] = "hello world"; static const char aOLEFile[] = "/writerperfect/qa/unit/data/fdo40686-1.doc"; static const char aZipFile[] = "/writerperfect/qa/unit/data/test.odt"; -shared_ptr lcl_createStream() +shared_ptr lcl_createStream() { using comphelper::SequenceInputStream; const css::uno::Sequence aData(reinterpret_cast(aText), sizeof aText); const uno::Reference xInputStream(new SequenceInputStream(aData)); - shared_ptr pInputStream; + shared_ptr pInputStream; if (xInputStream.is()) pInputStream.reset(new WPXSvInputStream(xInputStream)); return pInputStream; } -const shared_ptr lcl_createStreamForURL(const rtl::OUString &rURL) +const shared_ptr lcl_createStreamForURL(const rtl::OUString &rURL) { using uno::Reference; using uno::UNO_QUERY_THROW; @@ -89,13 +94,13 @@ const shared_ptr lcl_createStreamForURL(const rtl::OUString &rUR UNO_QUERY_THROW); const Reference xInputStream(xFileAccess->openFileRead(rURL), UNO_QUERY_THROW); - const shared_ptr pInput(new WPXSvInputStream(xInputStream)); + const shared_ptr pInput(new WPXSvInputStream(xInputStream)); return pInput; } void WPXSvStreamTest::testRead() { - const shared_ptr pInput(lcl_createStream()); + const shared_ptr pInput(lcl_createStream()); const unsigned long nLen = sizeof aText; unsigned long nReadBytes = 0; @@ -107,199 +112,199 @@ void WPXSvStreamTest::testRead() pData = pInput->read(1UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(1UL, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); pText += nReadBytes; pData = pInput->read(2UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(2UL, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); pText += nReadBytes; pData = pInput->read(3UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(3UL, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); pText += nReadBytes; assert(nLen > 6); pData = pInput->read(nLen - 6, nReadBytes); CPPUNIT_ASSERT_EQUAL(nLen - 6, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // reading everything at once - pInput->seek(0, WPX_SEEK_SET); + pInput->seek(0, RVNG_SEEK_SET); pText = pTextOrig; pData = pInput->read(nLen, nReadBytes); CPPUNIT_ASSERT_EQUAL(nLen, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // trying to read too much - pInput->seek(0, WPX_SEEK_SET); + pInput->seek(0, RVNG_SEEK_SET); pText = pTextOrig; pData = pInput->read(nLen + 1, nReadBytes); CPPUNIT_ASSERT_EQUAL(nLen, nReadBytes); CPPUNIT_ASSERT(equal(pText, pText + nReadBytes, pData)); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // trying to read nothing - pInput->seek(0, WPX_SEEK_SET); + pInput->seek(0, RVNG_SEEK_SET); pText = pTextOrig; pData = pInput->read(0UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(0UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); CPPUNIT_ASSERT_EQUAL(pData, static_cast(0)); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); } void WPXSvStreamTest::testSeekSet() { - const shared_ptr pInput(lcl_createStream()); + const shared_ptr pInput(lcl_createStream()); const long nLen = sizeof aText; // check initial state CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); // valid seeks - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(1L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(nLen, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(nLen, RVNG_SEEK_SET)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); // go back to the beginning - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // invalid seeks - CPPUNIT_ASSERT(0 != pInput->seek(-1, WPX_SEEK_SET)); + CPPUNIT_ASSERT(0 != pInput->seek(-1, RVNG_SEEK_SET)); // Okay, this is not defined. But it is what the WPXSvInputStream // does ATM and it is reasonable. CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, WPX_SEEK_SET)); + CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, RVNG_SEEK_SET)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); } void WPXSvStreamTest::testSeekCur() { - const shared_ptr pInput(lcl_createStream()); + const shared_ptr pInput(lcl_createStream()); const long nLen = sizeof aText; // check initial state - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // valid seeks - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_CUR)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(1L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); // go back to the beginning - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // invalid seeks - CPPUNIT_ASSERT(0 != pInput->seek(-1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT(0 != pInput->seek(-1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, WPX_SEEK_CUR)); + CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, RVNG_SEEK_CUR)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); } void WPXSvStreamTest::testSeekEnd() { - const shared_ptr pInput(lcl_createStream()); + const shared_ptr pInput(lcl_createStream()); const long nLen = sizeof aText; // check initial state - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // valid seeks - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_END)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_END)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, WPX_SEEK_END)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, RVNG_SEEK_END)); CPPUNIT_ASSERT((nLen - 1) == pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-nLen, WPX_SEEK_END)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-nLen, RVNG_SEEK_END)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); // go back to the beginning - CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, WPX_SEEK_SET)); + CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_SET)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); // invalid seeks - CPPUNIT_ASSERT(0 != pInput->seek(1, WPX_SEEK_END)); + CPPUNIT_ASSERT(0 != pInput->seek(1, RVNG_SEEK_END)); CPPUNIT_ASSERT(nLen == pInput->tell()); - CPPUNIT_ASSERT(pInput->atEOS()); + CPPUNIT_ASSERT(pInput->isEnd()); - CPPUNIT_ASSERT(0 != pInput->seek(-nLen - 1, WPX_SEEK_END)); + CPPUNIT_ASSERT(0 != pInput->seek(-nLen - 1, RVNG_SEEK_END)); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT(!pInput->atEOS()); + CPPUNIT_ASSERT(!pInput->isEnd()); } void WPXSvStreamTest::testStructured() { // OLE2 { - const shared_ptr pInput(lcl_createStreamForURL(getURLFromSrc(aOLEFile))); + const shared_ptr pInput(lcl_createStreamForURL(getURLFromSrc(aOLEFile))); assert(bool(pInput)); - CPPUNIT_ASSERT(pInput->isOLEStream()); - shared_ptr pSubStream(pInput->getDocumentOLEStream("WordDocument")); + CPPUNIT_ASSERT(pInput->isStructured()); + shared_ptr pSubStream(pInput->getSubStreamByName("WordDocument")); CPPUNIT_ASSERT(bool(pSubStream)); - pSubStream.reset(pInput->getDocumentOLEStream("foo")); + pSubStream.reset(pInput->getSubStreamByName("foo")); CPPUNIT_ASSERT(!pSubStream); } // Zip { - const shared_ptr pInput(lcl_createStreamForURL(getURLFromSrc(aZipFile))); + const shared_ptr pInput(lcl_createStreamForURL(getURLFromSrc(aZipFile))); assert(bool(pInput)); - CPPUNIT_ASSERT(pInput->isOLEStream()); - shared_ptr pSubStream(pInput->getDocumentOLEStream("content.xml")); + CPPUNIT_ASSERT(pInput->isStructured()); + shared_ptr pSubStream(pInput->getSubStreamByName("content.xml")); CPPUNIT_ASSERT(bool(pSubStream)); - pSubStream.reset(pInput->getDocumentOLEStream("foo")); + pSubStream.reset(pInput->getSubStreamByName("foo")); CPPUNIT_ASSERT(!pSubStream); } // not structured { - const shared_ptr pInput(lcl_createStream()); + const shared_ptr pInput(lcl_createStream()); - CPPUNIT_ASSERT(!pInput->isOLEStream()); - CPPUNIT_ASSERT(0 == pInput->getDocumentOLEStream("foo")); + CPPUNIT_ASSERT(!pInput->isStructured()); + CPPUNIT_ASSERT(0 == pInput->getSubStreamByName("foo")); } } diff --git a/writerperfect/qa/unit/WpftImpressFilterTest.cxx b/writerperfect/qa/unit/WpftImpressFilterTest.cxx index 2f349fa8134b..4286f8a8e214 100644 --- a/writerperfect/qa/unit/WpftImpressFilterTest.cxx +++ b/writerperfect/qa/unit/WpftImpressFilterTest.cxx @@ -31,7 +31,7 @@ WpftImpressFilterTest::WpftImpressFilterTest() void WpftImpressFilterTest::test() { - doTest("org.libreoffice.comp.Impress.KeynoteImportFilter", "/writerperfect/qa/unit/data/libetonyek/"); + // doTest("org.libreoffice.comp.Impress.KeynoteImportFilter", "/writerperfect/qa/unit/data/libetonyek/"); } CPPUNIT_TEST_SUITE_REGISTRATION(WpftImpressFilterTest); diff --git a/writerperfect/qa/unit/WpftWriterFilterTest.cxx b/writerperfect/qa/unit/WpftWriterFilterTest.cxx index 284c5f5578a1..2afc4e73aae8 100644 --- a/writerperfect/qa/unit/WpftWriterFilterTest.cxx +++ b/writerperfect/qa/unit/WpftWriterFilterTest.cxx @@ -32,9 +32,9 @@ WpftWriterFilterTest::WpftWriterFilterTest() void WpftWriterFilterTest::test() { doTest("com.sun.star.comp.Writer.AbiWordImportFilter", "/writerperfect/qa/unit/data/libabw/"); - doTest("org.libreoffice.comp.Writer.EBookImportFilter", "/writerperfect/qa/unit/data/libe-book/"); + // doTest("org.libreoffice.comp.Writer.EBookImportFilter", "/writerperfect/qa/unit/data/libe-book/"); doTest("com.sun.star.comp.Writer.MSWorksImportFilter", "/writerperfect/qa/unit/data/libwps/"); - doTest("com.sun.star.comp.Writer.MWAWImportFilter", "/writerperfect/qa/unit/data/libmwaw/"); + // doTest("com.sun.star.comp.Writer.MWAWImportFilter", "/writerperfect/qa/unit/data/libmwaw/"); doTest("com.sun.star.comp.Writer.WordPerfectImportFilter", "/writerperfect/qa/unit/data/libwpd/"); } diff --git a/writerperfect/source/common/DirectoryStream.cxx b/writerperfect/source/common/DirectoryStream.cxx index c12569491940..b720eececaaa 100644 --- a/writerperfect/source/common/DirectoryStream.cxx +++ b/writerperfect/source/common/DirectoryStream.cxx @@ -112,14 +112,32 @@ DirectoryStream::~DirectoryStream() delete m_pImpl; } -bool DirectoryStream::isOLEStream() +bool DirectoryStream::isStructured() { return true; } -WPXInputStream *DirectoryStream::getDocumentOLEStream(const char *const pName) +unsigned DirectoryStream::subStreamCount() { - WPXInputStream *input = 0; + // TODO: implement me + return 0; +} + +const char * DirectoryStream::subStreamName(unsigned /* id */) +{ + // TODO: implement me + return 0; +} + +bool DirectoryStream::existsSubStream(const char * /* name */) +{ + // TODO: implement me + return false; +} + +librevenge::RVNGInputStream *DirectoryStream::getSubStreamByName(const char *const pName) +{ + librevenge::RVNGInputStream *input = 0; ucbhelper::Content aContent(m_pImpl->xContent, uno::Reference(), comphelper::getProcessComponentContext()); const uno::Reference xInputStream(findStream(aContent, rtl::OUString::createFromAscii(pName))); @@ -129,13 +147,19 @@ WPXInputStream *DirectoryStream::getDocumentOLEStream(const char *const pName) return input; } +librevenge::RVNGInputStream *DirectoryStream::getSubStreamById(unsigned /* id */) +{ + // TODO: implement me + return 0; +} + const unsigned char *DirectoryStream::read(unsigned long, unsigned long &nNumBytesRead) { nNumBytesRead = 0; return 0; } -int DirectoryStream::seek(long, WPX_SEEK_TYPE) +int DirectoryStream::seek(long, librevenge::RVNG_SEEK_TYPE) { return -1; } @@ -145,7 +169,7 @@ long DirectoryStream::tell() return 0; } -bool DirectoryStream::atEOS() +bool DirectoryStream::isEnd() { return true; } diff --git a/writerperfect/source/common/DocumentHandler.cxx b/writerperfect/source/common/DocumentHandler.cxx index 239f20ec7055..f36bb28d885e 100644 --- a/writerperfect/source/common/DocumentHandler.cxx +++ b/writerperfect/source/common/DocumentHandler.cxx @@ -39,11 +39,11 @@ void DocumentHandler::endDocument() mxHandler->endDocument(); } -void DocumentHandler::startElement(const char *psName, const WPXPropertyList &xPropList) +void DocumentHandler::startElement(const char *psName, const librevenge::RVNGPropertyList &xPropList) { SvXMLAttributeList *pAttrList = new SvXMLAttributeList(); Reference < XAttributeList > xAttrList(pAttrList); - WPXPropertyList::Iter i(xPropList); + librevenge::RVNGPropertyList::Iter i(xPropList); for (i.rewind(); i.next(); ) { // filter out libwpd elements @@ -65,7 +65,7 @@ void DocumentHandler::endElement(const char *psName) mxHandler->endElement(sElementName); } -void DocumentHandler::characters(const WPXString &sCharacters) +void DocumentHandler::characters(const librevenge::RVNGString &sCharacters) { OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8); mxHandler->characters(sCharU16); diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index b2ad2a8a5d64..4fad167784c7 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -391,10 +391,10 @@ public : bool isStructured(); unsigned subStreamCount(); - const char * subStreamName(unsigned id); + const char *subStreamName(unsigned id); bool existsSubStream(const char *name); - WPXInputStream * getSubStreamByName(const char *name); - WPXInputStream * getSubStreamById(unsigned id); + librevenge::RVNGInputStream *getSubStreamByName(const char *name); + librevenge::RVNGInputStream *getSubStreamById(unsigned id); const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead); int seek(long offset); @@ -410,8 +410,8 @@ private: bool isZip(); void ensureZipIsInitialized(); - WPXInputStream *createWPXStream(const SotStorageStreamRef &rxStorage); - WPXInputStream *createWPXStream(const Reference &rxStream); + librevenge::RVNGInputStream *createWPXStream(const SotStorageStreamRef &rxStorage); + librevenge::RVNGInputStream *createWPXStream(const Reference &rxStream); private: ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > mxStream; @@ -627,7 +627,7 @@ bool WPXSvInputStreamImpl::existsSubStream(const char *const name) return false; } -WPXInputStream *WPXSvInputStreamImpl::getSubStreamByName(const char *const name) +librevenge::RVNGInputStream *WPXSvInputStreamImpl::getSubStreamByName(const char *const name) { if (!name) return 0; @@ -665,7 +665,7 @@ WPXInputStream *WPXSvInputStreamImpl::getSubStreamByName(const char *const name) return 0; } -WPXInputStream *WPXSvInputStreamImpl::getSubStreamById(const unsigned id) +librevenge::RVNGInputStream *WPXSvInputStreamImpl::getSubStreamById(const unsigned id) { if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is()) return 0; @@ -715,7 +715,7 @@ void WPXSvInputStreamImpl::invalidateReadBuffer() } } -WPXInputStream *WPXSvInputStreamImpl::createWPXStream(const SotStorageStreamRef &rxStorage) +librevenge::RVNGInputStream *WPXSvInputStreamImpl::createWPXStream(const SotStorageStreamRef &rxStorage) { if (rxStorage.Is()) { @@ -725,7 +725,7 @@ WPXInputStream *WPXSvInputStreamImpl::createWPXStream(const SotStorageStreamRef return 0; } -WPXInputStream *WPXSvInputStreamImpl::createWPXStream(const Reference &rxStream) +librevenge::RVNGInputStream *WPXSvInputStreamImpl::createWPXStream(const Reference &rxStream) { if (rxStream.is()) return new WPXSvInputStream( rxStream ); @@ -867,12 +867,12 @@ long WPXSvInputStream::tell() return retVal - (long)mpImpl->mnReadBufferLength + (long)mpImpl->mnReadBufferPos; } -int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType) +int WPXSvInputStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) { sal_Int64 tmpOffset = offset; - if (seekType == WPX_SEEK_CUR) + if (seekType == librevenge::RVNG_SEEK_CUR) tmpOffset += tell(); - if (seekType == WPX_SEEK_END) + if (seekType == librevenge::RVNG_SEEK_END) tmpOffset += mpImpl->mnLength; int retVal = 0; @@ -929,33 +929,18 @@ bool WPXSvInputStream::existsSubStream(const char *const name) return mpImpl->existsSubStream(name); } -WPXInputStream *WPXSvInputStream::getSubStreamByName(const char *name) +librevenge::RVNGInputStream *WPXSvInputStream::getSubStreamByName(const char *name) { mpImpl->invalidateReadBuffer(); return mpImpl->getSubStreamByName(name); } -WPXInputStream *WPXSvInputStream::getSubStreamById(const unsigned id) +librevenge::RVNGInputStream *WPXSvInputStream::getSubStreamById(const unsigned id) { mpImpl->invalidateReadBuffer(); return mpImpl->getSubStreamById(id); } -bool WPXSvInputStream::atEOS() -{ - return isEnd(); -} - -bool WPXSvInputStream::isOLEStream() -{ - return isStructured(); -} - -WPXInputStream *WPXSvInputStream::getDocumentOLEStream(const char *name) -{ - return getSubStreamByName(name); -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/CDRImportFilter.cxx b/writerperfect/source/draw/CDRImportFilter.cxx index 4cc568889c4c..e0c1bd8a74e8 100644 --- a/writerperfect/source/draw/CDRImportFilter.cxx +++ b/writerperfect/source/draw/CDRImportFilter.cxx @@ -27,12 +27,12 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool CDRImportFilter::doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) +bool CDRImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) { return libcdr::CDRDocument::parse(&rInput, &rGenerator); } -bool CDRImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool CDRImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libcdr::CDRDocument::isSupported(&rInput)) { diff --git a/writerperfect/source/draw/CDRImportFilter.hxx b/writerperfect/source/draw/CDRImportFilter.hxx index cf8a254ba4e7..3df8ccc36f8f 100644 --- a/writerperfect/source/draw/CDRImportFilter.hxx +++ b/writerperfect/source/draw/CDRImportFilter.hxx @@ -33,8 +33,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) SAL_OVERRIDE; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE; }; OUString CDRImportFilter_getImplementationName() diff --git a/writerperfect/source/draw/CMXImportFilter.cxx b/writerperfect/source/draw/CMXImportFilter.cxx index 78f39de1306f..f9044f831a46 100644 --- a/writerperfect/source/draw/CMXImportFilter.cxx +++ b/writerperfect/source/draw/CMXImportFilter.cxx @@ -27,12 +27,12 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool CMXImportFilter::doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) +bool CMXImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) { return libcdr::CMXDocument::parse(&rInput, &rGenerator); } -bool CMXImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool CMXImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libcdr::CMXDocument::isSupported(&rInput)) { diff --git a/writerperfect/source/draw/CMXImportFilter.hxx b/writerperfect/source/draw/CMXImportFilter.hxx index 4bc37ebead3e..43ffe96b5a15 100644 --- a/writerperfect/source/draw/CMXImportFilter.hxx +++ b/writerperfect/source/draw/CMXImportFilter.hxx @@ -33,8 +33,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) SAL_OVERRIDE; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE; }; OUString CMXImportFilter_getImplementationName() diff --git a/writerperfect/source/draw/FreehandImportFilter.cxx b/writerperfect/source/draw/FreehandImportFilter.cxx index b92386fe8900..db378582248d 100644 --- a/writerperfect/source/draw/FreehandImportFilter.cxx +++ b/writerperfect/source/draw/FreehandImportFilter.cxx @@ -23,12 +23,12 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool FreehandImportFilter::doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) +bool FreehandImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) { return libfreehand::FreeHandDocument::parse(&rInput, &rGenerator); } -bool FreehandImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool FreehandImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libfreehand::FreeHandDocument::isSupported(&rInput)) { diff --git a/writerperfect/source/draw/FreehandImportFilter.hxx b/writerperfect/source/draw/FreehandImportFilter.hxx index bb3a3c6a9711..0f9e284ba1d1 100644 --- a/writerperfect/source/draw/FreehandImportFilter.hxx +++ b/writerperfect/source/draw/FreehandImportFilter.hxx @@ -30,8 +30,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) SAL_OVERRIDE; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE; }; OUString FreehandImportFilter_getImplementationName() diff --git a/writerperfect/source/draw/ImportFilterBase.cxx b/writerperfect/source/draw/ImportFilterBase.cxx index ce98231da8b0..6fc09b2e74dd 100644 --- a/writerperfect/source/draw/ImportFilterBase.cxx +++ b/writerperfect/source/draw/ImportFilterBase.cxx @@ -92,7 +92,8 @@ throw (RuntimeException, std::exception) WPXSvInputStream input( xInputStream ); - OdgGenerator exporter(&xHandler, ODF_FLAT_XML); + OdgGenerator exporter; + exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML); return doImportDocument(input, exporter); } diff --git a/writerperfect/source/draw/ImportFilterBase.hxx b/writerperfect/source/draw/ImportFilterBase.hxx index 0efdc64e2bdb..56a180820aa7 100644 --- a/writerperfect/source/draw/ImportFilterBase.hxx +++ b/writerperfect/source/draw/ImportFilterBase.hxx @@ -8,9 +8,9 @@ #ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_IMPORTFILTERBASE_HXX #define INCLUDED_WRITERPERFECT_SOURCE_DRAW_IMPORTFILTERBASE_HXX -#include +#include -#include +#include #include #include @@ -78,8 +78,8 @@ public: throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) = 0; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) = 0; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) = 0; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) = 0; private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext; diff --git a/writerperfect/source/draw/MSPUBImportFilter.cxx b/writerperfect/source/draw/MSPUBImportFilter.cxx index 08f275d81fc3..99d59413443c 100644 --- a/writerperfect/source/draw/MSPUBImportFilter.cxx +++ b/writerperfect/source/draw/MSPUBImportFilter.cxx @@ -25,12 +25,12 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool MSPUBImportFilter::doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) +bool MSPUBImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) { return libmspub::MSPUBDocument::parse(&rInput, &rGenerator); } -bool MSPUBImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool MSPUBImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libmspub::MSPUBDocument::isSupported(&rInput)) { diff --git a/writerperfect/source/draw/MSPUBImportFilter.hxx b/writerperfect/source/draw/MSPUBImportFilter.hxx index 3ac4e5ace49e..b615af8b3f02 100644 --- a/writerperfect/source/draw/MSPUBImportFilter.hxx +++ b/writerperfect/source/draw/MSPUBImportFilter.hxx @@ -30,8 +30,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) SAL_OVERRIDE; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE; }; OUString MSPUBImportFilter_getImplementationName() diff --git a/writerperfect/source/draw/VisioImportFilter.cxx b/writerperfect/source/draw/VisioImportFilter.cxx index 311068b4edb6..969697b2c822 100644 --- a/writerperfect/source/draw/VisioImportFilter.cxx +++ b/writerperfect/source/draw/VisioImportFilter.cxx @@ -23,12 +23,12 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool VisioImportFilter::doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) +bool VisioImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) { return libvisio::VisioDocument::parse(&rInput, &rGenerator); } -bool VisioImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool VisioImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libvisio::VisioDocument::isSupported(&rInput)) { diff --git a/writerperfect/source/draw/VisioImportFilter.hxx b/writerperfect/source/draw/VisioImportFilter.hxx index fab0e6324897..2b2346289b6f 100644 --- a/writerperfect/source/draw/VisioImportFilter.hxx +++ b/writerperfect/source/draw/VisioImportFilter.hxx @@ -30,8 +30,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) SAL_OVERRIDE; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE; }; OUString VisioImportFilter_getImplementationName() diff --git a/writerperfect/source/draw/WPGImportFilter.cxx b/writerperfect/source/draw/WPGImportFilter.cxx index 4341af2c36a3..6c0eac03f8d0 100644 --- a/writerperfect/source/draw/WPGImportFilter.cxx +++ b/writerperfect/source/draw/WPGImportFilter.cxx @@ -19,6 +19,8 @@ #include +#include + #include "WPGImportFilter.hxx" using com::sun::star::uno::Reference; @@ -28,12 +30,12 @@ using com::sun::star::uno::Sequence; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool WPGImportFilter::doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) +bool WPGImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) { return libwpg::WPGraphics::parse(&rInput, &rGenerator); } -bool WPGImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool WPGImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libwpg::WPGraphics::isSupported(&rInput)) { diff --git a/writerperfect/source/draw/WPGImportFilter.hxx b/writerperfect/source/draw/WPGImportFilter.hxx index 5105dadfa1c7..98cc3aaaecc6 100644 --- a/writerperfect/source/draw/WPGImportFilter.hxx +++ b/writerperfect/source/draw/WPGImportFilter.hxx @@ -35,8 +35,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, libwpg::WPGPaintInterface &rGenerator ) SAL_OVERRIDE; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGDrawingInterface &rGenerator ) SAL_OVERRIDE; }; OUString WPGImportFilter_getImplementationName() diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index 9f8b57e03fce..236e5d960a05 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -144,14 +144,15 @@ throw (RuntimeException, std::exception) // writes to in-memory target doc DocumentHandler xHandler(xInternalHandler); - shared_ptr< WPXInputStream > input; + shared_ptr< librevenge::RVNGInputStream > input; if ( bIsPackage ) input.reset( new writerperfect::DirectoryStream( xContent ) ); else input.reset( new WPXSvInputStream( xInputStream ) ); - OdpGenerator exporter(&xHandler, ODF_FLAT_XML); - bool tmpParseResult = libetonyek::KEYDocument::parse(input.get(), &exporter); + OdpGenerator exporter; + exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML); + bool tmpParseResult = libetonyek::EtonyekDocument::parse(input.get(), &exporter); return tmpParseResult; } @@ -216,7 +217,7 @@ throw( com::sun::star::uno::RuntimeException, std::exception ) if (!xInputStream.is()) return OUString(); - shared_ptr< WPXInputStream > input( new WPXSvInputStream( xInputStream ) ); + shared_ptr< librevenge::RVNGInputStream > input( new WPXSvInputStream( xInputStream ) ); /* Apple Keynote documents come in two variants: * * actual files (zip), only produced by Keynote 5 (at least with @@ -247,11 +248,12 @@ throw( com::sun::star::uno::RuntimeException, std::exception ) return OUString(); } - libetonyek::KEYDocumentType type = libetonyek::KEY_DOCUMENT_TYPE_UNKNOWN; - if ( !libetonyek::KEYDocument::isSupported( input.get(), &type ) ) + libetonyek::EtonyekDocument::Type type = libetonyek::EtonyekDocument::TYPE_UNKNOWN; + const libetonyek::EtonyekDocument::Confidence confidence = libetonyek::EtonyekDocument::isSupported( input.get(), &type ); + if ((libetonyek::EtonyekDocument::CONFIDENCE_NONE == confidence) || (libetonyek::EtonyekDocument::TYPE_KEYNOTE != type)) return OUString(); - if ( type == libetonyek::KEY_DOCUMENT_TYPE_APXL_FILE ) + if ( confidence == libetonyek::EtonyekDocument::CONFIDENCE_SUPPORTED_PART ) { assert( !bIsPackage ); @@ -262,7 +264,7 @@ throw( com::sun::star::uno::RuntimeException, std::exception ) if ( xPackageContent.is() ) { input.reset( new writerperfect::DirectoryStream( xPackageContent ) ); - if ( libetonyek::KEYDocument::isSupported( input.get() ) ) + if ( libetonyek::EtonyekDocument::CONFIDENCE_EXCELLENT == libetonyek::EtonyekDocument::isSupported( input.get() ) ) { xContent = xPackageContent; bUCBContentChanged = true; diff --git a/writerperfect/source/writer/AbiWordImportFilter.cxx b/writerperfect/source/writer/AbiWordImportFilter.cxx index 034f2480ffc8..b8aa52442588 100644 --- a/writerperfect/source/writer/AbiWordImportFilter.cxx +++ b/writerperfect/source/writer/AbiWordImportFilter.cxx @@ -24,12 +24,12 @@ using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; using com::sun::star::uno::XInterface; -bool AbiWordImportFilter::doImportDocument( WPXInputStream &rInput, const rtl::OUString &, WPXDocumentInterface &rGenerator ) +bool AbiWordImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &, librevenge::RVNGTextInterface &rGenerator ) { return libabw::AbiDocument::parse(&rInput, &rGenerator); } -bool AbiWordImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool AbiWordImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { if (libabw::AbiDocument::isFileFormatSupported(&rInput)) { diff --git a/writerperfect/source/writer/AbiWordImportFilter.hxx b/writerperfect/source/writer/AbiWordImportFilter.hxx index c1a75d503046..6d81423d4d68 100644 --- a/writerperfect/source/writer/AbiWordImportFilter.hxx +++ b/writerperfect/source/writer/AbiWordImportFilter.hxx @@ -33,8 +33,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, const rtl::OUString &rFilterName, WPXDocumentInterface &rGenerator ) SAL_OVERRIDE; + 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; }; OUString AbiWordImportFilter_getImplementationName() diff --git a/writerperfect/source/writer/EBookImportFilter.cxx b/writerperfect/source/writer/EBookImportFilter.cxx index 6c1434761ef1..300376895984 100644 --- a/writerperfect/source/writer/EBookImportFilter.cxx +++ b/writerperfect/source/writer/EBookImportFilter.cxx @@ -24,40 +24,58 @@ using com::sun::star::uno::Exception; using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; -bool EBookImportFilter::doImportDocument( WPXInputStream &rInput, const rtl::OUString &rFilterName, WPXDocumentInterface &rGenerator ) +using libebook::EBOOKDocument; + +bool EBookImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &rFilterName, librevenge::RVNGTextInterface &rGenerator ) { if (rFilterName == "FictionBook 2") - return libebook::FB2Document::parse(&rInput, &rGenerator); + return EBOOKDocument::parse(&rInput, &rGenerator, EBOOKDocument::TYPE_FICTIONBOOK2); else if (rFilterName == "PalmDoc") - return libebook::PDBDocument::parse(&rInput, &rGenerator); + return EBOOKDocument::parse(&rInput, &rGenerator, EBOOKDocument::TYPE_PALMDOC); else if (rFilterName == "Plucker eBook") - return libebook::PLKRDocument::parse(&rInput, &rGenerator); + return EBOOKDocument::parse(&rInput, &rGenerator, EBOOKDocument::TYPE_PLUCKER); else if (rFilterName == "eReader eBook") - return libebook::PMLDocument::parse(&rInput, &rGenerator); + return EBOOKDocument::parse(&rInput, &rGenerator, EBOOKDocument::TYPE_PEANUTPRESS); else if (rFilterName == "TealDoc") - return libebook::TDDocument::parse(&rInput, &rGenerator); + return EBOOKDocument::parse(&rInput, &rGenerator, EBOOKDocument::TYPE_TEALDOC); else if (rFilterName == "zTXT") - return libebook::ZTXTDocument::parse(&rInput, &rGenerator); + return EBOOKDocument::parse(&rInput, &rGenerator, EBOOKDocument::TYPE_ZTXT); return false; } -bool EBookImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool EBookImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { rTypeName = ""; - if (libebook::FB2Document::isSupported(&rInput)) - rTypeName = "writer_FictionBook_2"; - else if (libebook::PDBDocument::isSupported(&rInput)) - rTypeName = "writer_PalmDoc"; - else if (libebook::PLKRDocument::isSupported(&rInput)) - rTypeName = "writer_Plucker_eBook"; - else if (libebook::PMLDocument::isSupported(&rInput)) - rTypeName = "writer_eReader_eBook"; - else if (libebook::TDDocument::isSupported(&rInput)) - rTypeName = "writer_TealDoc"; - else if (libebook::ZTXTDocument::isSupported(&rInput)) - rTypeName = "writer_zTXT"; + EBOOKDocument::Type type = EBOOKDocument::TYPE_UNKNOWN; + + if (EBOOKDocument::CONFIDENCE_EXCELLENT == EBOOKDocument::isSupported(&rInput, &type)) + { + switch (type) + { + case EBOOKDocument::TYPE_FICTIONBOOK2 : + rTypeName = "writer_FictionBook_2"; + break; + case EBOOKDocument::TYPE_PALMDOC : + rTypeName = "writer_PalmDoc"; + break; + case EBOOKDocument::TYPE_PLUCKER : + rTypeName = "writer_Plucker_eBook"; + break; + case EBOOKDocument::TYPE_PEANUTPRESS : + rTypeName = "writer_eReader_eBook"; + break; + case EBOOKDocument::TYPE_TEALDOC : + rTypeName = "writer_TealDoc"; + break; + case EBOOKDocument::TYPE_ZTXT : + rTypeName = "writer_zTXT"; + break; + default : + SAL_WARN_IF(type != EBOOKDocument::TYPE_UNKNOWN, "writerperfect", "EBookImportFilter::doDetectFormat: document type " << type << " detected, but ignored"); + } + } return !rTypeName.isEmpty(); } diff --git a/writerperfect/source/writer/EBookImportFilter.hxx b/writerperfect/source/writer/EBookImportFilter.hxx index 693ce31280af..0365fd7d4000 100644 --- a/writerperfect/source/writer/EBookImportFilter.hxx +++ b/writerperfect/source/writer/EBookImportFilter.hxx @@ -33,8 +33,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, const rtl::OUString &rFilterName, WPXDocumentInterface &rGenerator ) SAL_OVERRIDE; + 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; }; OUString EBookImportFilter_getImplementationName() diff --git a/writerperfect/source/writer/ImportFilterBase.cxx b/writerperfect/source/writer/ImportFilterBase.cxx index 59bc8ef0844e..9f1ecc5383ee 100644 --- a/writerperfect/source/writer/ImportFilterBase.cxx +++ b/writerperfect/source/writer/ImportFilterBase.cxx @@ -93,7 +93,8 @@ throw (RuntimeException, std::exception) WPXSvInputStream input( xInputStream ); - OdtGenerator exporter(&xHandler, ODF_FLAT_XML); + OdtGenerator exporter; + exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML); doRegisterHandlers(exporter); diff --git a/writerperfect/source/writer/ImportFilterBase.hxx b/writerperfect/source/writer/ImportFilterBase.hxx index 90dc4e2dd9f1..b54af430f979 100644 --- a/writerperfect/source/writer/ImportFilterBase.hxx +++ b/writerperfect/source/writer/ImportFilterBase.hxx @@ -10,8 +10,8 @@ #include -#include -#include +#include +#include #include #include @@ -79,8 +79,8 @@ public: throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) = 0; - virtual bool doImportDocument( WPXInputStream &rInput, const rtl::OUString &rFilterName, WPXDocumentInterface &rGenerator ) = 0; + virtual bool doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) = 0; + virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &rFilterName, librevenge::RVNGTextInterface &rGenerator ) = 0; virtual void doRegisterHandlers( OdtGenerator &rGenerator ); private: diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx index 7aef8e983ecd..75672947b463 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.cxx +++ b/writerperfect/source/writer/MSWorksImportFilter.cxx @@ -24,16 +24,17 @@ using com::sun::star::uno::Exception; using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; -bool MSWorksImportFilter::doImportDocument( WPXInputStream &rInput, const rtl::OUString &, WPXDocumentInterface &rGenerator ) +bool MSWorksImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &, librevenge::RVNGTextInterface &rGenerator ) { - return WPS_OK == WPSDocument::parse(&rInput, &rGenerator); + return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator); } -bool MSWorksImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool MSWorksImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { - const WPSConfidence confidence = WPSDocument::isFileFormatSupported(&rInput); + libwps::WPSKind kind = libwps::WPS_TEXT; + const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind); - if ((confidence == WPS_CONFIDENCE_EXCELLENT) || (confidence == WPS_CONFIDENCE_GOOD)) + if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT)) { rTypeName = "writer_MS_Works_Document"; return true; diff --git a/writerperfect/source/writer/MSWorksImportFilter.hxx b/writerperfect/source/writer/MSWorksImportFilter.hxx index 924e2c207255..b5ddfe4ccf64 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.hxx +++ b/writerperfect/source/writer/MSWorksImportFilter.hxx @@ -33,8 +33,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, const rtl::OUString &rFilterName, WPXDocumentInterface &rGenerator ) SAL_OVERRIDE; + 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; }; OUString MSWorksImportFilter_getImplementationName() diff --git a/writerperfect/source/writer/MWAWImportFilter.cxx b/writerperfect/source/writer/MWAWImportFilter.cxx index 97f414ac0812..ad656c942817 100644 --- a/writerperfect/source/writer/MWAWImportFilter.cxx +++ b/writerperfect/source/writer/MWAWImportFilter.cxx @@ -24,18 +24,19 @@ using com::sun::star::uno::Exception; using com::sun::star::uno::RuntimeException; using com::sun::star::uno::XComponentContext; -static bool handleEmbeddedMWAWObject(const WPXBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +static bool handleEmbeddedMWAWObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) { - OdgGenerator exporter(pHandler, streamType); + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); return MWAWDocument::decodeGraphic(data, &exporter); } -bool MWAWImportFilter::doImportDocument( WPXInputStream &rInput, const rtl::OUString &, WPXDocumentInterface &rGenerator ) +bool MWAWImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, const rtl::OUString &, librevenge::RVNGTextInterface &rGenerator ) { return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator); } -bool MWAWImportFilter::doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) +bool MWAWImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName ) { rTypeName = ""; diff --git a/writerperfect/source/writer/MWAWImportFilter.hxx b/writerperfect/source/writer/MWAWImportFilter.hxx index 4efe185cab48..62883f9cf40a 100644 --- a/writerperfect/source/writer/MWAWImportFilter.hxx +++ b/writerperfect/source/writer/MWAWImportFilter.hxx @@ -33,8 +33,8 @@ public: throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - virtual bool doDetectFormat( WPXInputStream &rInput, OUString &rTypeName ) SAL_OVERRIDE; - virtual bool doImportDocument( WPXInputStream &rInput, const rtl::OUString &rFilterName, WPXDocumentInterface &rGenerator ) SAL_OVERRIDE; + 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; }; diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx index ee0aad258bd9..48190ef49b41 100644 --- a/writerperfect/source/writer/WordPerfectImportFilter.cxx +++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx @@ -28,8 +28,9 @@ #include #include -#include #include +#include +#include #include "WordPerfectImportFilter.hxx" @@ -57,31 +58,36 @@ using com::sun::star::xml::sax::XParser; using writerperfect::DocumentHandler; using writerperfect::WPXSvInputStream; -static bool handleEmbeddedWPGObject(const WPXBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) +static bool handleEmbeddedWPGObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) { - OdgGenerator exporter(pHandler, streamType); + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); libwpg::WPGFileFormat fileFormat = libwpg::WPG_AUTODETECT; - if (!libwpg::WPGraphics::isSupported(const_cast(data.getDataStream()))) + if (!libwpg::WPGraphics::isSupported(const_cast(data.getDataStream()))) fileFormat = libwpg::WPG_WPG1; - return libwpg::WPGraphics::parse(const_cast(data.getDataStream()), &exporter, fileFormat); + return libwpg::WPGraphics::parse(const_cast(data.getDataStream()), &exporter, fileFormat); } -static bool handleEmbeddedWPGImage(const WPXBinaryData &input, WPXBinaryData &output) +static bool handleEmbeddedWPGImage(const librevenge::RVNGBinaryData &input, librevenge::RVNGBinaryData &output) { - WPXString svgOutput; libwpg::WPGFileFormat fileFormat = libwpg::WPG_AUTODETECT; - if (!libwpg::WPGraphics::isSupported(const_cast(input.getDataStream()))) + if (!libwpg::WPGraphics::isSupported(const_cast(input.getDataStream()))) fileFormat = libwpg::WPG_WPG1; - if (!libwpg::WPGraphics::generateSVG(const_cast(input.getDataStream()), svgOutput, fileFormat)) + librevenge::RVNGStringVector svgOutput; + librevenge::RVNGSVGDrawingGenerator aSVGGenerator(svgOutput, ""); + + if (!libwpg::WPGraphics::parse(const_cast(input.getDataStream()), &aSVGGenerator, fileFormat)) return false; + assert(1 == svgOutput.size()); + output.clear(); - output.append((unsigned char *)svgOutput.cstr(), strlen(svgOutput.cstr())); + output.append(reinterpret_cast(svgOutput[0].cstr()), svgOutput[0].size()); return true; } @@ -106,9 +112,9 @@ throw (RuntimeException) OString aUtf8Passwd; - WPDConfidence confidence = WPDocument::isFileFormatSupported(&input); + libwpd::WPDConfidence confidence = libwpd::WPDocument::isFileFormatSupported(&input); - if (WPD_CONFIDENCE_SUPPORTED_ENCRYPTION == confidence) + if (libwpd::WPD_CONFIDENCE_SUPPORTED_ENCRYPTION == confidence) { int unsuccessfulAttempts = 0; while (true ) @@ -119,7 +125,7 @@ throw (RuntimeException) return false; OUString aPasswd = aPasswdDlg.GetPassword(); aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8); - if (WPD_PASSWORD_MATCH_OK == WPDocument::verifyPassword(&input, aUtf8Passwd.getStr())) + if (libwpd::WPD_PASSWORD_MATCH_OK == libwpd::WPDocument::verifyPassword(&input, aUtf8Passwd.getStr())) break; else unsuccessfulAttempts++; @@ -142,10 +148,11 @@ throw (RuntimeException) // writes to in-memory target doc DocumentHandler xHandler(xInternalHandler); - OdtGenerator collector(&xHandler, ODF_FLAT_XML); + OdtGenerator collector; + collector.addDocumentHandler(&xHandler, ODF_FLAT_XML); collector.registerEmbeddedObjectHandler("image/x-wpg", &handleEmbeddedWPGObject); collector.registerEmbeddedImageHandler("image/x-wpg", &handleEmbeddedWPGImage); - if (WPD_OK == WPDocument::parse(&input, &collector, aUtf8Passwd.isEmpty() ? 0 : aUtf8Passwd.getStr())) + if (libwpd::WPD_OK == libwpd::WPDocument::parse(&input, &collector, aUtf8Passwd.isEmpty() ? 0 : aUtf8Passwd.getStr())) return true; return false; } @@ -171,7 +178,7 @@ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException, std:: OUString SAL_CALL WordPerfectImportFilter::detect( Sequence< PropertyValue >& Descriptor ) throw( RuntimeException, std::exception ) { - WPDConfidence confidence = WPD_CONFIDENCE_NONE; + libwpd::WPDConfidence confidence = libwpd::WPD_CONFIDENCE_NONE; OUString sTypeName; sal_Int32 nLength = Descriptor.getLength(); sal_Int32 location = nLength; @@ -190,9 +197,9 @@ throw( RuntimeException, std::exception ) WPXSvInputStream input( xInputStream ); - confidence = WPDocument::isFileFormatSupported(&input); + confidence = libwpd::WPDocument::isFileFormatSupported(&input); - if (confidence == WPD_CONFIDENCE_EXCELLENT || confidence == WPD_CONFIDENCE_SUPPORTED_ENCRYPTION) + if (confidence == libwpd::WPD_CONFIDENCE_EXCELLENT || confidence == libwpd::WPD_CONFIDENCE_SUPPORTED_ENCRYPTION) sTypeName = "writer_WordPerfect_Document"; if (!sTypeName.isEmpty()) @@ -289,9 +296,9 @@ throw (RuntimeException, std::exception) OString aUtf8Passwd; - WPDConfidence confidence = WPDocument::isFileFormatSupported(&input); + libwpd::WPDConfidence confidence = libwpd::WPDocument::isFileFormatSupported(&input); - if (WPD_CONFIDENCE_SUPPORTED_ENCRYPTION == confidence) + if (libwpd::WPD_CONFIDENCE_SUPPORTED_ENCRYPTION == confidence) { int unsuccessfulAttempts = 0; while (true ) @@ -302,7 +309,7 @@ throw (RuntimeException, std::exception) return com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL; msPassword = aPasswdDlg.GetPassword().getStr(); aUtf8Passwd = OUStringToOString(msPassword, RTL_TEXTENCODING_UTF8); - if (WPD_PASSWORD_MATCH_OK == WPDocument::verifyPassword(&input, aUtf8Passwd.getStr())) + if (libwpd::WPD_PASSWORD_MATCH_OK == libwpd::WPDocument::verifyPassword(&input, aUtf8Passwd.getStr())) break; else unsuccessfulAttempts++; -- cgit