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

sw: replace boost::ptr_set with std::set<std::unique_ptr>

Change-Id: Ie4854f8b0d52771a609aee7ba4620c9308424d64
üst 6be72cc2
...@@ -523,12 +523,12 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat, ...@@ -523,12 +523,12 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat,
} }
// Jetzt holen wir das Token und ggf. die Klasse // Jetzt holen wir das Token und ggf. die Klasse
SwHTMLFormatInfo aFormatInfo( &rFormat ); std::unique_ptr<SwHTMLFormatInfo> pTmpInfo(new SwHTMLFormatInfo(&rFormat));
SwHTMLFormatInfo *pFormatInfo; SwHTMLFormatInfo *pFormatInfo;
SwHTMLFormatInfos::iterator it = rHWrt.aTextCollInfos.find( aFormatInfo ); SwHTMLFormatInfos::iterator it = rHWrt.m_TextCollInfos.find( pTmpInfo );
if( it != rHWrt.aTextCollInfos.end() ) if (it != rHWrt.m_TextCollInfos.end())
{ {
pFormatInfo = &*it; pFormatInfo = it->get();
} }
else else
{ {
...@@ -536,7 +536,7 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat, ...@@ -536,7 +536,7 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat,
rHWrt.bCfgOutStyles, rHWrt.eLang, rHWrt.bCfgOutStyles, rHWrt.eLang,
rHWrt.nCSS1Script, rHWrt.nCSS1Script,
false ); false );
rHWrt.aTextCollInfos.insert( pFormatInfo ); rHWrt.m_TextCollInfos.insert(std::unique_ptr<SwHTMLFormatInfo>(pFormatInfo));
if( rHWrt.aScriptParaStyles.count( rFormat.GetName() ) ) if( rHWrt.aScriptParaStyles.count( rFormat.GetName() ) )
pFormatInfo->bScriptDependent = true; pFormatInfo->bScriptDependent = true;
} }
...@@ -1590,17 +1590,17 @@ const SwHTMLFormatInfo *HTMLEndPosLst::GetFormatInfo( const SwFormat& rFormat, ...@@ -1590,17 +1590,17 @@ const SwHTMLFormatInfo *HTMLEndPosLst::GetFormatInfo( const SwFormat& rFormat,
SwHTMLFormatInfos& rFormatInfos ) SwHTMLFormatInfos& rFormatInfos )
{ {
SwHTMLFormatInfo *pFormatInfo; SwHTMLFormatInfo *pFormatInfo;
const SwHTMLFormatInfo aFormatInfo( &rFormat ); std::unique_ptr<SwHTMLFormatInfo> pTmpInfo(new SwHTMLFormatInfo(&rFormat));
SwHTMLFormatInfos::iterator it = rFormatInfos.find( aFormatInfo ); SwHTMLFormatInfos::iterator it = rFormatInfos.find( pTmpInfo );
if( it != rFormatInfos.end() ) if (it != rFormatInfos.end())
{ {
pFormatInfo = &*it; pFormatInfo = it->get();
} }
else else
{ {
pFormatInfo = new SwHTMLFormatInfo( &rFormat, pDoc, pTemplate, pFormatInfo = new SwHTMLFormatInfo( &rFormat, pDoc, pTemplate,
bOutStyles ); bOutStyles );
rFormatInfos.insert( pFormatInfo ); rFormatInfos.insert(std::unique_ptr<SwHTMLFormatInfo>(pFormatInfo));
if ( rScriptTextStyles.count( rFormat.GetName() ) ) if ( rScriptTextStyles.count( rFormat.GetName() ) )
pFormatInfo->bScriptDependent = true; pFormatInfo->bScriptDependent = true;
} }
...@@ -2309,7 +2309,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) ...@@ -2309,7 +2309,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
if( aFormatInfo.pItemSet ) if( aFormatInfo.pItemSet )
{ {
aEndPosLst.Insert( *aFormatInfo.pItemSet, 0, nEnd + nOffset, aEndPosLst.Insert( *aFormatInfo.pItemSet, 0, nEnd + nOffset,
rHTMLWrt.aChrFormatInfos, false, true ); rHTMLWrt.m_CharFormatInfos, false, true );
} }
if( !aOutlineText.isEmpty() || rHTMLWrt.pFormatFootnote ) if( !aOutlineText.isEmpty() || rHTMLWrt.pFormatFootnote )
...@@ -2368,14 +2368,14 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) ...@@ -2368,14 +2368,14 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
if( rHTMLWrt.bWriteAll ) if( rHTMLWrt.bWriteAll )
aEndPosLst.Insert( pHt->GetAttr(), nHtStt + nOffset, aEndPosLst.Insert( pHt->GetAttr(), nHtStt + nOffset,
nHtEnd + nOffset, nHtEnd + nOffset,
rHTMLWrt.aChrFormatInfos ); rHTMLWrt.m_CharFormatInfos );
else else
{ {
sal_Int32 nTmpStt = nHtStt < nStrPos ? nStrPos : nHtStt; sal_Int32 nTmpStt = nHtStt < nStrPos ? nStrPos : nHtStt;
sal_Int32 nTmpEnd = nHtEnd < nEnd ? nHtEnd : nEnd; sal_Int32 nTmpEnd = nHtEnd < nEnd ? nHtEnd : nEnd;
aEndPosLst.Insert( pHt->GetAttr(), nTmpStt + nOffset, aEndPosLst.Insert( pHt->GetAttr(), nTmpStt + nOffset,
nTmpEnd + nOffset, nTmpEnd + nOffset,
rHTMLWrt.aChrFormatInfos ); rHTMLWrt.m_CharFormatInfos );
} }
continue; continue;
// aber nicht ausgeben, das erfolgt spaeter !! // aber nicht ausgeben, das erfolgt spaeter !!
...@@ -2423,7 +2423,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) ...@@ -2423,7 +2423,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
// Bereich aufspannen werden ignoriert // Bereich aufspannen werden ignoriert
aEndPosLst.Insert( pHt->GetAttr(), nStrPos + nOffset, aEndPosLst.Insert( pHt->GetAttr(), nStrPos + nOffset,
*pHt->End() + nOffset, *pHt->End() + nOffset,
rHTMLWrt.aChrFormatInfos ); rHTMLWrt.m_CharFormatInfos );
} }
} }
else else
...@@ -2460,7 +2460,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) ...@@ -2460,7 +2460,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
if( RES_DRAWFRMFMT == pFrameFormat->Which() ) if( RES_DRAWFRMFMT == pFrameFormat->Which() )
aEndPosLst.Insert( *static_cast<const SwDrawFrameFormat *>(pFrameFormat), aEndPosLst.Insert( *static_cast<const SwDrawFrameFormat *>(pFrameFormat),
nStrPos + nOffset, nStrPos + nOffset,
rHTMLWrt.aChrFormatInfos ); rHTMLWrt.m_CharFormatInfos );
} }
aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext ); aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext );
...@@ -2954,22 +2954,22 @@ Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat, ...@@ -2954,22 +2954,22 @@ Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat,
{ {
const SwCharFormat* pFormat = rWrt.pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( const SwCharFormat* pFormat = rWrt.pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool(
RES_POOLCHR_INET_NORMAL ); RES_POOLCHR_INET_NORMAL );
SwHTMLFormatInfo aFormatInfo( pFormat ); std::unique_ptr<SwHTMLFormatInfo> pFormatInfo(new SwHTMLFormatInfo(pFormat));
SwHTMLFormatInfos::const_iterator it = rHTMLWrt.aChrFormatInfos.find( aFormatInfo ); auto const it = rHTMLWrt.m_CharFormatInfos.find( pFormatInfo );
if( it != rHTMLWrt.aChrFormatInfos.end() ) if (it != rHTMLWrt.m_CharFormatInfos.end())
{ {
bScriptDependent = it->bScriptDependent; bScriptDependent = (*it)->bScriptDependent;
} }
} }
if( !bScriptDependent ) if( !bScriptDependent )
{ {
const SwCharFormat* pFormat = rWrt.pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( const SwCharFormat* pFormat = rWrt.pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool(
RES_POOLCHR_INET_VISIT ); RES_POOLCHR_INET_VISIT );
SwHTMLFormatInfo aFormatInfo( pFormat ); std::unique_ptr<SwHTMLFormatInfo> pFormatInfo(new SwHTMLFormatInfo(pFormat));
SwHTMLFormatInfos::const_iterator it = rHTMLWrt.aChrFormatInfos.find( aFormatInfo ); auto const it = rHTMLWrt.m_CharFormatInfos.find( pFormatInfo );
if( it != rHTMLWrt.aChrFormatInfos.end() ) if (it != rHTMLWrt.m_CharFormatInfos.end())
{ {
bScriptDependent = it->bScriptDependent; bScriptDependent = (*it)->bScriptDependent;
} }
} }
...@@ -3113,12 +3113,12 @@ static Writer& OutHTML_SwTextCharFormat( Writer& rWrt, const SfxPoolItem& rHt ) ...@@ -3113,12 +3113,12 @@ static Writer& OutHTML_SwTextCharFormat( Writer& rWrt, const SfxPoolItem& rHt )
return rWrt; return rWrt;
} }
SwHTMLFormatInfo aFormatInfo( pFormat ); std::unique_ptr<SwHTMLFormatInfo> pTmpInfo(new SwHTMLFormatInfo(pFormat));
SwHTMLFormatInfos::const_iterator it = rHTMLWrt.aChrFormatInfos.find( aFormatInfo ); SwHTMLFormatInfos::const_iterator it = rHTMLWrt.m_CharFormatInfos.find(pTmpInfo);
if( it == rHTMLWrt.aChrFormatInfos.end()) if (it == rHTMLWrt.m_CharFormatInfos.end())
return rWrt; return rWrt;
const SwHTMLFormatInfo *pFormatInfo = &*it; const SwHTMLFormatInfo *pFormatInfo = it->get();
OSL_ENSURE( pFormatInfo, "Wieso gint es keine Infos ueber die Zeichenvorlage?" ); OSL_ENSURE( pFormatInfo, "Wieso gint es keine Infos ueber die Zeichenvorlage?" );
if( rHTMLWrt.bTagOn ) if( rHTMLWrt.bTagOn )
......
...@@ -448,11 +448,11 @@ sal_uLong SwHTMLWriter::WriteStream() ...@@ -448,11 +448,11 @@ sal_uLong SwHTMLWriter::WriteStream()
aHTMLControls.DeleteAndDestroyAll(); aHTMLControls.DeleteAndDestroyAll();
if( !aChrFormatInfos.empty() ) if (!m_CharFormatInfos.empty())
aChrFormatInfos.clear(); m_CharFormatInfos.clear();
if( !aTextCollInfos.empty() ) if (!m_TextCollInfos.empty())
aTextCollInfos.clear(); m_TextCollInfos.clear();
if(!aImgMapNames.empty()) if(!aImgMapNames.empty())
aImgMapNames.clear(); aImgMapNames.clear();
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
#define INCLUDED_SW_SOURCE_FILTER_HTML_WRTHTML_HXX #define INCLUDED_SW_SOURCE_FILTER_HTML_WRTHTML_HXX
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_set.hpp> #include <memory>
#include <vector> #include <vector>
#include <set>
#include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/form/XForm.hpp> #include <com/sun/star/form/XForm.hpp>
...@@ -263,7 +264,16 @@ struct SwHTMLFormatInfo ...@@ -263,7 +264,16 @@ struct SwHTMLFormatInfo
}; };
typedef boost::ptr_set<SwHTMLFormatInfo> SwHTMLFormatInfos; struct SwHTMLFormatInfo_Less
{
bool operator()(std::unique_ptr<SwHTMLFormatInfo> const& lhs,
std::unique_ptr<SwHTMLFormatInfo> const& rhs)
{
return (*lhs) < (*rhs);
}
};
typedef std::set<std::unique_ptr<SwHTMLFormatInfo>, SwHTMLFormatInfo_Less> SwHTMLFormatInfos;
class IDocumentStylePoolAccess; class IDocumentStylePoolAccess;
...@@ -296,8 +306,8 @@ public: ...@@ -296,8 +306,8 @@ public:
std::vector<OUString> aOutlineMarks; std::vector<OUString> aOutlineMarks;
std::vector<sal_uInt32> aOutlineMarkPoss; std::vector<sal_uInt32> aOutlineMarkPoss;
HTMLControls aHTMLControls; // die zu schreibenden Forms HTMLControls aHTMLControls; // die zu schreibenden Forms
SwHTMLFormatInfos aChrFormatInfos; SwHTMLFormatInfos m_CharFormatInfos;
SwHTMLFormatInfos aTextCollInfos; SwHTMLFormatInfos m_TextCollInfos;
INetFormats aINetFormats; // die "offenen" INet-Attribute INetFormats aINetFormats; // die "offenen" INet-Attribute
SwHTMLTextFootnotes *pFootEndNotes; SwHTMLTextFootnotes *pFootEndNotes;
......
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