summaryrefslogtreecommitdiff
path: root/sd/source/filter/ppt
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-03-26 08:44:54 -0430
committerKatarina Machalkova <kmachalkova@suse.cz>2011-04-28 11:00:14 +0200
commit64a817a3e62ea200684a8fd60caa035b4ec7691d (patch)
tree44a50ac635b1962c68a3654fdd01b6a8767650ff /sd/source/filter/ppt
parentf3570d924bcb999090ba78d47b9354cb529df55e (diff)
Remove deprecated List container from Section.
Diffstat (limited to 'sd/source/filter/ppt')
-rw-r--r--sd/source/filter/ppt/propread.cxx65
-rw-r--r--sd/source/filter/ppt/propread.hxx12
2 files changed, 34 insertions, 43 deletions
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 150acf381c4d..b2390d57839e 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -284,14 +284,12 @@ Dictionary& Dictionary::operator=( Dictionary& rDictionary )
// -----------------------------------------------------------------------
-Section::Section( Section& rSection )
-: List()
+Section::Section( const Section& rSection )
+ : mnTextEnc(rSection.mnTextEnc),
+ maEntries(rSection.maEntries.clone())
{
- mnTextEnc = rSection.mnTextEnc;
for ( int i = 0; i < 16; i++ )
aFMTID[ i ] = rSection.aFMTID[ i ];
- for ( PropEntry* pProp = (PropEntry*)rSection.First(); pProp; pProp = (PropEntry*)rSection.Next() )
- Insert( new PropEntry( *pProp ), LIST_APPEND );
}
// -----------------------------------------------------------------------
@@ -307,19 +305,20 @@ Section::Section( const sal_uInt8* pFMTID )
sal_Bool Section::GetProperty( sal_uInt32 nId, PropItem& rPropItem )
{
- PropEntry* pProp;
if ( nId )
{
- for ( pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
+ boost::ptr_vector<PropEntry>::const_iterator iter;
+ for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
{
- if ( pProp->mnId == nId )
+ if (iter->mnId == nId)
break;
}
- if ( pProp )
+
+ if (iter != maEntries.end())
{
rPropItem.Clear();
rPropItem.SetTextEncoding( mnTextEnc );
- rPropItem.Write( pProp->mpBuf, pProp->mnSize );
+ rPropItem.Write( iter->mpBuf,iter->mnSize );
rPropItem.Seek( STREAM_SEEK_TO_BEGIN );
return sal_True;
}
@@ -339,18 +338,19 @@ void Section::AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBu
nId = 0;
// keine doppelten PropId's zulassen, sortieren
- for ( sal_uInt32 i = 0; i < Count(); i++ )
+ boost::ptr_vector<PropEntry>::iterator iter;
+ for ( iter = maEntries.begin(); iter != maEntries.end(); ++iter )
{
- PropEntry* pPropEntry = (PropEntry*)GetObject( i );
- if ( pPropEntry->mnId == nId )
- delete (PropEntry*)Replace( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ), i );
- else if ( pPropEntry->mnId > nId )
- Insert( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ), i );
+ if ( iter->mnId == nId )
+ maEntries.replace( iter, new PropEntry( nId, pBuf, nBufSize, mnTextEnc ));
+ else if ( iter->mnId > nId )
+ maEntries.insert( iter, new PropEntry( nId, pBuf, nBufSize, mnTextEnc ));
else
continue;
return;
}
- Insert( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ), LIST_APPEND );
+
+ maEntries.push_back( new PropEntry( nId, pBuf, nBufSize, mnTextEnc ) );
}
// -----------------------------------------------------------------------
@@ -360,17 +360,17 @@ sal_Bool Section::GetDictionary( Dictionary& rDict )
sal_Bool bRetValue = sal_False;
Dictionary aDict;
- PropEntry* pProp;
-
- for ( pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
+ boost::ptr_vector<PropEntry>::iterator iter;
+ for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
{
- if ( pProp->mnId == 0 )
+ if ( iter->mnId == 0 )
break;
}
- if ( pProp )
+
+ if ( iter != maEntries.end() )
{
sal_uInt32 nDictCount, nId, nSize, nPos;
- SvMemoryStream aStream( (sal_Int8*)pProp->mpBuf, pProp->mnSize, STREAM_READ );
+ SvMemoryStream aStream( (sal_Int8*)iter->mpBuf, iter->mnSize, STREAM_READ );
aStream.Seek( STREAM_SEEK_TO_BEGIN );
aStream >> nDictCount;
for ( sal_uInt32 i = 0; i < nDictCount; i++ )
@@ -414,14 +414,6 @@ sal_Bool Section::GetDictionary( Dictionary& rDict )
// -----------------------------------------------------------------------
-Section::~Section()
-{
- for ( PropEntry* pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
- delete pProp;
-}
-
-// -----------------------------------------------------------------------
-
void Section::Read( SvStorageStream *pStrm )
{
sal_uInt32 i, nSecOfs, nSecSize, nPropCount, nPropId, nPropOfs, nPropType, nPropSize, nCurrent, nVectorCount, nTemp, nStrmSize;
@@ -603,18 +595,13 @@ void Section::Read( SvStorageStream *pStrm )
// -----------------------------------------------------------------------
-Section& Section::operator=( Section& rSection )
+Section& Section::operator=( const Section& rSection )
{
- PropEntry* pProp;
-
if ( this != &rSection )
{
memcpy( (void*)aFMTID, (void*)rSection.aFMTID, 16 );
- for ( pProp = (PropEntry*)First(); pProp; pProp = (PropEntry*)Next() )
- delete pProp;
- Clear();
- for ( pProp = (PropEntry*)rSection.First(); pProp; pProp = (PropEntry*)rSection.Next() )
- Insert( new PropEntry( *pProp ), LIST_APPEND );
+
+ maEntries = rSection.maEntries.clone();
}
return *this;
}
diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx
index 9adbd89aeb3e..3385dd37e28f 100644
--- a/sd/source/filter/ppt/propread.hxx
+++ b/sd/source/filter/ppt/propread.hxx
@@ -29,6 +29,8 @@
#ifndef _PROPREAD_HXX_
#define _PROPREAD_HXX_
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <tools/solar.h>
#include <sot/storage.hxx>
#include <tools/gen.hxx>
@@ -108,6 +110,8 @@
// ------------------------------------------------------------------------
+class PropEntry;
+
class PropItem : public SvMemoryStream
{
sal_uInt16 mnTextEnc;
@@ -140,9 +144,10 @@ class Dictionary : protected List
// ------------------------------------------------------------------------
-class Section : private List
+class Section
{
sal_uInt16 mnTextEnc;
+ boost::ptr_vector<PropEntry> maEntries;
protected:
@@ -152,10 +157,9 @@ class Section : private List
public:
Section( const sal_uInt8* pFMTID );
- Section( Section& rSection );
- ~Section();
+ Section( const Section& rSection );
- Section& operator=( Section& rSection );
+ Section& operator=( const Section& rSection );
sal_Bool GetProperty( sal_uInt32 nId, PropItem& rPropItem );
sal_Bool GetDictionary( Dictionary& rDict );
const sal_uInt8* GetFMTID() const { return aFMTID; };