[PATCH] convert svxrtf.hxx in editeng module from table.hxx to std::map
Ivan Timofeev
timofeev.i.s at gmail.com
Mon Feb 20 06:38:04 PST 2012
Hi Noel,
On 14.02.2012 15:25, Noel Grandin wrote:
> Note that I tried converting these usages to boost::ptr_map, but I ran
> into entirely undecipherable C++ template errors.
Sorry for the late review... :(
What line produces that error? I suppose we should do use ptr_map,
because even you forgot to delete object :)
> @@ -385,14 +380,12 @@ void SvxRTFParser::ReadStyleTable()
> {
> pStyle->sName = DelCharAtEnd( aToken, ';' );
>
> - if( aStyleTbl.Count() )
> + if( !aStyleTbl.empty() )
> {
> - SvxRTFStyleType* pOldSt = aStyleTbl.Remove( nStyleNo );
> - if( pOldSt )
> - delete pOldSt;
> + aStyleTbl.erase(nStyleNo);
> }
Also
> @@ -4041,10 +4046,11 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rSt
> if( iter == aTxtCollTbl.end()) // noch nicht vorhanden, also anlegen
> {
> // ist die ueberhaupt als Style vorhanden ?
> - SvxRTFStyleType* pMkStyle = GetStyleTbl().Get( nStyleNo );
> - pNext = pMkStyle
> - ? MakeStyle( nStyleNo, *pMkStyle )
> - : pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
> + SvxRTFStyleTbl::iterator styleIter = GetStyleTbl().find( nStyleNo );
> + if ( styleIter != GetStyleTbl().end() )
> + pNext = MakeStyle( nStyleNo, *styleIter->second );
> + else
> + pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
^^^
should be pNext = pDoc->...
All the best,
Ivan
More information about the LibreOffice
mailing list