summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-03-08 15:53:57 +0200
committerTor Lillqvist <tlillqvist@suse.com>2012-03-08 16:07:22 +0200
commit4b4fb33c606fd068e024669efcbd7ad2aefdaacd (patch)
tree2cea747768a081773303ba0844c0ea0f558530f9 /sw/source/ui
parent1fad074f43e3301420900918881ad1a8b0bc8687 (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/ui')
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx2
-rw-r--r--sw/source/ui/dochdl/gloshdl.cxx4
-rw-r--r--sw/source/ui/shells/textfld.cxx2
-rw-r--r--sw/source/ui/uno/unoatxt.cxx3
4 files changed, 5 insertions, 6 deletions
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index c57df00efd65..54c7c9bdd4b2 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -298,7 +298,7 @@ sal_Bool SwCharURLPage::FillItemSet(SfxItemSet& rSet)
aINetFmt.SetINetFmtId( nId );
aINetFmt.SetINetFmt(nId == RES_POOLCHR_INET_NORMAL ? aEmptyStr : sEntry);
- if( pINetItem && pINetItem->GetMacroTable().Count() )
+ if( pINetItem && !pINetItem->GetMacroTable().empty() )
aINetFmt.SetMacroTbl( &pINetItem->GetMacroTable() );
if(aVisitedLB.GetSavedValue() != aVisitedLB.GetSelectEntryPos())
diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx
index 13d2d2ea2964..6e87f25d12e2 100644
--- a/sw/source/ui/dochdl/gloshdl.cxx
+++ b/sw/source/ui/dochdl/gloshdl.cxx
@@ -628,9 +628,9 @@ void SwGlossaryHdl::SetMacros(const String& rShortName,
: rStatGlossaries.GetGroupDoc( aCurGrp );
SvxMacroTableDtor aMacroTbl;
if( pStart )
- aMacroTbl.Insert( SW_EVENT_START_INS_GLOSSARY, new SvxMacro(*pStart));
+ aMacroTbl.Insert( SW_EVENT_START_INS_GLOSSARY, *pStart);
if( pEnd )
- aMacroTbl.Insert( SW_EVENT_END_INS_GLOSSARY, new SvxMacro(*pEnd));
+ aMacroTbl.Insert( SW_EVENT_END_INS_GLOSSARY, *pEnd);
sal_uInt16 nIdx = pGlos->GetIndex( rShortName );
if( !pGlos->SetMacroTable( nIdx, aMacroTbl ) && pGlos->GetError() )
ErrorHandler::HandleError( pGlos->GetError() );
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index b6d674d2e98c..21b81490774d 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -740,7 +740,7 @@ void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem)
aINetFmt.SetName(rHlnkItem.GetIntName());
if(pMacroTbl)
{
- SvxMacro *pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOVER_OBJECT );
+ const SvxMacro *pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOVER_OBJECT );
if( pMacro )
aINetFmt.SetMacro(SFX_EVENT_MOUSEOVER_OBJECT, *pMacro);
pMacro = pMacroTbl->Get( SFX_EVENT_MOUSECLICK_OBJECT );
diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
index 0b5844ca68a5..e22d01d64c44 100644
--- a/sw/source/ui/uno/unoatxt.cxx
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -1087,8 +1087,7 @@ void SwAutoTextEventDescriptor::replaceByName(
SvxMacroTableDtor aMacroTable;
if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
{
- SvxMacro* pNewMacro = new SvxMacro(rMacro);
- aMacroTable.Replace( nEvent, pNewMacro );
+ aMacroTable.Insert( nEvent, rMacro );
pBlocks->SetMacroTable( nIndex, aMacroTable );
}
}