summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-12-12 16:32:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-12-12 16:32:34 +0000
commitd6e21fd53cda06460f2c1611ef5d0744132d87bc (patch)
tree69e4176245c969e96683f5a89418e0b0416f777c /cui
parent57054f84f66c4d2db8d117a4043e0fbcbd0ee528 (diff)
now with an STL map we don't have to do our own mem allocation
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/pastedlg.cxx22
-rw-r--r--cui/source/inc/pastedlg.hxx2
2 files changed, 9 insertions, 15 deletions
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 656a81300b37..99cb18709094 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -112,11 +112,6 @@ void SvPasteObjectDialog::SetDefault()
SvPasteObjectDialog::~SvPasteObjectDialog()
{
- ::std::map< SotFormatStringId, String* >::iterator it;
- for(it = aSupplementMap.begin(); it != aSupplementMap.end(); ++it)
- {
- delete it->second;
- }
}
/*************************************************************************
@@ -124,9 +119,7 @@ SvPasteObjectDialog::~SvPasteObjectDialog()
*************************************************************************/
void SvPasteObjectDialog::Insert( SotFormatStringId nFormat, const String& rFormatName )
{
- String * pStr = new String( rFormatName );
- if( !aSupplementMap.insert( ::std::make_pair( nFormat, pStr ) ).second )
- delete pStr;
+ aSupplementMap.insert( ::std::make_pair( nFormat, rFormatName ) );
}
sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
@@ -155,15 +148,15 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
::com::sun::star::datatransfer::DataFlavor aFlavor( *aIter );
SotFormatStringId nFormat = (*aIter++).mnSotId;
- String* pName = NULL;
- String aName;
- ::std::map< SotFormatStringId, String* >::iterator itName;
- itName = aSupplementMap.find( nFormat );
+ ::std::map< SotFormatStringId, String >::iterator itName =
+ aSupplementMap.find( nFormat );
// if there is an "Embed Source" or and "Embedded Object" on the
// Clipboard we read the Description and the Source of this object
// from an accompanied "Object Descriptor" format on the clipboard
// Remember: these formats mostly appear together on the clipboard
+ String aName;
+ const String* pName = NULL;
if ( itName == aSupplementMap.end() )
{
SvPasteObjectHelper::GetEmbeddedName(rHelper,aName,aSourceName,nFormat);
@@ -172,7 +165,7 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
}
else
{
- pName = itName->second;
+ pName = &(itName->second);
}
if( pName )
@@ -181,7 +174,8 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
if( SOT_FORMATSTR_ID_EMBED_SOURCE == nFormat )
{
- if( aDesc.maClassName != aEmptyNm ) {
+ if( aDesc.maClassName != aEmptyNm )
+ {
aSourceName = aDesc.maDisplayName;
if( aDesc.maClassName == aObjClassName )
diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx
index ddf4ccbf3ff9..21dee342f4f3 100644
--- a/cui/source/inc/pastedlg.hxx
+++ b/cui/source/inc/pastedlg.hxx
@@ -60,7 +60,7 @@ class SvPasteObjectDialog : public ModalDialog
OKButton aOKButton1;
CancelButton aCancelButton1;
HelpButton aHelpButton1;
- ::std::map< SotFormatStringId, String* > aSupplementMap;
+ ::std::map< SotFormatStringId, String > aSupplementMap;
SvGlobalName aObjClassName;
String aObjName;
sal_uInt16 nAspect;