summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-03-26 08:48:07 -0430
committerKatarina Machalkova <kmachalkova@suse.cz>2011-04-28 11:02:16 +0200
commit08364f64ab0df90909c2daea5b321b92c42466cc (patch)
treec257486d96f34a4717e29537381fa90631fd4447
parent64a817a3e62ea200684a8fd60caa035b4ec7691d (diff)
Remove deprecated List container in PropRead
Moved PropEntry to header.
-rw-r--r--sd/source/filter/ppt/propread.cxx52
-rw-r--r--sd/source/filter/ppt/propread.hxx20
2 files changed, 26 insertions, 46 deletions
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index b2390d57839e..97b9b91430b2 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -34,22 +34,6 @@
#include "rtl/tencinfo.h"
#include "rtl/textenc.h"
-// ------------------------------------------------------------------------
-
-struct PropEntry
-{
- sal_uInt32 mnId;
- sal_uInt32 mnSize;
- sal_uInt16 mnTextEnc;
- sal_uInt8* mpBuf;
-
- PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc );
- PropEntry( const PropEntry& rProp );
- ~PropEntry() { delete[] mpBuf; } ;
-
- const PropEntry& operator=(const PropEntry& rPropEntry);
-};
-
PropEntry::PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc ) :
mnId ( nId ),
mnSize ( nBufSize ),
@@ -631,38 +615,28 @@ PropRead::PropRead( SvStorage& rStorage, const String& rName ) :
void PropRead::AddSection( Section& rSection )
{
- Insert( new Section( rSection ), LIST_APPEND );
+ maSections.push_back( new Section( rSection ) );
}
// -----------------------------------------------------------------------
const Section* PropRead::GetSection( const sal_uInt8* pFMTID )
{
- Section* pSection;
-
- for ( pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
+ boost::ptr_vector<Section>::iterator it;
+ for ( it = maSections.begin(); it != maSections.end(); ++it)
{
- if ( memcmp( pSection->GetFMTID(), pFMTID, 16 ) == 0 )
- break;
+ if ( memcmp( it->GetFMTID(), pFMTID, 16 ) == 0 )
+ return &(*it);
}
- return pSection;
-}
-
-// -----------------------------------------------------------------------
-
-PropRead::~PropRead()
-{
- for ( Section* pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
- delete pSection;
+ return NULL;
}
// -----------------------------------------------------------------------
void PropRead::Read()
{
- for ( Section* pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
- delete pSection;
- Clear();
+ maSections.clear();
+
if ( mbStatus )
{
sal_uInt32 nSections;
@@ -696,10 +670,8 @@ void PropRead::Read()
// -----------------------------------------------------------------------
-PropRead& PropRead::operator=( PropRead& rPropRead )
+PropRead& PropRead::operator=( const PropRead& rPropRead )
{
- Section* pSection;
-
if ( this != &rPropRead )
{
mbStatus = rPropRead.mbStatus;
@@ -711,11 +683,7 @@ PropRead& PropRead::operator=( PropRead& rPropRead )
mnVersionHi = rPropRead.mnVersionHi;
memcpy( mApplicationCLSID, rPropRead.mApplicationCLSID, 16 );
- for ( pSection = (Section*)First(); pSection; pSection = (Section*)Next() )
- delete pSection;
- Clear();
- for ( pSection = (Section*)rPropRead.First(); pSection; pSection = (Section*)rPropRead.Next() )
- Insert( new Section( *pSection ), LIST_APPEND );
+ maSections = rPropRead.maSections.clone();
}
return *this;
}
diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx
index 3385dd37e28f..79b1c27dd174 100644
--- a/sd/source/filter/ppt/propread.hxx
+++ b/sd/source/filter/ppt/propread.hxx
@@ -110,7 +110,19 @@
// ------------------------------------------------------------------------
-class PropEntry;
+struct PropEntry
+{
+ sal_uInt32 mnId;
+ sal_uInt32 mnSize;
+ sal_uInt16 mnTextEnc;
+ sal_uInt8* mpBuf;
+
+ PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc );
+ PropEntry( const PropEntry& rProp );
+ ~PropEntry() { delete[] mpBuf; } ;
+
+ const PropEntry& operator=(const PropEntry& rPropEntry);
+};
class PropItem : public SvMemoryStream
{
@@ -168,7 +180,7 @@ class Section
// ------------------------------------------------------------------------
-class PropRead : private List
+class PropRead
{
sal_Bool mbStatus;
SvStorageStreamRef mpSvStream;
@@ -178,14 +190,14 @@ class PropRead : private List
sal_uInt16 mnVersionLo;
sal_uInt16 mnVersionHi;
sal_uInt8 mApplicationCLSID[ 16 ];
+ boost::ptr_vector<Section> maSections;
void AddSection( Section& rSection );
public:
PropRead( SvStorage& rSvStorage, const String& rName );
- ~PropRead();
- PropRead& operator=( PropRead& rPropRead );
+ PropRead& operator=( const PropRead& rPropRead );
const Section* GetSection( const sal_uInt8* pFMTID );
sal_Bool IsValid() const { return mbStatus; };
void Read();