diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-21 12:12:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-09-22 11:01:53 +0200 |
commit | 442df6cf8345f8029d5a3b470bc4981a5aa2bf20 (patch) | |
tree | 9efa6f2b29f41d79f968d1e8ad2588c323305776 /xmloff/source/draw/ximppage.cxx | |
parent | a411d7729ab2bed05c3c5d22a8cbcf5dde034b91 (diff) |
ofz: don't leak in face of exceptions
Change-Id: Ic15590a13bd3770ee5dd7db76b21c830a4fe73e2
Reviewed-on: https://gerrit.libreoffice.org/42587
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff/source/draw/ximppage.cxx')
-rw-r--r-- | xmloff/source/draw/ximppage.cxx | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 35deee58ab56..cfa7bfdd3668 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -60,7 +60,7 @@ class DrawAnnotationContext : public SvXMLImportContext public: DrawAnnotationContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess ); - virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override; + virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override; virtual void EndElement() override; private: @@ -130,23 +130,23 @@ DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, sal_uInt16 n } } -SvXMLImportContext * DrawAnnotationContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList ) +SvXMLImportContextRef DrawAnnotationContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList ) { - SvXMLImportContext * pContext = nullptr; + SvXMLImportContextRef xContext; if( mxAnnotation.is() ) { if( XML_NAMESPACE_DC == nPrefix ) { if( IsXMLToken( rLocalName, XML_CREATOR ) ) - pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maAuthorBuffer); + xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maAuthorBuffer); else if( IsXMLToken( rLocalName, XML_DATE ) ) - pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer); + xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer); } else if( (XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix) && IsXMLToken(rLocalName, XML_SENDER_INITIALS) ) { - pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maInitialsBuffer); + xContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maInitialsBuffer); } else { @@ -166,16 +166,16 @@ SvXMLImportContext * DrawAnnotationContext::CreateChildContext( sal_uInt16 nPref // if we have a text cursor, lets try to import some text if( mxCursor.is() ) { - pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList ); + xContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList ); } } } // call parent for content - if(!pContext) - pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); + if (!xContext) + xContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); - return pContext; + return xContext; } void DrawAnnotationContext::EndElement() @@ -242,38 +242,38 @@ void SdXMLGenericPageContext::StartElement( const Reference< css::xml::sax::XAtt GetImport().GetFormImport()->startPage( Reference< drawing::XDrawPage >::query( mxShapes ) ); } -SvXMLImportContext* SdXMLGenericPageContext::CreateChildContext( sal_uInt16 nPrefix, +SvXMLImportContextRef SdXMLGenericPageContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList>& xAttrList ) { - SvXMLImportContext* pContext = nullptr; + SvXMLImportContextRef xContext; if( nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_ANIMATIONS ) ) { - pContext = new XMLAnimationsContext( GetImport(), nPrefix, rLocalName, xAttrList ); + xContext = new XMLAnimationsContext( GetImport(), nPrefix, rLocalName, xAttrList ); } else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_FORMS ) ) { if( GetImport().IsFormsSupported() ) - pContext = xmloff::OFormLayerXMLImport::createOfficeFormsContext( GetImport(), nPrefix, rLocalName ); + xContext = xmloff::OFormLayerXMLImport::createOfficeFormsContext( GetImport(), nPrefix, rLocalName ); } else if( ((nPrefix == XML_NAMESPACE_OFFICE) || (nPrefix == XML_NAMESPACE_OFFICE_EXT)) && IsXMLToken( rLocalName, XML_ANNOTATION ) ) { if( mxAnnotationAccess.is() ) - pContext = new DrawAnnotationContext( GetImport(), nPrefix, rLocalName, xAttrList, mxAnnotationAccess ); + xContext = new DrawAnnotationContext( GetImport(), nPrefix, rLocalName, xAttrList, mxAnnotationAccess ); } else { // call GroupChildContext function at common ShapeImport - pContext = GetImport().GetShapeImport()->CreateGroupChildContext( + xContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShapes); } // call parent when no own context was created - if(!pContext) - pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList); + if (!xContext) + xContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList); - return pContext; + return xContext; } void SdXMLGenericPageContext::EndElement() |