diff options
author | Noel Grandin <noel@peralex.com> | 2012-03-08 15:53:57 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-03-08 16:07:22 +0200 |
commit | 4b4fb33c606fd068e024669efcbd7ad2aefdaacd (patch) | |
tree | 2cea747768a081773303ba0844c0ea0f558530f9 /sw/source/filter/html | |
parent | 1fad074f43e3301420900918881ad1a8b0bc8687 (diff) |
Convert from tools/table.hxx to std::map in SvxMacroTableDtor
In this case, we also convert from storing pointers to storing
the items directly because SvxMacroTableDtor completely controls
the lifecycle of the SvxMacro objects it contains.
Also add an operator== to SvxMacroTableDtor and remove the out-of-line
implementations of equals from two other places.
Diffstat (limited to 'sw/source/filter/html')
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlbas.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/html/htmlfly.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/html/htmlgrin.cxx | 7 |
5 files changed, 22 insertions, 24 deletions
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 25b3b1132ff1..9d153124bcaf 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -3036,7 +3036,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO String aURL( rINetFmt.GetValue() ); const SvxMacroTableDtor *pMacTable = rINetFmt.GetMacroTbl(); - sal_Bool bEvents = pMacTable != 0 && pMacTable->Count() > 0; + sal_Bool bEvents = pMacTable != 0 && !pMacTable->empty(); // Gibt es ueberhaupt etwas auszugeben? if( !aURL.Len() && !bEvents && !rINetFmt.GetName().Len() ) diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 5fbd867d6d76..182d9a25aca2 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -342,10 +342,13 @@ void SwHTMLWriter::OutBasicBodyEvents() { SvxMacro* pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( ::rtl::OUString::createFromAscii(aEventNames[i]) ), pDocSh, sal_True ); if ( pMacro ) - pDocTable->Insert( aBodyEventTable[i].nEvent, pMacro ); + { + pDocTable->Insert( aBodyEventTable[i].nEvent, *pMacro ); + delete pMacro; + } } - if( pDocTable && pDocTable->Count() ) + if( pDocTable && !pDocTable->empty() ) HTMLOutFuncs::Out_Events( Strm(), *pDocTable, aBodyEventTable, bCfgStarBasic, eDestEnc, &aNonConvertableCharacters ); } diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index e03b1d4d3f1d..419699295237 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -1017,7 +1017,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, aName = pURLItem->GetName(); aTarget = pURLItem->GetTargetFrameName(); } - sal_Bool bEvents = pMacItem && pMacItem->GetMacroTable().Count(); + sal_Bool bEvents = pMacItem && !pMacItem->GetMacroTable().empty(); if( aMapURL.Len() || aName.Len() || aTarget.Len() || bEvents ) { @@ -1059,7 +1059,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( pMacItem ) { const SvxMacroTableDtor& rMacTable = pMacItem->GetMacroTable(); - if( rMacTable.Count() ) + if( !rMacTable.empty() ) HTMLOutFuncs::Out_Events( rWrt.Strm(), rMacTable, aAnchorEventTable, rHTMLWrt.bCfgStarBasic, @@ -1161,7 +1161,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, { const SvxMacroTableDtor& rMacTable = ((const SvxMacroItem *)pItem)->GetMacroTable(); - if( rMacTable.Count() ) + if( !rMacTable.empty() ) HTMLOutFuncs::Out_Events( rWrt.Strm(), rMacTable, aImageEventTable, rHTMLWrt.bCfgStarBasic, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index d0afc811e096..8cdb4bf44819 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -437,7 +437,7 @@ SwHTMLImageWatcher::SwHTMLImageWatcher( OSL_ENSURE( xSrc.is(), "Kein XImageProducerSupplier" ); // Als Event-Listener am Shape anmelden, damit wir es beim dispose - // loslassen ko”nnen ... + // loslassen ko”nnen ... uno::Reference< XEventListener > xEvtLstnr = (XEventListener *)this; uno::Reference< XComponent > xComp( xShape, UNO_QUERY ); xComp->addEventListener( xEvtLstnr ); @@ -1293,7 +1293,7 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl( // auch schon Fokus-Events verschickt. Damit die nicht evtl. schon // vorhendene JavaSCript-Eents rufen, werden die Events nachtraeglich // gesetzt. - if( rMacroTbl.Count() || !rUnoMacroTbl.empty() ) + if( !rMacroTbl.empty() || !rUnoMacroTbl.empty() ) { lcl_html_setEvents( pFormImpl->GetControlEventManager(), rFormComps->getCount() - 1, @@ -1393,8 +1393,7 @@ void SwHTMLParser::NewForm( sal_Bool bAppend ) String aScriptType2; if( EXTENDED_STYPE==eScriptType2 ) aScriptType2 = rDfltScriptType; - aMacroTbl.Insert( nEvent, new SvxMacro( sEvent, aScriptType2, - eScriptType2 ) ); + aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType2, eScriptType2 ) ); } } } @@ -1456,7 +1455,7 @@ void SwHTMLParser::NewForm( sal_Bool bAppend ) pFormImpl->GetForms(); Any aAny( &xForm, ::getCppuType((uno::Reference< XForm>*)0) ); rForms->insertByIndex( rForms->getCount(), aAny ); - if( aMacroTbl.Count() ) + if( !aMacroTbl.empty() ) lcl_html_setEvents( pFormImpl->GetFormEventManager(), rForms->getCount() - 1, aMacroTbl, aUnoMacroTbl, aUnoMacroParamTbl, @@ -1625,8 +1624,7 @@ void SwHTMLParser::InsertInput() String aScriptType2; if( EXTENDED_STYPE==eScriptType2 ) aScriptType2 = rDfltScriptType; - aMacroTbl.Insert( nEvent, new SvxMacro( sEvent, aScriptType2, - eScriptType2 ) ); + aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType2, eScriptType2 ) ); } } } @@ -1764,11 +1762,11 @@ void SwHTMLParser::InsertInput() OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultState")), aTmp ); } - SvxMacro *pMacro = aMacroTbl.Get( HTML_ET_ONCLICK ); + const SvxMacro* pMacro = aMacroTbl.Get( HTML_ET_ONCLICK ); if( pMacro ) { - aMacroTbl.Remove( HTML_ET_ONCLICK ); - aMacroTbl.Insert( HTML_ET_ONCLICK_ITEM, pMacro ); + aMacroTbl.Insert( HTML_ET_ONCLICK_ITEM, *pMacro ); + aMacroTbl.Erase( HTML_ET_ONCLICK ); } // SIZE auszuwerten duerfte hier keinen Sinn machen??? bMinWidth = bMinHeight = sal_True; @@ -2091,8 +2089,7 @@ void SwHTMLParser::NewTextArea() sEvent = convertLineEnd(sEvent, GetSystemLineEnd()); if( EXTENDED_STYPE==eScriptType2 ) aScriptType = rDfltScriptType; - aMacroTbl.Insert( nEvent, new SvxMacro( sEvent, aScriptType, - eScriptType2 ) ); + aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType, eScriptType2 ) ); } } } @@ -2371,8 +2368,7 @@ void SwHTMLParser::NewSelect() sEvent = convertLineEnd(sEvent, GetSystemLineEnd()); if( EXTENDED_STYPE==eScriptType2 ) aScriptType = rDfltScriptType; - aMacroTbl.Insert( nEvent, new SvxMacro( sEvent, aScriptType, - eScriptType2 ) ); + aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType, eScriptType2 ) ); } } } diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 88fc7058ea03..1607d6807ace 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -781,7 +781,7 @@ IMAGE_SETEVENT: } - if( aMacroItem.GetMacroTable().Count() ) + if( !aMacroItem.GetMacroTable().empty() ) pFlyFmt->SetFmtAttr( aMacroItem ); // Wenn die Grafik gleich angeforder wird, muss dies geschehen, @@ -1114,8 +1114,7 @@ ANCHOR_SETEVENT: String sScriptType; if( EXTENDED_STYPE == eScriptType2 ) sScriptType = sDfltScriptType; - aMacroTbl.Insert( nEvent, - new SvxMacro( sTmp, sScriptType, eScriptType2 )); + aMacroTbl.Insert( nEvent, SvxMacro( sTmp, sScriptType, eScriptType2 )); } } break; @@ -1207,7 +1206,7 @@ ANCHOR_SETEVENT: SwFmtINetFmt aINetFmt( sHRef, sTarget ); aINetFmt.SetName( aName ); - if( aMacroTbl.Count() ) + if( !aMacroTbl.empty() ) aINetFmt.SetMacroTbl( &aMacroTbl ); // das Default-Attribut setzen |