summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2012-01-08 19:48:36 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2012-01-08 20:11:09 +0100
commiteffeb08efd1746a6a2d911452f38dc9c49685548 (patch)
tree7d5b86b7d53b4996ba8c6a38a3fb5ecf0ad4b7ff
parent717e3912ed94a10c9405ac11c08eff6caba107ea (diff)
Kill SvNullStream duplication
-rw-r--r--filter/inc/filter/msfilter/escherex.hxx3
-rw-r--r--filter/source/msfilter/escherex.cxx31
-rw-r--r--oox/source/export/vmlexport.cxx21
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx2
-rw-r--r--sd/source/filter/eppt/escherex.cxx2
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx21
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2
7 files changed, 36 insertions, 46 deletions
diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx
index 94f700f2ae4c..bfd78364a42c 100644
--- a/filter/inc/filter/msfilter/escherex.hxx
+++ b/filter/inc/filter/msfilter/escherex.hxx
@@ -1560,6 +1560,7 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
EscherExGlobalRef mxGlobal;
ImplEscherExSdrPtr mpImplEscherExSdr;
SvStream* mpOutStrm;
+ bool mbOwnsStrm;
sal_uInt32 mnStrmStartOfs;
std::vector< sal_uInt32 > mOffsets;
std::vector< sal_uInt16 > mRecTypes;
@@ -1578,7 +1579,7 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
virtual sal_Bool DoSeek( sal_uInt32 nKey );
public:
- explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm );
+ explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm );
virtual ~EscherEx();
/** Creates and returns a new shape identifier, updates the internal shape
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 5aac23ddbdd5..6fdbcd4c3773 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -4365,9 +4365,29 @@ SvStream* EscherExGlobal::ImplQueryPictureStream()
return 0;
}
-EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm ) :
+/// Implementation of an empty stream that silently succeeds, but does nothing.
+///
+/// In fact, this is a hack. The right solution is to abstract EscherEx to be
+/// able to work without SvStream; but at the moment it is better to live with
+/// this I guess.
+class SvNullStream : public SvStream
+{
+protected:
+ virtual sal_Size GetData( void* pData, sal_Size nSize ) { memset( pData, 0, nSize ); return nSize; }
+ virtual sal_Size PutData( const void*, sal_Size nSize ) { return nSize; }
+ virtual sal_Size SeekPos( sal_Size nPos ) { return nPos; }
+ virtual void SetSize( sal_Size ) {}
+ virtual void FlushData() {}
+
+public:
+ SvNullStream() : SvStream() {}
+ virtual ~SvNullStream() {}
+};
+
+EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm ) :
mxGlobal ( rxGlobal ),
- mpOutStrm ( &rOutStrm ),
+ mpOutStrm ( pOutStrm ),
+ mbOwnsStrm ( false ),
mnCurrentDg ( 0 ),
@@ -4377,12 +4397,19 @@ EscherEx::EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm ) :
mbEscherSpgr ( sal_False ),
mbEscherDg ( sal_False )
{
+ if (!mpOutStrm)
+ {
+ mpOutStrm = new SvNullStream();
+ mbOwnsStrm = true;
+ }
mnStrmStartOfs = mpOutStrm->Tell();
mpImplEscherExSdr.reset( new ImplEscherExSdr( *this ) );
}
EscherEx::~EscherEx()
{
+ if (mbOwnsStrm)
+ delete mpOutStrm;
}
void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ )
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 554d49faae53..19123815dc79 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -45,27 +45,8 @@ using rtl::OUStringBuffer;
using namespace sax_fastparser;
using namespace oox::vml;
-/// Implementation of an empty stream that silently succeeds, but does nothing.
-///
-/// In fact, this is a hack. The right solution is to abstract EscherEx to be
-/// able to work without SvStream; but at the moment it is better to live with
-/// this I guess.
-class SvNullStream : public SvStream
-{
-protected:
- virtual sal_Size GetData( void* pData, sal_Size nSize ) { memset( pData, 0, nSize ); return nSize; }
- virtual sal_Size PutData( const void*, sal_Size nSize ) { return nSize; }
- virtual sal_Size SeekPos( sal_Size nPos ) { return nPos; }
- virtual void SetSize( sal_Size ) {}
- virtual void FlushData() {}
-
-public:
- SvNullStream() : SvStream() {}
- virtual ~SvNullStream() {}
-};
-
VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer )
- : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), *( new SvNullStream ) ),
+ : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), 0 ),
m_pSerializer( pSerializer ),
m_pShapeAttrList( NULL ),
m_nShapeType( ESCHER_ShpInst_Nil ),
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index e001062b93ef..eea131ac0f15 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -98,7 +98,7 @@ SvStream* XclEscherExGlobal::ImplQueryPictureStream()
// ============================================================================
XclEscherEx::XclEscherEx( const XclExpRoot& rRoot, XclExpObjectManager& rObjMgr, SvStream& rStrm, const XclEscherEx* pParent ) :
- EscherEx( pParent ? pParent->mxGlobal : EscherExGlobalRef( new XclEscherExGlobal( rRoot ) ), rStrm ),
+ EscherEx( pParent ? pParent->mxGlobal : EscherExGlobalRef( new XclEscherExGlobal( rRoot ) ), &rStrm ),
XclExpRoot( rRoot ),
mrObjMgr( rObjMgr ),
pCurrXclObj( NULL ),
diff --git a/sd/source/filter/eppt/escherex.cxx b/sd/source/filter/eppt/escherex.cxx
index d42bc0b74eb2..54ad99c759de 100644
--- a/sd/source/filter/eppt/escherex.cxx
+++ b/sd/source/filter/eppt/escherex.cxx
@@ -35,7 +35,7 @@
// ---------------------------------------------------------------------------------------------
PptEscherEx::PptEscherEx( SvStream& rOutStrm, const rtl::OUString& rBaseURI ) :
- EscherEx( EscherExGlobalRef( new EscherExGlobal ), rOutStrm )
+ EscherEx( EscherExGlobalRef( new EscherExGlobal ), &rOutStrm )
{
mxGlobal->SetBaseURI( rBaseURI );
mnCurrentDg = 0;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index dc1b67b120af..0db8dd24b797 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -40,27 +40,8 @@ using rtl::OUString;
using rtl::OUStringBuffer;
using namespace sw::util;
-/// Implementation of an empty stream that silently succeeds, but does nothing.
-///
-/// In fact, this is a hack. The right solution is to abstract EscherEx to be
-/// able to work without SvStream; but at the moment it is better to live with
-/// this I guess.
-class SvNullStream : public SvStream
-{
-protected:
- virtual sal_Size GetData( void* pData, sal_Size nSize ) { memset( pData, 0, nSize ); return nSize; }
- virtual sal_Size PutData( const void*, sal_Size nSize ) { return nSize; }
- virtual sal_Size SeekPos( sal_Size nPos ) { return nPos; }
- virtual void SetSize( sal_Size ) {}
- virtual void FlushData() {}
-
-public:
- SvNullStream() : SvStream() {}
- virtual ~SvNullStream() {}
-};
-
RtfSdrExport::RtfSdrExport( RtfExport &rExport )
- : EscherEx( EscherExGlobalRef( new EscherExGlobal ), *( new SvNullStream )),
+ : EscherEx( EscherExGlobalRef( new EscherExGlobal ), 0 ),
m_rExport( rExport ),
m_rAttrOutput( (RtfAttributeOutput&)m_rExport.AttrOutput() ),
m_nShapeType( ESCHER_ShpInst_Nil ),
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 143b8242fc33..55294496fb9c 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1306,7 +1306,7 @@ SvStream* SwEscherExGlobal::ImplQueryPictureStream()
}
SwBasicEscherEx::SwBasicEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt)
- : EscherEx( EscherExGlobalRef( new SwEscherExGlobal ), *pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm)
+ : EscherEx( EscherExGlobalRef( new SwEscherExGlobal ), pStrm), rWrt(rWW8Wrt), pEscherStrm(pStrm)
{
Init();
}