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 <gang65@poczta.onet.pl>
This commit is contained in:
parent
7a4814f717
commit
7bb911d118
3 changed files with 19 additions and 12 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ private:
|
|||
#endif
|
||||
|
||||
// W o r d P r o
|
||||
const sal_Int8 header[] = { 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f };
|
||||
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();
|
||||
|
|
|
@ -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,8 +89,12 @@ 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 (...)
|
||||
{
|
||||
LwpGlobalMgr::DeleteInstance();
|
||||
|
|
Loading…
Reference in a new issue