summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-27 19:57:22 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-27 20:08:45 +0200
commit3ae618f9e4c34d5f6f10d953e3fb074018001748 (patch)
treeff2fb6a6799ff98295c6939c4bf1c8980754e093 /filter
parent7a1fe4a086ba617a43012c6fabf7727a1eb49b43 (diff)
convert SvxMSDffShapeInfos to sorted_vector
... with some fixes from the committer. Change-Id: I9408d8b7c80aff1d1fdb23b852b79bfee7dc4c95
Diffstat (limited to 'filter')
-rw-r--r--filter/inc/filter/msfilter/msdffimp.hxx14
-rw-r--r--filter/source/msfilter/msdffimp.cxx42
2 files changed, 27 insertions, 29 deletions
diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index e127aa8f5107..6b20aaa7aa28 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -32,7 +32,6 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <tools/solar.h>
-#include <svl/svarray.hxx>
#include <tools/color.hxx>
#include <tools/gen.hxx>
#include <svx/msdffdef.hxx>
@@ -46,6 +45,7 @@
#include <set>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_set.hpp>
+#include <o3tl/sorted_vector.hxx>
class Graphic;
class SvStream;
@@ -177,7 +177,6 @@ public:
#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
-typedef SvxMSDffShapeInfo* SvxMSDffShapeInfo_Ptr;
typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
#define SVEXT_PERSIST_STREAM "\002OlePres000"
@@ -191,7 +190,16 @@ public:
};
// the following will be sorted explicitly:
-SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr, 16, MSFILTER_DLLPUBLIC )
+class SvxMSDffShapeInfos
+ : public o3tl::sorted_vector<SvxMSDffShapeInfo*,
+ o3tl::less_ptr_to<SvxMSDffShapeInfo> >
+{
+public:
+ ~SvxMSDffShapeInfos()
+ {
+ DeleteAndDestroyAll();
+ }
+};
#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
#define SVXMSDFF_SETTINGS_IMPORT_PPT 2
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index d29e0db0b658..9e10b63b335a 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5362,10 +5362,10 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
SvxMSDffShapeInfo aTmpRec( 0, pImpRec->nShapeId );
aTmpRec.bSortByShapeId = sal_True;
- sal_uInt16 nFound;
- if( pShapeInfos->Seek_Entry( &aTmpRec, &nFound ) )
+ SvxMSDffShapeInfos::const_iterator it = pShapeInfos->find( &aTmpRec );
+ if( it != pShapeInfos->end() )
{
- SvxMSDffShapeInfo& rInfo = *pShapeInfos->GetObject(nFound);
+ SvxMSDffShapeInfo& rInfo = **it;
pTextImpRec->bReplaceByFly = rInfo.bReplaceByFly;
pTextImpRec->bLastBoxInChain = rInfo.bLastBoxInChain;
}
@@ -5715,13 +5715,6 @@ void SvxMSDffManager::RemoveFromShapeOrder( SdrObject* pObject ) const
//---------------------------------------------------------------------------
-// Hilfs Deklarationen
-//---------------------------------------------------------------------------
-
-SV_IMPL_OP_PTRARR_SORT( SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr );
-
-
-//---------------------------------------------------------------------------
// exported class: Public Methods
//---------------------------------------------------------------------------
@@ -5896,10 +5889,8 @@ void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL )
void SvxMSDffManager::CheckTxBxStoryChain()
{
SvxMSDffShapeInfos* pOld = pShapeInfos;
- sal_uInt16 nCnt = pOld->Count();
- pShapeInfos = new SvxMSDffShapeInfos( (nCnt < 255)
- ? nCnt
- : 255 );
+ sal_uInt16 nCnt = pOld->size();
+ pShapeInfos = new SvxMSDffShapeInfos;
// altes Info-Array ueberarbeiten
// (ist sortiert nach nTxBxComp)
sal_uLong nChain = ULONG_MAX;
@@ -5908,7 +5899,7 @@ void SvxMSDffManager::CheckTxBxStoryChain()
sal_uInt16 nObj;
for( nObj = 0; nObj < nCnt; ++nObj )
{
- SvxMSDffShapeInfo* pObj = pOld->GetObject( nObj );
+ SvxMSDffShapeInfo* pObj = (*pOld)[nObj];
if( pObj->nTxBxComp )
{
pObj->bLastBoxInChain = sal_False;
@@ -5921,7 +5912,7 @@ void SvxMSDffManager::CheckTxBxStoryChain()
{
// voriger war letzter seiner Gruppe
if( nObj )
- pOld->GetObject( nObj-1 )->bLastBoxInChain = sal_True;
+ (*pOld)[ nObj-1 ]->bLastBoxInChain = sal_True;
// Merker und Hilfs-Flag zuruecksetzen
nObjMark = nObj;
nChain = pObj->nTxBxComp;
@@ -5935,7 +5926,7 @@ void SvxMSDffManager::CheckTxBxStoryChain()
bSetReplaceFALSE = sal_True;
// ggfs Flag in Anfang der Gruppe austragen
for( sal_uInt16 nObj2 = nObjMark; nObj2 < nObj; ++nObj2 )
- pOld->GetObject( nObj2 )->bReplaceByFly = sal_False;
+ (*pOld)[ nObj2 ]->bReplaceByFly = sal_False;
}
if( bSetReplaceFALSE )
@@ -5947,13 +5938,13 @@ void SvxMSDffManager::CheckTxBxStoryChain()
// (aber nach nShapeId sortieren)
pObj->bSortByShapeId = sal_True;
pObj->nTxBxComp = pObj->nTxBxComp & 0xFFFF0000;
- pShapeInfos->Insert( pObj );
+ pShapeInfos->insert( pObj );
}
// voriger war letzter seiner Gruppe
if( nObj )
- pOld->GetObject( nObj-1 )->bLastBoxInChain = sal_True;
+ (*pOld)[ nObj-1 ]->bLastBoxInChain = sal_True;
// urspruengliches Array freigeben, ohne Objekte zu zerstoeren
- pOld->Remove((sal_uInt16)0, nCnt);
+ pOld->clear();
delete pOld;
}
@@ -6357,7 +6348,7 @@ sal_Bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
{
aInfo.bReplaceByFly = sal_True;
}
- pShapeInfos->Insert( new SvxMSDffShapeInfo( aInfo ) );
+ pShapeInfos->insert( new SvxMSDffShapeInfo( aInfo ) );
pShapeOrders->push_back( new SvxMSDffShapeOrder( aInfo.nShapeId ) );
}
@@ -6379,11 +6370,9 @@ sal_Bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
SvxMSDffShapeInfo aTmpRec(0, nId);
aTmpRec.bSortByShapeId = sal_True;
- sal_uInt16 nFound;
- if( pShapeInfos->Seek_Entry(&aTmpRec, &nFound) )
+ SvxMSDffShapeInfos::const_iterator it = pShapeInfos->find( &aTmpRec );
+ if( it != pShapeInfos->end() )
{
- SvxMSDffShapeInfo& rInfo = *pShapeInfos->GetObject( nFound );
-
// eventuell altes Errorflag loeschen
if( rStCtrl.GetError() )
rStCtrl.ResetError();
@@ -6391,7 +6380,8 @@ sal_Bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
sal_uLong nOldPosCtrl = rStCtrl.Tell();
sal_uLong nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
// das Shape im Steuer Stream anspringen
- bool bSeeked = (rInfo.nFilePos == rStCtrl.Seek(rInfo.nFilePos));
+ sal_uLong const nFilePos((*it)->nFilePos);
+ bool bSeeked = (nFilePos == rStCtrl.Seek(nFilePos));
// Falls missglueckt, den Fehlerstatus zuruecksetzen und Pech gehabt!
if (!bSeeked || rStCtrl.GetError())