diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-01-07 13:01:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-07 17:45:03 +0100 |
commit | e1383444c6d00f5d0b1d507670517f45988b9cc7 (patch) | |
tree | 5304b99014f1b2236456923a3e98b2c0dbf31511 /xmloff/source/style | |
parent | 0f4dd820ee433932d9d9237b676292d31c4ba913 (diff) |
extract some common code from ImportContext classes
which reduces code bloat, and lets us log when elements are ignored
Change-Id: I5ca12bc1fcbfa3bea49ebde819fd80bd233a96a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86338
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/FillStyleContext.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/PageHeaderFooterContext.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/XMLBackgroundImageContext.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfi.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumi.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/style/xmlprcon.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/style/xmlstyle.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/xmltabi.cxx | 4 |
8 files changed, 7 insertions, 45 deletions
diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx index 1cb513ce6b50..bc81cd92d5da 100644 --- a/xmloff/source/style/FillStyleContext.cxx +++ b/xmloff/source/style/FillStyleContext.cxx @@ -148,10 +148,6 @@ SvXMLImportContextRef XMLBitmapStyleContext::CreateChildContext( sal_uInt16 nPre mxBase64Stream ); } } - if( !pContext ) - { - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } return pContext; } diff --git a/xmloff/source/style/PageHeaderFooterContext.cxx b/xmloff/source/style/PageHeaderFooterContext.cxx index b4c95261e0ad..fe9689ae3f5f 100644 --- a/xmloff/source/style/PageHeaderFooterContext.cxx +++ b/xmloff/source/style/PageHeaderFooterContext.cxx @@ -67,9 +67,6 @@ SvXMLImportContextRef PageHeaderFooterContext::CreateChildContext( sal_uInt16 nP rMap, nStartIndex, nEndIndex, aType); } - if (!xContext) - xContext = new SvXMLImportContext( GetImport(), nPrefix, rLName ); - return xContext; } diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx index b9ccb73c9c1a..a2c48e00a5b8 100644 --- a/xmloff/source/style/XMLBackgroundImageContext.cxx +++ b/xmloff/source/style/XMLBackgroundImageContext.cxx @@ -365,10 +365,6 @@ SvXMLImportContextRef XMLBackgroundImageContext::CreateChildContext( m_xBase64Stream ); } } - if( !pContext ) - { - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } return pContext; } diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index d014b658750a..d74353bcf314 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -604,11 +604,11 @@ SvXMLNumFmtMapContext::SvXMLNumFmtMapContext( SvXMLImport& rImport, } SvXMLImportContextRef SvXMLNumFmtMapContext::CreateChildContext( - sal_uInt16 nPrfx, const OUString& rLName, + sal_uInt16 /*nPrfx*/, const OUString& /*rLName*/, const uno::Reference<xml::sax::XAttributeList>& ) { // no elements supported - use default context - return new SvXMLImportContext( GetImport(), nPrfx, rLName ); + return nullptr; } void SvXMLNumFmtMapContext::Characters( const OUString& ) @@ -1055,8 +1055,7 @@ SvXMLImportContextRef SvXMLNumFmtElementContext::CreateChildContext( { return new SvXMLNumFmtEmbeddedTextContext( GetImport(), nPrfx, rLName, *this, xAttrList ); } - else - return new SvXMLImportContext( GetImport(), nPrfx, rLName ); + return nullptr; } void SvXMLNumFmtElementContext::Characters( const OUString& rChars ) @@ -1551,8 +1550,6 @@ SvXMLImportContextRef SvXMLNumFormatContext::CreateChildContext( break; } - if( !pContext ) - pContext = new SvXMLImportContext( GetImport(), nPrfx, rLName ); return pContext; } diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 1ea6831d07b8..c1cea0e9cf0c 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -390,10 +390,6 @@ SvXMLImportContextRef SvxXMLListLevelStyleContext_Impl::CreateChildContext( xBase64Stream ); } } - if( !pContext ) - { - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } return pContext; } @@ -912,10 +908,6 @@ SvXMLImportContextRef SvxXMLListLevelStyleAttrContext_Impl::CreateChildContext( xAttrList, rListLevel ); } - if( !pContext ) - { - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } return pContext; } @@ -1070,10 +1062,6 @@ SvXMLImportContextRef SvxXMLListStyleContext::CreateChildContext( xContext = xLevelStyle.get(); } - else - { - xContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } return xContext; } diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx index 0ff6b531c697..813dcb3b3dcd 100644 --- a/xmloff/source/style/xmlprcon.cxx +++ b/xmloff/source/style/xmlprcon.cxx @@ -70,10 +70,7 @@ SvXMLImportContextRef SvXMLPropertySetContext::CreateChildContext( return CreateChildContext( nPrefix, rLocalName, xAttrList, mrProperties, aProp ); } - else - { - return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } + return nullptr; } /** This method is called from this instance implementation of @@ -81,13 +78,13 @@ SvXMLImportContextRef SvXMLPropertySetContext::CreateChildContext( SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT */ SvXMLImportContextRef SvXMLPropertySetContext::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, const uno::Reference< xml::sax::XAttributeList >&, ::std::vector< XMLPropertyState > &, const XMLPropertyState& ) { - return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); + return nullptr; } diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 8d32d38396f2..352eba7cee7f 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -772,11 +772,6 @@ SvXMLImportContextRef SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix mpImpl->AddStyle( pStyle ); pContext = pStyle; } - else - { - pContext = new SvXMLImportContext( GetImport(), nPrefix, - rLocalName ); - } return pContext; } diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx index 1ad85eb3cfb3..27880a177e91 100644 --- a/xmloff/source/style/xmltabi.cxx +++ b/xmloff/source/style/xmltabi.cxx @@ -181,10 +181,6 @@ SvXMLImportContextRef SvxXMLTabStopImportContext::CreateChildContext( pContext = xTabStopContext.get(); } - else - { - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - } return pContext; } |