use rtl::Reference in XFSaxAttrList

instead of storing both a raw pointer and an uno::Reference

Change-Id: I227ac624b03a172e10840c4d1e2c4ca0362b33a4
This commit is contained in:
Noel Grandin
2017-01-23 16:09:10 +02:00
parent bd281dc6e1
commit b1211e965a
2 changed files with 14 additions and 17 deletions

View File

@@ -62,24 +62,26 @@
XFSaxAttrList::XFSaxAttrList()
{
m_pSvAttrList = new SvXMLAttributeList();
m_xAttrList.set(m_pSvAttrList);
m_xSvAttrList = new SvXMLAttributeList();
}
XFSaxAttrList::~XFSaxAttrList()
{
//pls don't delete m_pSvAttrList,because when m_xAttrList release,the object will be automatic deleted.
// if( m_pSvAttrList )
// delete m_pSvAttrList;
}
void XFSaxAttrList::AddAttribute(const OUString& name, const OUString& value)
void XFSaxAttrList::AddAttribute(const OUString& name, const OUString& value)
{
m_pSvAttrList->AddAttribute(name,value);
m_xSvAttrList->AddAttribute(name,value);
}
void XFSaxAttrList::Clear()
void XFSaxAttrList::Clear()
{
m_pSvAttrList->Clear();
m_xSvAttrList->Clear();
}
css::uno::Reference<css::xml::sax::XAttributeList> XFSaxAttrList::GetAttributeList() const
{
return m_xSvAttrList.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -61,6 +61,7 @@
#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFSAXATTRLIST_HXX
#include "ixfattrlist.hxx"
#include <rtl/ref.hxx>
#include <xmloff/attrlist.hxx>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
@@ -77,20 +78,14 @@ public:
virtual void Clear() override;
const css::uno::Reference<css::xml::sax::XAttributeList>& GetAttributeList() const;
css::uno::Reference<css::xml::sax::XAttributeList> GetAttributeList() const;
friend class XFSaxStream;
private:
SvXMLAttributeList *m_pSvAttrList;
css::uno::Reference<css::xml::sax::XAttributeList> m_xAttrList;
rtl::Reference<SvXMLAttributeList> m_xSvAttrList;
};
inline const css::uno::Reference<css::xml::sax::XAttributeList>& XFSaxAttrList::GetAttributeList() const
{
return m_xAttrList;
}
#endif //XFSAXATTRLIST_INC
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */