Kaydet (Commit) d2726959 authored tarafından Michael Stahl's avatar Michael Stahl

editeng: replace boost::ptr_map with std::map<std::unique_ptr>>

Change-Id: Ia6fce8eceb364d83cbbf5abcf734be262614e792
üst 144d8243
......@@ -114,7 +114,7 @@ SvParserState SvxRTFParser::CallParser()
if( !aColorTbl.empty() )
ClearColorTbl();
if( !aFontTbl.empty() )
if (!m_FontTable.empty())
ClearFontTbl();
if (!m_StyleTable.empty())
ClearStyleTbl();
......@@ -159,7 +159,7 @@ void SvxRTFParser::NextToken( int nToken )
case RTF_DEFF:
if( bNewDoc )
{
if( !aFontTbl.empty() )
if (!m_FontTable.empty())
// Can immediately be set
SetDefault( nToken, nTokenValue );
else
......@@ -442,7 +442,7 @@ void SvxRTFParser::ReadFontTable()
{
int nToken = 0;
int _nOpenBrakets = 1; // the first was already detected earlier!!
vcl::Font* pFont = new vcl::Font();
std::unique_ptr<vcl::Font> pFont(new vcl::Font);
short nFontNo(0), nInsFontNo (0);
OUString sAltNm, sFntNm;
bool bIsAltFntNm = false;
......@@ -558,15 +558,15 @@ void SvxRTFParser::ReadFontTable()
sFntNm = sFntNm + ";" + sAltNm;
pFont->SetName( sFntNm );
aFontTbl.insert( nInsFontNo, pFont );
pFont = new vcl::Font();
m_FontTable.insert(std::make_pair(nInsFontNo, std::move(pFont)));
pFont.reset(new vcl::Font);
pFont->SetCharSet( nSystemChar );
sAltNm.clear();
sFntNm.clear();
}
}
// the last one we have to delete manually
delete pFont;
pFont.reset();
SkipToken( -1 ); // the closing brace is evaluated "above"
// set the default font in the Document
......@@ -760,7 +760,7 @@ void SvxRTFParser::ClearColorTbl()
void SvxRTFParser::ClearFontTbl()
{
aFontTbl.clear();
m_FontTable.clear();
}
void SvxRTFParser::ClearStyleTbl()
......@@ -793,19 +793,16 @@ OUString& SvxRTFParser::DelCharAtEnd( OUString& rStr, const sal_Unicode cDel )
const vcl::Font& SvxRTFParser::GetFont( sal_uInt16 nId )
{
SvxRTFFontTbl::const_iterator it = aFontTbl.find( nId );
const vcl::Font* pFont;
if( it == aFontTbl.end() )
SvxRTFFontTbl::const_iterator it = m_FontTable.find( nId );
if (it != m_FontTable.end())
{
const SvxFontItem& rDfltFont = static_cast<const SvxFontItem&>(
pAttrPool->GetDefaultItem( aPlainMap.nFont ));
pDfltFont->SetName( rDfltFont.GetStyleName() );
pDfltFont->SetFamily( rDfltFont.GetFamily() );
pFont = pDfltFont;
return *it->second;
}
else
pFont = it->second;
return *pFont;
const SvxFontItem& rDfltFont = static_cast<const SvxFontItem&>(
pAttrPool->GetDefaultItem( aPlainMap.nFont ));
pDfltFont->SetName( rDfltFont.GetStyleName() );
pDfltFont->SetFamily( rDfltFont.GetFamily() );
return *pDfltFont;
}
SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( bool const bCopyAttr )
......
......@@ -31,7 +31,6 @@
#include <map>
#include <utility>
#include <memory>
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
namespace vcl { class Font; }
......@@ -79,7 +78,7 @@ public:
typedef std::deque< Color* > SvxRTFColorTbl;
typedef boost::ptr_map<short, vcl::Font> SvxRTFFontTbl;
typedef std::map<short, std::unique_ptr<vcl::Font>> SvxRTFFontTbl;
typedef std::map<sal_uInt16, std::unique_ptr<SvxRTFStyleType>> SvxRTFStyleTbl;
// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackType* >" type, because
......@@ -170,15 +169,11 @@ struct RTFPardAttrMapIds
};
class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
{
SvStream &rStrm;
SvxRTFColorTbl aColorTbl;
SvxRTFFontTbl aFontTbl;
SvxRTFFontTbl m_FontTable;
SvxRTFStyleTbl m_StyleTable;
SvxRTFItemStack aAttrStack;
SvxRTFItemStackList aAttrSetList;
......@@ -389,7 +384,6 @@ inline SfxItemSet& SvxRTFParser::GetAttrSet()
}
#endif
// INCLUDED_EDITENG_SVXRTF_HXX
#endif // INCLUDED_EDITENG_SVXRTF_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment