summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-07-20 12:54:57 +0200
committerMichael Stahl <mstahl@redhat.com>2015-07-20 13:47:40 +0200
commit144d82434ddbb77bb3cd722bc7b636a612bb9db7 (patch)
tree3e2600bcecc729ad16ec6285fd2b5c26ff258a3a /editeng
parent97a0e7558b24792827d77217fb2d8b1106056963 (diff)
editeng: replace boost::ptr_map with std::map<std::unique_ptr>>
Change-Id: Id59fb4ee59872e60094bde85746416c83f058b00
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/eertfpar.cxx13
-rw-r--r--editeng/source/rtf/svxrtf.cxx21
2 files changed, 17 insertions, 17 deletions
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 2c7e970480dd..ebda6204709b 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -368,7 +368,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
DBG_ASSERT( it != GetStyleTbl().end(), "Template not defined in RTF!" );
if ( it != GetStyleTbl().end() )
{
- SvxRTFStyleType* pS = it->second;
+ auto const& pS = it->second;
mpEditEngine->SetStyleSheet(
EditSelection(aStartPaM, aEndPaM),
static_cast<SfxStyleSheet*>(mpEditEngine->GetStyleSheetPool()->Find(pS->sName, SFX_STYLE_FAMILY_ALL)));
@@ -433,11 +433,10 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
SvxRTFStyleType* EditRTFParser::FindStyleSheet( const OUString& rName )
{
SvxRTFStyleTbl& rTable = GetStyleTbl();
- for ( SvxRTFStyleTbl::iterator it = rTable.begin(); it != rTable.end(); ++it )
+ for (auto const& iter : rTable)
{
- SvxRTFStyleType* pS = it->second;
- if ( pS->sName == rName )
- return pS;
+ if (iter.second->sName == rName)
+ return iter.second.get();
}
return NULL;
}
@@ -456,7 +455,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
SvxRTFStyleTbl::iterator it = GetStyleTbl().find( pRTFStyle->nBasedOn );
if ( it != GetStyleTbl().end())
{
- SvxRTFStyleType* pS = it->second;
+ SvxRTFStyleType *const pS = it->second.get();
if ( pS && ( pS !=pRTFStyle ) )
aParent = pS->sName;
}
@@ -492,7 +491,7 @@ void EditRTFParser::CreateStyleSheets()
{
for (SvxRTFStyleTbl::iterator it = GetStyleTbl().begin(); it != GetStyleTbl().end(); ++it)
{
- SvxRTFStyleType* pRTFStyle = it->second;
+ SvxRTFStyleType* pRTFStyle = it->second.get();
CreateStyleSheet( pRTFStyle );
}
}
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index c4a82217735f..c0f8bedce89f 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -116,7 +116,7 @@ SvParserState SvxRTFParser::CallParser()
ClearColorTbl();
if( !aFontTbl.empty() )
ClearFontTbl();
- if( !aStyleTbl.empty() )
+ if (!m_StyleTable.empty())
ClearStyleTbl();
if( !aAttrStack.empty() )
ClearAttrStack();
@@ -300,7 +300,8 @@ void SvxRTFParser::ReadStyleTable()
int nToken, bSaveChkStyleAttr = bChkStyleAttr ? 1 : 0;
sal_uInt16 nStyleNo = 0;
int _nOpenBrakets = 1; // the first was already detected earlier!!
- SvxRTFStyleType* pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
+ ::std::unique_ptr<SvxRTFStyleType> pStyle(
+ new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] ));
pStyle->aAttrSet.Put( GetRTFDefaults() );
bIsInReadStyleTab = true;
@@ -348,13 +349,13 @@ void SvxRTFParser::ReadStyleTable()
{
pStyle->sName = DelCharAtEnd( aToken, ';' );
- if( !aStyleTbl.empty() )
+ if (!m_StyleTable.empty())
{
- aStyleTbl.erase(nStyleNo);
+ m_StyleTable.erase(nStyleNo);
}
// All data from the font is available, so off to the table
- aStyleTbl.insert( nStyleNo , pStyle);
- pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
+ m_StyleTable.insert(std::make_pair(nStyleNo, std::move(pStyle)));
+ pStyle.reset(new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] ));
pStyle->aAttrSet.Put( GetRTFDefaults() );
nStyleNo = 0;
}
@@ -386,7 +387,7 @@ void SvxRTFParser::ReadStyleTable()
break;
}
}
- delete pStyle; // Delete the Last Style
+ pStyle.reset(); // Delete the Last Style
SkipToken( -1 ); // the closing brace is evaluated "above"
// Flag back to old state
@@ -764,7 +765,7 @@ void SvxRTFParser::ClearFontTbl()
void SvxRTFParser::ClearStyleTbl()
{
- aStyleTbl.clear();
+ m_StyleTable.clear();
}
void SvxRTFParser::ClearAttrStack()
@@ -835,7 +836,7 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType )
if( !IsChkStyleAttr() ||
!rStkType.GetAttrSet().Count() ||
- aStyleTbl.count( rStkType.nStyleNo ) == 0 )
+ m_StyleTable.count( rStkType.nStyleNo ) == 0 )
{
for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )
{
@@ -849,7 +850,7 @@ void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType )
{
// Delete all Attributes, which are already defined in the Style,
// from the current AttrSet.
- SvxRTFStyleType* pStyle = aStyleTbl.find( rStkType.nStyleNo )->second;
+ auto const& pStyle = m_StyleTable.find(rStkType.nStyleNo)->second;
SfxItemSet &rStyleSet = pStyle->aAttrSet;
const SfxPoolItem* pSItem;
for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )