summaryrefslogtreecommitdiff
path: root/sw/source/filter/writer/writer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter/writer/writer.cxx')
-rw-r--r--sw/source/filter/writer/writer.cxx77
1 files changed, 38 insertions, 39 deletions
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index d37b8b6ff0a0..d70b6d6c754e 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -58,19 +58,22 @@ DECLARE_TABLE( SwBookmarkNodeTable, SvPtrarr* )
struct Writer_Impl
{
+ SvStream * m_pStream;
+
SvStringsSortDtor *pSrcArr, *pDestArr;
SvPtrarr* pFontRemoveLst, *pBkmkArr;
SwBookmarkNodeTable* pBkmkNodePos;
- Writer_Impl( const SwDoc& rDoc );
+ Writer_Impl();
~Writer_Impl();
void RemoveFontList( SwDoc& rDoc );
void InsertBkmk( const ::sw::mark::IMark& rBkmk );
};
-Writer_Impl::Writer_Impl( const SwDoc& /*rDoc*/ )
- : pSrcArr( 0 ), pDestArr( 0 ), pFontRemoveLst( 0 ), pBkmkNodePos( 0 )
+Writer_Impl::Writer_Impl()
+ : m_pStream(0)
+ , pSrcArr( 0 ), pDestArr( 0 ), pFontRemoveLst( 0 ), pBkmkNodePos( 0 )
{
}
@@ -141,7 +144,8 @@ void Writer_Impl::InsertBkmk(const ::sw::mark::IMark& rBkmk)
*/
Writer::Writer()
- : pImpl(0), pStrm(0), pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0)
+ : m_pImpl(new Writer_Impl)
+ , pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0)
{
bWriteAll = bShowProgress = bUCS2_WithStartChar = true;
bASCII_NoLastLineEnd = bASCII_ParaAsBlanc = bASCII_ParaAsCR =
@@ -164,9 +168,11 @@ const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { re
void Writer::ResetWriter()
{
- if( pImpl && pImpl->pFontRemoveLst )
- pImpl->RemoveFontList( *pDoc );
- delete pImpl, pImpl = 0;
+ if (m_pImpl->pFontRemoveLst)
+ {
+ m_pImpl->RemoveFontList( *pDoc );
+ }
+ m_pImpl.reset(new Writer_Impl);
if( pCurPam )
{
@@ -177,7 +183,6 @@ void Writer::ResetWriter()
pCurPam = 0;
pOrigFileName = 0;
pDoc = 0;
- pStrm = 0;
bShowProgress = bUCS2_WithStartChar = TRUE;
bASCII_NoLastLineEnd = bASCII_ParaAsBlanc = bASCII_ParaAsCR =
@@ -246,13 +251,14 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx,
/////////////////////////////////////////////////////////////////////////////
// Stream-spezifisches
-#ifdef DBG_UTIL
SvStream& Writer::Strm()
{
- ASSERT( pStrm, "Oh-oh. Dies ist ein Storage-Writer. Gleich knallts!" );
- return *pStrm;
+ ASSERT( m_pImpl->m_pStream, "Oh-oh. Writer with no Stream!" );
+ return *m_pImpl->m_pStream;
}
-#endif
+
+void Writer::SetStream(SvStream *const pStream)
+{ m_pImpl->m_pStream = pStream; }
SvStream& Writer::OutHex( SvStream& rStrm, ULONG nHex, BYTE nLen )
@@ -314,10 +320,9 @@ ULONG Writer::Write( SwPaM& rPaM, SvStream& rStrm, const String* pFName )
return nResult;
}
- pStrm = &rStrm;
pDoc = rPaM.GetDoc();
pOrigFileName = pFName;
- pImpl = new Writer_Impl( *pDoc );
+ m_pImpl->m_pStream = &rStrm;
// PaM kopieren, damit er veraendert werden kann
pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() );
@@ -368,20 +373,20 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm )
INET_PROT_NEWS >= aTargetUrl.GetProtocol() ) )
return bRet;
- if( pImpl->pSrcArr )
+ if (m_pImpl->pSrcArr)
{
// wurde die Datei schon verschoben
USHORT nPos;
- if( pImpl->pSrcArr->Seek_Entry( &rFileNm, &nPos ))
+ if (m_pImpl->pSrcArr->Seek_Entry( &rFileNm, &nPos ))
{
- rFileNm = *(*pImpl->pDestArr)[ nPos ];
+ rFileNm = *(*m_pImpl->pDestArr)[ nPos ];
return TRUE;
}
}
else
{
- pImpl->pSrcArr = new SvStringsSortDtor( 4, 4 );
- pImpl->pDestArr = new SvStringsSortDtor( 4, 4 );
+ m_pImpl->pSrcArr = new SvStringsSortDtor( 4, 4 );
+ m_pImpl->pDestArr = new SvStringsSortDtor( 4, 4 );
}
String *pSrc = new String( rFileNm );
@@ -400,8 +405,8 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm )
if( bRet )
{
- pImpl->pSrcArr->Insert( pSrc );
- pImpl->pDestArr->Insert( pDest );
+ m_pImpl->pSrcArr->Insert( pSrc );
+ m_pImpl->pDestArr->Insert( pDest );
rFileNm = *pDest;
}
else
@@ -415,9 +420,6 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm )
void Writer::PutNumFmtFontsInAttrPool()
{
- if( !pImpl )
- pImpl = new Writer_Impl( *pDoc );
-
// dann gibt es noch in den NumRules ein paar Fonts
// Diese in den Pool putten. Haben sie danach einen RefCount > 1
// kann es wieder entfernt werden - ist schon im Pool
@@ -457,9 +459,6 @@ void Writer::PutNumFmtFontsInAttrPool()
void Writer::PutEditEngFontsInAttrPool( BOOL bIncl_CJK_CTL )
{
- if( !pImpl )
- pImpl = new Writer_Impl( *pDoc );
-
SfxItemPool& rPool = pDoc->GetAttrPool();
if( rPool.GetSecondaryPool() )
{
@@ -474,9 +473,6 @@ void Writer::PutEditEngFontsInAttrPool( BOOL bIncl_CJK_CTL )
void Writer::PutCJKandCTLFontsInAttrPool()
{
- if( !pImpl )
- pImpl = new Writer_Impl( *pDoc );
-
SfxItemPool& rPool = pDoc->GetAttrPool();
_AddFontItems( rPool, RES_CHRATR_CJK_FONT );
_AddFontItems( rPool, RES_CHRATR_CTL_FONT );
@@ -513,11 +509,13 @@ void Writer::_AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont )
rPool.Remove( *pItem );
else
{
- if( !pImpl->pFontRemoveLst )
- pImpl->pFontRemoveLst = new SvPtrarr( 0, 10 );
+ if (!m_pImpl->pFontRemoveLst)
+ {
+ m_pImpl->pFontRemoveLst = new SvPtrarr( 0, 10 );
+ }
void* p = (void*)pItem;
- pImpl->pFontRemoveLst->Insert( p, pImpl->pFontRemoveLst->Count() );
+ m_pImpl->pFontRemoveLst->Insert( p, m_pImpl->pFontRemoveLst->Count() );
}
}
@@ -529,7 +527,9 @@ void Writer::CreateBookmarkTbl()
for(IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getBookmarksBegin();
ppBkmk != pMarkAccess->getBookmarksEnd();
++ppBkmk)
- pImpl->InsertBkmk(**ppBkmk);
+ {
+ m_pImpl->InsertBkmk(**ppBkmk);
+ }
}
@@ -540,7 +540,8 @@ USHORT Writer::GetBookmarks(const SwCntntNode& rNd, xub_StrLen nStt,
ASSERT( !rArr.Count(), "es sind noch Eintraege vorhanden" );
ULONG nNd = rNd.GetIndex();
- SvPtrarr* pArr = pImpl->pBkmkNodePos ? pImpl->pBkmkNodePos->Get( nNd ) : 0;
+ SvPtrarr* pArr = (m_pImpl->pBkmkNodePos) ?
+ m_pImpl->pBkmkNodePos->Get( nNd ) : 0;
if( pArr )
{
// there exist some bookmarks, search now all which is in the range
@@ -586,11 +587,10 @@ ULONG StgWriter::WriteStream()
ULONG StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName )
{
- pStrm = 0;
+ SetStream(0);
pStg = &rStg;
pDoc = rPaM.GetDoc();
pOrigFileName = pFName;
- pImpl = new Writer_Impl( *pDoc );
// PaM kopieren, damit er veraendert werden kann
pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() );
@@ -607,12 +607,11 @@ ULONG StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName )
ULONG StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const String* pFName, SfxMedium* pMedium )
{
- pStrm = 0;
+ SetStream(0);
pStg = 0;
xStg = rStg;
pDoc = rPaM.GetDoc();
pOrigFileName = pFName;
- pImpl = new Writer_Impl( *pDoc );
// PaM kopieren, damit er veraendert werden kann
pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() );