lotuswordpro/README.md                                  |   20 ++++++++--------
 lotuswordpro/source/filter/LotusWordProImportFilter.cxx |    6 ++--
 lotuswordpro/source/filter/lwp9reader.cxx               |    5 ++++
 3 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 7bb911d11813136935ac8a0bbe6dcbe211a24853
Author:     Bartosz Kosiorek <gan...@poczta.onet.pl>
AuthorDate: Thu Jul 14 00:22:06 2022 +0200
Commit:     Bartosz Kosiorek <gan...@poczta.onet.pl>
CommitDate: Thu Jul 14 10:32:23 2022 +0200

    tdf#112626 lotuswordpro: switch to constexpr and update documentation
    
    Change-Id: I566c22285978f7b31961d105d02d99d0696908b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137041
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>

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<void const *>(header), static_cast<void 
const *>(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 <xfilter/xfstylemanager.hxx>
 #include <lwpdocdata.hxx>
 #include <lwpchangemgr.hxx>
+#include <sal/log.hxx>
 
 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 (...)
     {

Reply via email to