summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2013-04-18 11:44:19 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2013-04-18 11:44:29 +0200
commit9d5276b3fb2de81d56e698cc8d32b2869cfb3c55 (patch)
tree21a6b1550a180ebb323b8973b59fd8ef56468adf /writerperfect
parent16f508686c29bfa244ca6f81b5ab3bbaf5fef2a7 (diff)
PImpl the WPXSvInputStream class
Change-Id: I11a3d663e2f5a8f68edd66b7ba2af15cc57287a9
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/source/stream/WPXSvStream.cxx93
-rw-r--r--writerperfect/source/stream/WPXSvStream.h19
2 files changed, 87 insertions, 25 deletions
diff --git a/writerperfect/source/stream/WPXSvStream.cxx b/writerperfect/source/stream/WPXSvStream.cxx
index 640ab20699a0..81d6b1bb00b4 100644
--- a/writerperfect/source/stream/WPXSvStream.cxx
+++ b/writerperfect/source/stream/WPXSvStream.cxx
@@ -13,6 +13,7 @@
#include <unotools/streamwrap.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <limits>
+#include <vector>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
@@ -27,7 +28,42 @@ static void splitPath( std::vector<OUString> &rElems, const OUString &rPath )
} // anonymous namespace
-WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) :
+typedef struct
+{
+ SotStorageRef ref;
+} SotStorageRefWrapper;
+
+typedef struct
+{
+ SotStorageStreamRef ref;
+} SotStorageStreamRefWrapper;
+
+class WPXSvInputStreamImpl : public WPXInputStream
+{
+public :
+ WPXSvInputStreamImpl( ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > xStream );
+ ~WPXSvInputStreamImpl();
+
+ bool isOLEStream();
+ WPXInputStream * getDocumentOLEStream(const char *name);
+
+ const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
+ int seek(long offset, WPX_SEEK_TYPE seekType);
+ long tell();
+ bool atEOS();
+private:
+ ::std::vector< SotStorageRefWrapper > mxChildrenStorages;
+ ::std::vector< SotStorageStreamRefWrapper > mxChildrenStreams;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > mxStream;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XSeekable > mxSeekable;
+ ::com::sun::star::uno::Sequence< sal_Int8 > maData;
+ sal_Int64 mnLength;
+};
+
+WPXSvInputStreamImpl::WPXSvInputStreamImpl( Reference< XInputStream > xStream ) :
WPXInputStream(),
mxChildrenStorages(),
mxChildrenStreams(),
@@ -56,11 +92,11 @@ WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) :
}
}
-WPXSvInputStream::~WPXSvInputStream()
+WPXSvInputStreamImpl::~WPXSvInputStreamImpl()
{
}
-const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned long &numBytesRead)
+const unsigned char *WPXSvInputStreamImpl::read(unsigned long numBytes, unsigned long &numBytesRead)
{
numBytesRead = 0;
@@ -74,7 +110,7 @@ const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned lon
return (const unsigned char *)maData.getConstArray();
}
-long WPXSvInputStream::tell()
+long WPXSvInputStreamImpl::tell()
{
if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is())
return -1L;
@@ -87,7 +123,7 @@ long WPXSvInputStream::tell()
}
}
-int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
+int WPXSvInputStreamImpl::seek(long offset, WPX_SEEK_TYPE seekType)
{
if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is())
return -1;
@@ -130,14 +166,14 @@ int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
}
}
-bool WPXSvInputStream::atEOS()
+bool WPXSvInputStreamImpl::atEOS()
{
if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is())
return true;
return (mxSeekable->getPosition() >= mnLength);
}
-bool WPXSvInputStream::isOLEStream()
+bool WPXSvInputStreamImpl::isOLEStream()
{
if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is())
return false;
@@ -155,7 +191,7 @@ bool WPXSvInputStream::isOLEStream()
return bAns;
}
-WPXInputStream *WPXSvInputStream::getDocumentOLEStream(const char *name)
+WPXInputStream *WPXSvInputStreamImpl::getDocumentOLEStream(const char *name)
{
if (!name)
return 0;
@@ -223,4 +259,45 @@ WPXInputStream *WPXSvInputStream::getDocumentOLEStream(const char *name)
return 0;
}
+
+WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) :
+ mpImpl(new WPXSvInputStreamImpl(xStream))
+{
+}
+
+WPXSvInputStream::~WPXSvInputStream()
+{
+ delete mpImpl;
+}
+
+const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned long &numBytesRead)
+{
+ return mpImpl->read(numBytes, numBytesRead);
+}
+
+long WPXSvInputStream::tell()
+{
+ return mpImpl->tell();
+}
+
+int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
+{
+ return mpImpl->seek(offset, seekType);
+}
+
+bool WPXSvInputStream::atEOS()
+{
+ return mpImpl->atEOS();
+}
+
+bool WPXSvInputStream::isOLEStream()
+{
+ return mpImpl->isOLEStream();
+}
+
+WPXInputStream *WPXSvInputStream::getDocumentOLEStream(const char *name)
+{
+ return mpImpl->getDocumentOLEStream(name);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/stream/WPXSvStream.h b/writerperfect/source/stream/WPXSvStream.h
index 0ed369b060ca..d104c4b341cc 100644
--- a/writerperfect/source/stream/WPXSvStream.h
+++ b/writerperfect/source/stream/WPXSvStream.h
@@ -16,15 +16,7 @@
#include <libwpd-stream/libwpd-stream.h>
-typedef struct
-{
- SotStorageRef ref;
-} SotStorageRefWrapper;
-
-typedef struct
-{
- SotStorageStreamRef ref;
-} SotStorageStreamRefWrapper;
+class WPXSvInputStreamImpl;
class WPXSvInputStream : public WPXInputStream
{
@@ -42,14 +34,7 @@ public:
virtual bool atEOS();
private:
- std::vector< SotStorageRefWrapper > mxChildrenStorages;
- std::vector< SotStorageStreamRefWrapper > mxChildrenStreams;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream > mxStream;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XSeekable > mxSeekable;
- ::com::sun::star::uno::Sequence< sal_Int8 > maData;
- sal_Int64 mnLength;
+ WPXSvInputStreamImpl *mpImpl;
};
#endif