diff options
-rw-r--r-- | include/xmloff/txtimppr.hxx | 9 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 72 |
2 files changed, 41 insertions, 40 deletions
diff --git a/include/xmloff/txtimppr.hxx b/include/xmloff/txtimppr.hxx index bd1338fd1884..3786de22f478 100644 --- a/include/xmloff/txtimppr.hxx +++ b/include/xmloff/txtimppr.hxx @@ -21,6 +21,7 @@ #include <xmloff/dllapi.h> #include <xmloff/xmlimppr.hxx> +#include <memory> class XMLFontStylesContext; @@ -42,10 +43,10 @@ class XMLOFF_DLLPUBLIC XMLTextImportPropertyMapper : public SvXMLImportPropertyM XMLPropertyState const * pFontFamily, XMLPropertyState const * pFontPitch, XMLPropertyState const * pFontCharSet, - XMLPropertyState** ppNewFontStyleName, - XMLPropertyState** ppNewFontFamily, - XMLPropertyState** ppNewFontPitch, - XMLPropertyState** ppNewFontCharSet ) const; + std::unique_ptr<XMLPropertyState>* ppNewFontStyleName, + std::unique_ptr<XMLPropertyState>* ppNewFontFamily, + std::unique_ptr<XMLPropertyState>* ppNewFontPitch, + std::unique_ptr<XMLPropertyState>* ppNewFontCharSet ) const; protected: virtual bool handleSpecialItem( diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index a3303594ce7b..ee41e82b40be 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -187,10 +187,10 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( XMLPropertyState const * pFontFamily, XMLPropertyState const * pFontPitch, XMLPropertyState const * pFontCharSet, - XMLPropertyState** ppNewFontStyleName, - XMLPropertyState** ppNewFontFamily, - XMLPropertyState** ppNewFontPitch, - XMLPropertyState** ppNewFontCharSet ) const + std::unique_ptr<XMLPropertyState>* ppNewFontStyleName, + std::unique_ptr<XMLPropertyState>* ppNewFontFamily, + std::unique_ptr<XMLPropertyState>* ppNewFontPitch, + std::unique_ptr<XMLPropertyState>* ppNewFontCharSet ) const { if( pFontFamilyName ) { @@ -204,8 +204,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( pFontFamilyName->mnIndex + 1 ); assert(nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL); #endif - *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1, - aAny ); + ppNewFontStyleName->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 1, + aAny )); } if( !pFontFamily ) @@ -217,8 +217,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( pFontFamilyName->mnIndex + 2 ); assert(nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL); #endif - *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2, - aAny ); + ppNewFontFamily->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 2, + aAny )); } if( !pFontPitch ) @@ -229,8 +229,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( pFontFamilyName->mnIndex + 3 ); assert(nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL); #endif - *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3, - aAny ); + ppNewFontPitch->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 3, + aAny )); } if( !pFontCharSet ) @@ -241,8 +241,8 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck( pFontFamilyName->mnIndex + 4 ); assert(nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL); #endif - *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4, - aAny ); + ppNewFontCharSet->reset(new XMLPropertyState( pFontFamilyName->mnIndex + 4, + aAny )); } } @@ -366,28 +366,28 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pFontFamily = nullptr; XMLPropertyState* pFontPitch = nullptr; XMLPropertyState* pFontCharSet = nullptr; - XMLPropertyState* pNewFontStyleName = nullptr; - XMLPropertyState* pNewFontFamily = nullptr; - XMLPropertyState* pNewFontPitch = nullptr; - XMLPropertyState* pNewFontCharSet = nullptr; + std::unique_ptr<XMLPropertyState> pNewFontStyleName; + std::unique_ptr<XMLPropertyState> pNewFontFamily; + std::unique_ptr<XMLPropertyState> pNewFontPitch; + std::unique_ptr<XMLPropertyState> pNewFontCharSet; XMLPropertyState* pFontFamilyNameCJK = nullptr; XMLPropertyState* pFontStyleNameCJK = nullptr; XMLPropertyState* pFontFamilyCJK = nullptr; XMLPropertyState* pFontPitchCJK = nullptr; XMLPropertyState* pFontCharSetCJK = nullptr; - XMLPropertyState* pNewFontStyleNameCJK = nullptr; - XMLPropertyState* pNewFontFamilyCJK = nullptr; - XMLPropertyState* pNewFontPitchCJK = nullptr; - XMLPropertyState* pNewFontCharSetCJK = nullptr; + std::unique_ptr<XMLPropertyState> pNewFontStyleNameCJK; + std::unique_ptr<XMLPropertyState> pNewFontFamilyCJK; + std::unique_ptr<XMLPropertyState> pNewFontPitchCJK; + std::unique_ptr<XMLPropertyState> pNewFontCharSetCJK; XMLPropertyState* pFontFamilyNameCTL = nullptr; XMLPropertyState* pFontStyleNameCTL = nullptr; XMLPropertyState* pFontFamilyCTL = nullptr; XMLPropertyState* pFontPitchCTL = nullptr; XMLPropertyState* pFontCharSetCTL = nullptr; - XMLPropertyState* pNewFontStyleNameCTL = nullptr; - XMLPropertyState* pNewFontFamilyCTL = nullptr; - XMLPropertyState* pNewFontPitchCTL = nullptr; - XMLPropertyState* pNewFontCharSetCTL = nullptr; + std::unique_ptr<XMLPropertyState> pNewFontStyleNameCTL; + std::unique_ptr<XMLPropertyState> pNewFontFamilyCTL; + std::unique_ptr<XMLPropertyState> pNewFontPitchCTL; + std::unique_ptr<XMLPropertyState> pNewFontCharSetCTL; XMLPropertyState* pAllBorderDistance = nullptr; XMLPropertyState* pBorderDistances[4] = { nullptr, nullptr, nullptr, nullptr }; XMLPropertyState* pNewBorderDistances[4] = { nullptr, nullptr, nullptr, nullptr }; @@ -685,73 +685,73 @@ void XMLTextImportPropertyMapper::finished( if( pNewFontStyleName ) { rProperties.push_back( *pNewFontStyleName ); - delete pNewFontStyleName; + pNewFontStyleName.reset(); } if( pNewFontFamily ) { rProperties.push_back( *pNewFontFamily ); - delete pNewFontFamily; + pNewFontFamily.reset(); } if( pNewFontPitch ) { rProperties.push_back( *pNewFontPitch ); - delete pNewFontPitch; + pNewFontPitch.reset(); } if( pNewFontCharSet ) { rProperties.push_back( *pNewFontCharSet ); - delete pNewFontCharSet; + pNewFontCharSet.reset(); } if( pNewFontStyleNameCJK ) { rProperties.push_back( *pNewFontStyleNameCJK ); - delete pNewFontStyleNameCJK; + pNewFontStyleNameCJK.reset(); } if( pNewFontFamilyCJK ) { rProperties.push_back( *pNewFontFamilyCJK ); - delete pNewFontFamilyCJK; + pNewFontFamilyCJK.reset(); } if( pNewFontPitchCJK ) { rProperties.push_back( *pNewFontPitchCJK ); - delete pNewFontPitchCJK; + pNewFontPitchCJK.reset(); } if( pNewFontCharSetCJK ) { rProperties.push_back( *pNewFontCharSetCJK ); - delete pNewFontCharSetCJK; + pNewFontCharSetCJK.reset(); } if( pNewFontStyleNameCTL) { rProperties.push_back( *pNewFontStyleNameCTL ); - delete pNewFontStyleNameCTL; + pNewFontStyleNameCTL.reset(); } if( pNewFontFamilyCTL ) { rProperties.push_back( *pNewFontFamilyCTL ); - delete pNewFontFamilyCTL; + pNewFontFamilyCTL.reset(); } if( pNewFontPitchCTL ) { rProperties.push_back( *pNewFontPitchCTL ); - delete pNewFontPitchCTL; + pNewFontPitchCTL.reset(); } if( pNewFontCharSetCTL ) { rProperties.push_back( *pNewFontCharSetCTL ); - delete pNewFontCharSetCTL; + pNewFontCharSetCTL.reset(); } for (sal_uInt16 i=0; i<4; i++) |