---
cui/source/dialogs/pastedlg.cxx | 20 ++++++++++++--------
cui/source/inc/pastedlg.hxx | 4 ++--
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 47fdf2f..656a813 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 93c6ff4..ddf4ccb 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;
Context
- [Libreoffice] [PATCH 2/4] Replace Table with std::map · Marcel Metz
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.