diff options
author | Marcel Metz <mmetz@adrian-broher.net> | 2011-12-12 16:25:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-12-12 16:25:22 +0000 |
commit | 57054f84f66c4d2db8d117a4043e0fbcbd0ee528 (patch) | |
tree | 737f6d4080ea9176662c07d9279d33e7ed1b6560 /cui/source/dialogs | |
parent | 20d6bd273c43a9b8573fa077f6d9d631bd2d53cc (diff) |
Related: fdo#38832 Replace Table with std::map
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r-- | cui/source/dialogs/pastedlg.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx index 47fdf2f05e3a..656a81300b37 100644 --- a/cui/source/dialogs/pastedlg.cxx +++ b/cui/source/dialogs/pastedlg.cxx @@ -112,11 +112,10 @@ void SvPasteObjectDialog::SetDefault() SvPasteObjectDialog::~SvPasteObjectDialog() { - void * pStr = aSupplementTable.First(); - while( pStr ) + ::std::map< SotFormatStringId, String* >::iterator it; + for(it = aSupplementMap.begin(); it != aSupplementMap.end(); ++it) { - delete (String *)pStr; - pStr = aSupplementTable.Next(); + delete it->second; } } @@ -126,7 +125,7 @@ SvPasteObjectDialog::~SvPasteObjectDialog() void SvPasteObjectDialog::Insert( SotFormatStringId nFormat, const String& rFormatName ) { String * pStr = new String( rFormatName ); - if( !aSupplementTable.Insert( nFormat, pStr ) ) + if( !aSupplementMap.insert( ::std::make_pair( nFormat, pStr ) ).second ) delete pStr; } @@ -156,20 +155,25 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper, ::com::sun::star::datatransfer::DataFlavor aFlavor( *aIter ); SotFormatStringId nFormat = (*aIter++).mnSotId; - String* pName = (String*) aSupplementTable.Get( nFormat ); + String* pName = NULL; String aName; + ::std::map< SotFormatStringId, String* >::iterator itName; + 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 - if ( !pName ) + if ( itName == aSupplementMap.end() ) { SvPasteObjectHelper::GetEmbeddedName(rHelper,aName,aSourceName,nFormat); if ( aName.Len() ) pName = &aName; } - + else + { + pName = itName->second; + } if( pName ) { |