summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/rtf/svxrtf.cxx33
-rw-r--r--include/editeng/svxrtf.hxx12
2 files changed, 18 insertions, 27 deletions
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index c0f8bedce89f..2656e44a2f50 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -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 )
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index f96eea6e8d16..c4b1ef73d1f8 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -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: */