diff --git a/lotuswordpro/README.md b/lotuswordpro/README.md index fc58c3fe439c..5642c6de157d 100644 --- a/lotuswordpro/README.md +++ b/lotuswordpro/README.md @@ -2,20 +2,22 @@ ## Description -The import is not direct, but via an intermediate format: StarOffice -XML, the predecessor of ODF (yes, the code is old). The entry point to -the filter is class LotusWordProImportFilter (refer to Source code +> :warning: **Import Filter supports only Lotus Word Pro 97 and next versions** + +The import is not direct, but via an intermediate format: [StarOffice XML](http://xml.openoffice.org/xml_specification_draft.pdf), +the predecessor of ODF (yes, the code is old). The entry point to +the filter is class `LotusWordProImportFilter` (refer to Source code section), but that just hooks up the necessary machinery for processing StarOffice XML produced by the filter. The real fun starts in function `ReadWordproFile()` (`source/filter/lwpfilter.cxx`); this function -initializes the parser (class `Lwp9Reader`) and the SAX XML handler that -produces the output (class `XFSaxStream`). The Lwp9Reader class then does +initializes the parser (class `Lwp9Reader`) and the [SAX XML](https://en.wikipedia.org/wiki/Simple_API_for_XML) handler that +produces the output (class `XFSaxStream`). The `Lwp9Reader` class then does the actual parsing. -If the module is built with debug level greater than 0, it is possible -to examine the intermediate XML: set environment variable -`DBG_LWPIMPORT_DIR=` to an existing directory and, on opening an lwp -document, a file named `lwpimport.xml` will be created in that directory. +If the module is built with debug level greater than `0`, it is possible +to examine the intermediate XML: set [environment variable](https://en.wikipedia.org/wiki/Environment_variable) +`DBG_LWPIMPORT_DIR=` to an existing directory. During opening an `.lwp` +document, a file named `lwpimport.xml` will be created in `DBG_LWPIMPORT_DIR` directory. ## Source Code diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx index d85e8c700d92..50211fd929c7 100644 --- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx +++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx @@ -149,8 +149,8 @@ private: } #endif -// W o r d P r o -const sal_Int8 header[] = { 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f }; +// W o r d P r o +constexpr sal_Int8 header[] = { 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f }; bool LotusWordProImportFilter::importImpl( const Sequence< css::beans::PropertyValue >& aDescriptor ) { @@ -255,7 +255,7 @@ OUString SAL_CALL LotusWordProImportFilter::detect( css::uno::Sequence< Property } Sequence< ::sal_Int8 > aData; - sal_Int32 nLen = SAL_N_ELEMENTS( header ); + constexpr sal_Int32 nLen = SAL_N_ELEMENTS( header ); if ( ( nLen != xInputStream->readBytes( aData, nLen ) ) || ( memcmp( static_cast(header), static_cast(aData.getConstArray()), nLen ) != 0 ) ) sTypeName.clear(); diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx index 7340adb042b2..dfcadf541fad 100644 --- a/lotuswordpro/source/filter/lwp9reader.cxx +++ b/lotuswordpro/source/filter/lwp9reader.cxx @@ -62,6 +62,7 @@ #include #include #include +#include Lwp9Reader::Lwp9Reader(LwpSvStream* pInputStream, IXFStream* pStream) : m_pDocStream(pInputStream) @@ -88,7 +89,11 @@ bool Lwp9Reader::Read() bRet = ParseDocument(); } else + { + SAL_WARN("lwp", "Only Lotus Word Pro 97 (version 11) and later is supported."); + SAL_WARN("lwp", "You are trying to open version: " << LwpFileHeader::m_nFileRevision); bRet = false; + } } catch (...) {