diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-08-10 17:02:47 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2011-08-10 17:07:52 +0200 |
commit | 3721e245b424ea1645174fb9321c0216204ad9b7 (patch) | |
tree | 0ed9733b76495f723cea2abd37004b053f9c733b /writerfilter | |
parent | RTFValue: avoid raw pointers (diff) | |
download | core-3721e245b424ea1645174fb9321c0216204ad9b7.tar.gz core-3721e245b424ea1645174fb9321c0216204ad9b7.zip |
RTFDocumentImpl: avoid raw pointers
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 8 |
2 files changed, 8 insertions, 16 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1210b37c4012..1844726611b1 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -273,7 +273,6 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x m_aObjectSprms(), m_aObjectAttributes(), m_bObject(false), - m_pObjectData(0), m_aFontTableEntries(), m_nCurrentFontIndex(0), m_aStyleTableEntries(), @@ -291,14 +290,12 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x m_pGraphicHelper = new oox::GraphicHelper(m_xContext, xFrame, m_xStorage); - m_pTokenizer = new RTFTokenizer(*this, m_pInStream); - m_pSdrImport = new RTFSdrImport(*this, m_xDstDoc); + m_pTokenizer.reset(new RTFTokenizer(*this, m_pInStream)); + m_pSdrImport.reset(new RTFSdrImport(*this, m_xDstDoc)); } RTFDocumentImpl::~RTFDocumentImpl() { - delete m_pTokenizer; - delete m_pSdrImport; } SvStream& RTFDocumentImpl::Strm() @@ -2646,7 +2643,7 @@ int RTFDocumentImpl::popState() } else if (m_aStates.top().nDestinationState == DESTINATION_OBJDATA) { - m_pObjectData = new SvMemoryStream(); + m_pObjectData.reset(new SvMemoryStream()); int b = 0, count = 2; // Feed the destination text to a stream. @@ -2689,7 +2686,7 @@ int RTFDocumentImpl::popState() *m_pObjectData >> nData; // NativeDataSize } - uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(m_pObjectData)); + uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(m_pObjectData.get())); RTFValue::Pointer_t pStreamValue(new RTFValue(xInputStream)); RTFSprms aOLEAttributes; @@ -2714,11 +2711,6 @@ int RTFDocumentImpl::popState() Mapper().endShape(); m_aObjectAttributes->clear(); m_aObjectSprms->clear(); - if (m_pObjectData) - { - delete m_pObjectData; - m_pObjectData = 0; - } m_bObject = false; } else if (m_aStates.top().nDestinationState == DESTINATION_ANNOTATIONDATE) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index f5506cd147d1..da4831612a15 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -321,8 +321,8 @@ namespace writerfilter { com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties> m_xDocumentProperties; SvStream* m_pInStream; Stream* m_pMapperStream; - RTFSdrImport* m_pSdrImport; - RTFTokenizer* m_pTokenizer; + boost::shared_ptr<RTFSdrImport> m_pSdrImport; + boost::shared_ptr<RTFTokenizer> m_pTokenizer; /// Same as m_aStates.size(), except that this can be negative for invalid input. int m_nGroup; std::stack<RTFParserState> m_aStates; @@ -379,8 +379,8 @@ namespace writerfilter { RTFSprms m_aObjectAttributes; /// If we are in an object group. bool m_bObject; - /// Contents of the objdata group, stored here so we can delete it when we leave the object group. - SvStream* m_pObjectData; + /// Contents of the objdata group. + boost::shared_ptr<SvStream> m_pObjectData; RTFReferenceTable::Entries_t m_aFontTableEntries; int m_nCurrentFontIndex; |