diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-26 10:17:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-26 13:01:53 +0100 |
commit | 39ae9d29be0b4308b6e6ab7ee52c3fe6d6dc7d0c (patch) | |
tree | c61e0c7a553190e165e69ba9180f50e69399388d /editeng | |
parent | f49a6361ce4d7dc4efaca0b1701a3ca0e0702eb2 (diff) |
std::unique_ptr -> std::optional
Change-Id: Icd4c818579a7b15454706ab4e02d47e1ac368160
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104796
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index affc44b8f5f2..17ef94553ec5 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -72,13 +72,11 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn ) , bIsInReadStyleTab( false) { pDfltFont.reset( new vcl::Font ); - pDfltColor.reset( new Color ); + mxDefaultColor = Color(); } SvxRTFParser::~SvxRTFParser() { - if( !aColorTbl.empty() ) - ClearColorTbl(); if( !aAttrStack.empty() ) ClearAttrStack(); } @@ -95,7 +93,7 @@ SvParserState SvxRTFParser::CallParser() if( !pInsPos ) return SvParserState::Error; - if( !aColorTbl.empty() ) + if( !maColorTable.empty() ) ClearColorTbl(); m_FontTable.clear(); m_StyleTable.clear(); @@ -422,11 +420,11 @@ void SvxRTFParser::ReadColorTable() { // one color is finished, fill in the table // try to map the values to SV internal names - Color* pColor = new Color( nRed, nGreen, nBlue ); - if( aColorTbl.empty() && + Color aColor( nRed, nGreen, nBlue ); + if( maColorTable.empty() && sal_uInt8(-1) == nRed && sal_uInt8(-1) == nGreen && sal_uInt8(-1) == nBlue ) - *pColor = COL_AUTO; - aColorTbl.push_back( pColor ); + aColor = COL_AUTO; + maColorTable.push_back( aColor ); nRed = 0; nGreen = 0; nBlue = 0; @@ -579,11 +577,7 @@ void SvxRTFParser::ReadFontTable() void SvxRTFParser::ClearColorTbl() { - while ( !aColorTbl.empty() ) - { - delete aColorTbl.back(); - aColorTbl.pop_back(); - } + maColorTable.clear(); } void SvxRTFParser::ClearAttrStack() |