[Libreoffice-commits] core.git: writerperfect/source

Fridrich Å trba fridrich.strba at bluewin.ch
Thu Apr 18 02:44:50 PDT 2013


 writerperfect/source/stream/WPXSvStream.cxx |   93 +++++++++++++++++++++++++---
 writerperfect/source/stream/WPXSvStream.h   |   19 -----
 2 files changed, 87 insertions(+), 25 deletions(-)

New commits:
commit 9d5276b3fb2de81d56e698cc8d32b2869cfb3c55
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Apr 18 11:44:19 2013 +0200

    PImpl the WPXSvInputStream class
    
    Change-Id: I11a3d663e2f5a8f68edd66b7ba2af15cc57287a9

diff --git a/writerperfect/source/stream/WPXSvStream.cxx b/writerperfect/source/stream/WPXSvStream.cxx
index 640ab20..81d6b1b 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 0ed369b..d104c4b 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


More information about the Libreoffice-commits mailing list