From a7c10601e3debd0a8ab45583ff7fcebfc489a997 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 24 Aug 2004 07:31:55 +0000 Subject: Fix the input stream; fix the code to work vs. the latest libwpd, remove unnecessary 'ooo/' cut/paste action. Issue number: 32648 --- writerperfect/prj/build.lst | 5 ++--- writerperfect/source/filter/DocumentElement.hxx | 2 +- writerperfect/source/stream/WPXSvStream.cxx | 20 +++++++++----------- writerperfect/source/stream/WPXSvStream.h | 5 +++-- writerperfect/util/makefile.mk | 2 +- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/writerperfect/prj/build.lst b/writerperfect/prj/build.lst index ab30e5ba3799..7dba181825f3 100644 --- a/writerperfect/prj/build.lst +++ b/writerperfect/prj/build.lst @@ -1,7 +1,6 @@ -wpft writerperfect : libwpd sot sfx2 NULL +wpft writerperfect : xmloff libwpd sot sfx2 NULL -wpft writerperfect\source\ooo nmake - all wpft_ooo NULL wpft writerperfect\source\stream nmake - all wpft_stream NULL wpft writerperfect\source\filter nmake - all wpft_filter NULL -wpft writerperfect\util nmake - all wpft_util wpft_ooo wpft_filter wpft_stream NULL +wpft writerperfect\util nmake - all wpft_util wpft_filter wpft_stream NULL diff --git a/writerperfect/source/filter/DocumentElement.hxx b/writerperfect/source/filter/DocumentElement.hxx index a50275d3948f..e322683bc9fc 100644 --- a/writerperfect/source/filter/DocumentElement.hxx +++ b/writerperfect/source/filter/DocumentElement.hxx @@ -42,7 +42,7 @@ using namespace std; #include #endif -#include "ooo/attrlist.hxx" +#include class DocumentElement { diff --git a/writerperfect/source/stream/WPXSvStream.cxx b/writerperfect/source/stream/WPXSvStream.cxx index f6f14e85d3c8..dd7966d7c1b7 100644 --- a/writerperfect/source/stream/WPXSvStream.cxx +++ b/writerperfect/source/stream/WPXSvStream.cxx @@ -1,7 +1,6 @@ #include "WPXSvStream.h" #include "libwpd_internal.h" -#include #include #include #include @@ -15,6 +14,8 @@ using namespace ::com::sun::star::io; WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) : WPXInputStream(true), + mxChildStorage(), + mxChildStream(), mxStream(xStream), mnOffset(0) { @@ -44,7 +45,6 @@ int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType) mnOffset += offset; return FALSE; } - Reference < XSeekable> xSeekable = Reference < XSeekable >(mxStream, UNO_QUERY); if (!xSeekable.is()) @@ -67,7 +67,7 @@ long WPXSvInputStream::tell() bool WPXSvInputStream::atEOS() { - return mnOffset < mnLength; + return mnOffset >= mnLength; } bool WPXSvInputStream::isOLEStream() @@ -78,6 +78,8 @@ bool WPXSvInputStream::isOLEStream() bAns = pStream && SotStorage::IsOLEStorage( pStream ); delete pStream; + seek (0, WPX_SEEK_SET); + return bAns; } @@ -85,19 +87,15 @@ WPXInputStream * WPXSvInputStream::getDocumentOLEStream() { SvStream *pStream = utl::UcbStreamHelper::CreateStream( mxStream ); - SotStorage *pStorage = new SotStorage( pStream, TRUE ); + mxChildStorage = new SotStorage( pStream, TRUE ); - fprintf (stderr, "Dodgy\n"); - SvStream *pContents = pStorage->OpenSotStream( + mxChildStream = mxChildStorage->OpenSotStream( rtl::OUString::createFromAscii( "PerfectOffice_MAIN" ), STREAM_STD_READ ); - Reference < XInputStream > xContents = new utl::OInputStreamWrapper( pStream ); + Reference < XInputStream > xContents = new utl::OInputStreamWrapper( mxChildStream ); if (xContents.is()) return new WPXSvInputStream( xContents ); - else { - fprintf( stderr, "Badly wrong\n" ); + else return NULL; - } - // FIXME: we leak pStorage - investigate protected destructor there. } diff --git a/writerperfect/source/stream/WPXSvStream.h b/writerperfect/source/stream/WPXSvStream.h index cf12b286a904..a2cde7261b69 100644 --- a/writerperfect/source/stream/WPXSvStream.h +++ b/writerperfect/source/stream/WPXSvStream.h @@ -1,9 +1,8 @@ #ifndef WPXSVSTREAM_H #define WPXSVSTREAM_H -#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_H_ +#include #include -#endif #include @@ -23,6 +22,8 @@ public: virtual bool atEOS(); private: + SotStorageRef mxChildStorage; + SotStorageStreamRef mxChildStream; ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > mxStream; ::com::sun::star::uno::Sequence< sal_Int8 > maData; diff --git a/writerperfect/util/makefile.mk b/writerperfect/util/makefile.mk index 80439223b8ca..16c98efc18f2 100644 --- a/writerperfect/util/makefile.mk +++ b/writerperfect/util/makefile.mk @@ -7,7 +7,6 @@ VERSION=$(UPD) LIB1TARGET= $(SLB)$/$(TARGET).lib LIB1FILES= \ - $(SLB)$/ooo.lib \ $(SLB)$/stream.lib \ $(SLB)$/filter.lib SHL1LIBS=$(LIB1TARGET) @@ -24,6 +23,7 @@ SHL1STDLIBS+= \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ + $(XMLOFFLIB) \ -lwpd SHL1TARGET = $(TARGET)$(UPD)$(DLLPOSTFIX) SHL1IMPLIB = i$(SHL1TARGET) -- cgit v1.2.3