diff options
author | Noel Grandin <noel@peralex.com> | 2012-04-24 17:49:25 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-09 08:52:56 +0200 |
commit | e79a62e1be9a1c10ac84b10a23b5b10362732d0a (patch) | |
tree | ca89078f0721453ed2a0dcbc987b04ff9951df58 /sw/source/filter/html | |
parent | 420e3e21c57a5a49b3ff8fd9fe47cddbdcc4286e (diff) |
Convert SV_DECL_PTRARR_SORT_DEL(SwHTMLFmtInfos) to boost::ptr_set
I had to move "struct SwHTMLFmtInfo" from htmlatr.cxx to
wrthtml.hxx because there are clear() calls in wrthtml.cxx
and ptr_set needs the full declaration to be visible.
Diffstat (limited to 'sw/source/filter/html')
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 88 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 50 |
3 files changed, 72 insertions, 74 deletions
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 9affe001517c..02b34694837f 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -259,54 +259,6 @@ SwHTMLTxtCollOutputInfo::~SwHTMLTxtCollOutputInfo() delete pItemSet; } -struct SwHTMLFmtInfo -{ - const SwFmt *pFmt; // das Format selbst - const SwFmt *pRefFmt; // das Vergleichs-Format - - rtl::OString aToken; // das auszugebende Token - String aClass; // die auszugebende Klasse - - SfxItemSet *pItemSet; // der auszugebende Attribut-Set - - sal_Int32 nLeftMargin; // ein par default-Werte fuer - sal_Int32 nRightMargin; // Absatz-Vorlagen - short nFirstLineIndent; - - sal_uInt16 nTopMargin; - sal_uInt16 nBottomMargin; - - sal_Bool bScriptDependent; - - // Konstruktor fuer einen Dummy zum Suchen - SwHTMLFmtInfo( const SwFmt *pF ) : - pFmt( pF ), pRefFmt(0), pItemSet( 0 ), nFirstLineIndent(0) - {} - - - // Konstruktor zum Erstellen der Format-Info - SwHTMLFmtInfo( const SwFmt *pFmt, SwDoc *pDoc, SwDoc *pTemlate, - sal_Bool bOutStyles, LanguageType eDfltLang=LANGUAGE_DONTKNOW, - sal_uInt16 nScript=CSS1_OUTMODE_ANY_SCRIPT, - sal_Bool bHardDrop=sal_False ); - ~SwHTMLFmtInfo(); - - friend sal_Bool operator==( const SwHTMLFmtInfo& rInfo1, - const SwHTMLFmtInfo& rInfo2 ) - { - return (long)rInfo1.pFmt == (long)rInfo2.pFmt; - } - - friend sal_Bool operator<( const SwHTMLFmtInfo& rInfo1, - const SwHTMLFmtInfo& rInfo2 ) - { - return (long)rInfo1.pFmt < (long)rInfo2.pFmt; - } - -}; - -SV_IMPL_OP_PTRARR_SORT( SwHTMLFmtInfos, SwHTMLFmtInfo* ) - SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, sal_Bool bOutStyles, LanguageType eDfltLang, @@ -597,11 +549,11 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // Jetzt holen wir das Token und ggf. die Klasse SwHTMLFmtInfo aFmtInfo( &rFmt ); - sal_uInt16 nArrayPos; - const SwHTMLFmtInfo *pFmtInfo; - if( rHWrt.aTxtCollInfos.Seek_Entry( &aFmtInfo, &nArrayPos ) ) + SwHTMLFmtInfo *pFmtInfo; + SwHTMLFmtInfos::iterator it = rHWrt.aTxtCollInfos.find( aFmtInfo ); + if( it != rHWrt.aTxtCollInfos.end() ) { - pFmtInfo = rHWrt.aTxtCollInfos[nArrayPos]; + pFmtInfo = &*it; } else { @@ -609,7 +561,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, rHWrt.bCfgOutStyles, rHWrt.eLang, rHWrt.nCSS1Script, false ); - rHWrt.aTxtCollInfos.C40_PTR_INSERT( SwHTMLFmtInfo, pFmtInfo ); + rHWrt.aTxtCollInfos.insert( pFmtInfo ); String aName( rFmt.GetName() ); if( 0 != rHWrt.aScriptParaStyles.count( aName ) ) ((SwHTMLFmtInfo *)pFmtInfo)->bScriptDependent = sal_True; @@ -1698,18 +1650,18 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, xub_StrLen nStart, const SwHTMLFmtInfo *HTMLEndPosLst::GetFmtInfo( const SwFmt& rFmt, SwHTMLFmtInfos& rFmtInfos ) { - const SwHTMLFmtInfo *pFmtInfo; - SwHTMLFmtInfo aFmtInfo( &rFmt ); - sal_uInt16 nPos; - if( rFmtInfos.Seek_Entry( &aFmtInfo, &nPos ) ) + SwHTMLFmtInfo *pFmtInfo; + const SwHTMLFmtInfo aFmtInfo( &rFmt ); + SwHTMLFmtInfos::iterator it = rFmtInfos.find( aFmtInfo ); + if( it != rFmtInfos.end() ) { - pFmtInfo = rFmtInfos[nPos]; + pFmtInfo = &*it; } else { pFmtInfo = new SwHTMLFmtInfo( &rFmt, pDoc, pTemplate, bOutStyles ); - rFmtInfos.C40_PTR_INSERT( SwHTMLFmtInfo, pFmtInfo ); + rFmtInfos.insert( pFmtInfo ); String aName( rFmt.GetName() ); if( 0 != rScriptTxtStyles.count( aName ) ) ((SwHTMLFmtInfo *)pFmtInfo)->bScriptDependent = sal_True; @@ -3004,10 +2956,10 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO const SwCharFmt* pFmt = rWrt.pDoc->GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ); SwHTMLFmtInfo aFmtInfo( pFmt ); - sal_uInt16 nPos; - if( rHTMLWrt.aChrFmtInfos.Seek_Entry( &aFmtInfo, &nPos ) ) + SwHTMLFmtInfos::const_iterator it = rHTMLWrt.aChrFmtInfos.find( aFmtInfo ); + if( it != rHTMLWrt.aChrFmtInfos.end() ) { - bScriptDependent = rHTMLWrt.aChrFmtInfos[nPos]->bScriptDependent; + bScriptDependent = it->bScriptDependent; } } if( !bScriptDependent ) @@ -3015,10 +2967,10 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO const SwCharFmt* pFmt = rWrt.pDoc->GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ); SwHTMLFmtInfo aFmtInfo( pFmt ); - sal_uInt16 nPos; - if( rHTMLWrt.aChrFmtInfos.Seek_Entry( &aFmtInfo, &nPos ) ) + SwHTMLFmtInfos::const_iterator it = rHTMLWrt.aChrFmtInfos.find( aFmtInfo ); + if( it != rHTMLWrt.aChrFmtInfos.end() ) { - bScriptDependent = rHTMLWrt.aChrFmtInfos[nPos]->bScriptDependent; + bScriptDependent = it->bScriptDependent; } } @@ -3162,11 +3114,11 @@ static Writer& OutHTML_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt ) } SwHTMLFmtInfo aFmtInfo( pFmt ); - sal_uInt16 nPos; - if( !rHTMLWrt.aChrFmtInfos.Seek_Entry( &aFmtInfo, &nPos ) ) + SwHTMLFmtInfos::const_iterator it = rHTMLWrt.aChrFmtInfos.find( aFmtInfo ); + if( it == rHTMLWrt.aChrFmtInfos.end()) return rWrt; - const SwHTMLFmtInfo *pFmtInfo = rHTMLWrt.aChrFmtInfos[nPos]; + const SwHTMLFmtInfo *pFmtInfo = &*it; OSL_ENSURE( pFmtInfo, "Wieso gint es keine Infos ueber die Zeichenvorlage?" ); if( rHTMLWrt.bTagOn ) diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 346247f05949..0b24ee8bd03d 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -386,11 +386,11 @@ sal_uLong SwHTMLWriter::WriteStream() if( aHTMLControls.Count() ) aHTMLControls.DeleteAndDestroy( sal_uInt16(0), aHTMLControls.Count() ); - if( aChrFmtInfos.Count() ) - aChrFmtInfos.DeleteAndDestroy( sal_uInt16(0), aChrFmtInfos.Count() ); + if( !aChrFmtInfos.empty() ) + aChrFmtInfos.clear(); - if( aTxtCollInfos.Count() ) - aTxtCollInfos.DeleteAndDestroy( sal_uInt16(0), aTxtCollInfos.Count() ); + if( !aTxtCollInfos.empty() ) + aTxtCollInfos.clear(); if(!aImgMapNames.empty()) aImgMapNames.clear(); diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 3b45a3cb7d54..e659b8f6cecf 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -29,6 +29,7 @@ #define _WRTHTML_HXX #include <boost/ptr_container/ptr_vector.hpp> +#include <boost/ptr_container/ptr_set.hpp> #include <vector> #include <com/sun/star/container/XIndexContainer.hpp> @@ -192,8 +193,53 @@ struct HTMLControl; SV_DECL_PTRARR_SORT_DEL( HTMLControls, HTMLControl*, 1 ) typedef std::vector<SwFmtINetFmt*> INetFmts; -struct SwHTMLFmtInfo; -SV_DECL_PTRARR_SORT_DEL( SwHTMLFmtInfos, SwHTMLFmtInfo*, 1 ) +struct SwHTMLFmtInfo +{ + const SwFmt *pFmt; // das Format selbst + const SwFmt *pRefFmt; // das Vergleichs-Format + + rtl::OString aToken; // das auszugebende Token + String aClass; // die auszugebende Klasse + + SfxItemSet *pItemSet; // der auszugebende Attribut-Set + + sal_Int32 nLeftMargin; // ein par default-Werte fuer + sal_Int32 nRightMargin; // Absatz-Vorlagen + short nFirstLineIndent; + + sal_uInt16 nTopMargin; + sal_uInt16 nBottomMargin; + + sal_Bool bScriptDependent; + + // Konstruktor fuer einen Dummy zum Suchen + SwHTMLFmtInfo( const SwFmt *pF ) : + pFmt( pF ), pRefFmt(0), pItemSet( 0 ), nFirstLineIndent(0) + {} + + + // Konstruktor zum Erstellen der Format-Info + SwHTMLFmtInfo( const SwFmt *pFmt, SwDoc *pDoc, SwDoc *pTemlate, + sal_Bool bOutStyles, LanguageType eDfltLang=LANGUAGE_DONTKNOW, + sal_uInt16 nScript=CSS1_OUTMODE_ANY_SCRIPT, + sal_Bool bHardDrop=sal_False ); + ~SwHTMLFmtInfo(); + + friend sal_Bool operator==( const SwHTMLFmtInfo& rInfo1, + const SwHTMLFmtInfo& rInfo2 ) + { + return (long)rInfo1.pFmt == (long)rInfo2.pFmt; + } + + friend sal_Bool operator<( const SwHTMLFmtInfo& rInfo1, + const SwHTMLFmtInfo& rInfo2 ) + { + return (long)rInfo1.pFmt < (long)rInfo2.pFmt; + } + +}; + +typedef boost::ptr_set<SwHTMLFmtInfo> SwHTMLFmtInfos; class IDocumentStylePoolAccess; |