summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/filter/ppt/pptin.cxx7
-rw-r--r--sd/source/filter/ppt/propread.cxx70
-rw-r--r--sd/source/filter/ppt/propread.hxx18
3 files changed, 8 insertions, 87 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 6fc45cc710a4..dbdce84e9b13 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -389,10 +389,11 @@ sal_Bool ImplSdPPTImport::Import()
Dictionary aDict;
if ( pSection->GetDictionary( aDict ) )
{
- sal_uInt32 nPropId = aDict.GetProperty( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_PID_HLINKS" )));
- if ( nPropId )
+ Dictionary::const_iterator iter = aDict.find( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_PID_HLINKS" )));
+
+ if ( iter != aDict.end() )
{
- if ( pSection->GetProperty( nPropId, aPropItem ) )
+ if ( pSection->GetProperty( iter->second, aPropItem ) )
{
aPropItem.Seek( STREAM_SEEK_TO_BEGIN );
aPropItem >> nType;
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 97b9b91430b2..6b6998158be7 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -202,72 +202,6 @@ PropItem& PropItem::operator=( PropItem& rPropItem )
// -----------------------------------------------------------------------
-struct Dict
-{
- sal_uInt32 mnId;
- String aString;
-
- Dict( sal_uInt32 nId, String rString ) { mnId = nId; aString = rString; };
-};
-
-// -----------------------------------------------------------------------
-
-Dictionary::~Dictionary()
-{
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- delete (Dict*)pPtr;
-}
-
-// -----------------------------------------------------------------------
-
-void Dictionary::AddProperty( sal_uInt32 nId, const String& rString )
-{
- if ( rString.Len() ) // eindeutige namen bei properties
- {
- // pruefen, ob es die Propertybeschreibung in der Dictionary schon gibt
- for ( Dict* pDict = (Dict*)First(); pDict; pDict = (Dict*)Next() )
- {
- if ( pDict->mnId == nId )
- {
- pDict->aString = rString;
- return;
- }
- }
- Insert( new Dict( nId, rString ), LIST_APPEND );
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt32 Dictionary::GetProperty( const String& rString )
-{
- for ( Dict* pDict = (Dict*)First(); pDict; pDict = (Dict*)Next() )
- {
- if ( pDict->aString == rString )
- return pDict->mnId;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-Dictionary& Dictionary::operator=( Dictionary& rDictionary )
-{
- void* pPtr;
-
- if ( this != &rDictionary )
- {
- for ( pPtr = First(); pPtr; pPtr = Next() )
- delete (Dict*)pPtr;
-
- for ( pPtr = rDictionary.First(); pPtr; pPtr = rDictionary.Next() )
- Insert( new Dict( ((Dict*)pPtr)->mnId, ((Dict*)pPtr)->aString ), LIST_APPEND );
- }
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
Section::Section( const Section& rSection )
: mnTextEnc(rSection.mnTextEnc),
maEntries(rSection.maEntries.clone())
@@ -343,7 +277,6 @@ sal_Bool Section::GetDictionary( Dictionary& rDict )
{
sal_Bool bRetValue = sal_False;
- Dictionary aDict;
boost::ptr_vector<PropEntry>::iterator iter;
for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
{
@@ -387,12 +320,11 @@ sal_Bool Section::GetDictionary( Dictionary& rDict )
}
if ( !aString.Len() )
break;
- aDict.AddProperty( nId, aString );
+ rDict.insert( std::make_pair(aString,nId) );
}
bRetValue = sal_True;
}
}
- rDict = aDict;
return bRetValue;
}
diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx
index 79b1c27dd174..b925fefe4e96 100644
--- a/sd/source/filter/ppt/propread.hxx
+++ b/sd/source/filter/ppt/propread.hxx
@@ -29,6 +29,7 @@
#ifndef _PROPREAD_HXX_
#define _PROPREAD_HXX_
+#include <map>
#include <boost/ptr_container/ptr_vector.hpp>
#include <tools/solar.h>
@@ -110,6 +111,8 @@
// ------------------------------------------------------------------------
+typedef std::map<String,sal_uInt32> Dictionary;
+
struct PropEntry
{
sal_uInt32 mnId;
@@ -141,21 +144,6 @@ class PropItem : public SvMemoryStream
// ------------------------------------------------------------------------
-class Dictionary : protected List
-{
- friend class Section;
-
- void AddProperty( sal_uInt32 nId, const String& rString );
-
- public :
- Dictionary(){};
- ~Dictionary();
- Dictionary& operator=( Dictionary& rDictionary );
- sal_uInt32 GetProperty( const String& rPropName );
-};
-
-// ------------------------------------------------------------------------
-
class Section
{
sal_uInt16 mnTextEnc;