summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMarcel Metz <mmetz@adrian-broher.net>2011-12-12 16:25:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-12-12 16:25:22 +0000
commit57054f84f66c4d2db8d117a4043e0fbcbd0ee528 (patch)
tree737f6d4080ea9176662c07d9279d33e7ed1b6560 /cui
parent20d6bd273c43a9b8573fa077f6d9d631bd2d53cc (diff)
Related: fdo#38832 Replace Table with std::map
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/pastedlg.cxx20
-rw-r--r--cui/source/inc/pastedlg.hxx4
2 files changed, 14 insertions, 10 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 )
{
diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx
index 93c6ff4f2298..ddf4ccbf3ff9 100644
--- a/cui/source/inc/pastedlg.hxx
+++ b/cui/source/inc/pastedlg.hxx
@@ -29,7 +29,7 @@
#ifndef _PASTEDLG_HXX
#define _PASTEDLG_HXX
-#include <tools/table.hxx>
+#include <map>
#include <sot/formats.hxx>
#include <tools/globname.hxx>
#include <svtools/transfer.hxx>
@@ -60,7 +60,7 @@ class SvPasteObjectDialog : public ModalDialog
OKButton aOKButton1;
CancelButton aCancelButton1;
HelpButton aHelpButton1;
- Table aSupplementTable;
+ ::std::map< SotFormatStringId, String* > aSupplementMap;
SvGlobalName aObjClassName;
String aObjName;
sal_uInt16 nAspect;