summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-10 10:00:08 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-12 14:12:32 +0200
commit1384ccd692a80f78458a7b7cd818bbd010007bab (patch)
tree08fb3e7c012f63dbcce8a1dccea483d85768365a
parent8edb5996089a24c6eb0509a7ee4d108a23203752 (diff)
Convert SV_DECL_PTRARR_SORT_VISIBILITY(SvxMSDffShapeTxBxSort) to std::set
Change-Id: I94b2cccff386ccf331ca670df17d7a738e026879
-rw-r--r--filter/inc/filter/msfilter/msdffimp.hxx15
-rw-r--r--filter/source/msfilter/msdffimp.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx26
3 files changed, 24 insertions, 19 deletions
diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index 162667152ff0..24137ad8001a 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -190,9 +190,8 @@ public:
~SvxMSDffShapeOrders();
};
-// the following two will be sorted explicitly:
+// the following will be sorted explicitly:
SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr, 16, MSFILTER_DLLPUBLIC )
-SV_DECL_PTRARR_SORT_VISIBILITY( SvxMSDffShapeTxBxSort, SvxMSDffShapeOrder*, 16, MSFILTER_DLLPUBLIC )
#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
#define SVXMSDFF_SETTINGS_IMPORT_PPT 2
@@ -864,12 +863,20 @@ struct SvxMSDffShapeOrder
SvxMSDffShapeOrder( sal_uLong nId ):
nShapeId( nId ), nTxBxComp( 0 ), pFly( 0 ), nHdFtSection( 0 ), pObj( 0 ){}
- sal_Bool operator==( const SvxMSDffShapeOrder& rEntry ) const
+ bool operator==( const SvxMSDffShapeOrder& rEntry ) const
{ return (nTxBxComp == rEntry.nTxBxComp); }
- sal_Bool operator<( const SvxMSDffShapeOrder& rEntry ) const
+ bool operator<( const SvxMSDffShapeOrder& rEntry ) const
{ return (nTxBxComp < rEntry.nTxBxComp); }
};
+// the following will be sorted explicitly:
+struct CompareSvxMSDffShapeTxBxSort
+{
+ bool operator()( SvxMSDffShapeOrder* const& lhs, SvxMSDffShapeOrder* const& rhs ) const { return (*lhs)<(*rhs); }
+};
+class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort : public std::set<SvxMSDffShapeOrder*,CompareSvxMSDffShapeTxBxSort> {};
+
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 0effc0c113ab..d29e0db0b658 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5720,8 +5720,6 @@ void SvxMSDffManager::RemoveFromShapeOrder( SdrObject* pObject ) const
SV_IMPL_OP_PTRARR_SORT( SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr );
-SV_IMPL_OP_PTRARR_SORT( SvxMSDffShapeTxBxSort, SvxMSDffShapeOrder* );
-
//---------------------------------------------------------------------------
// exported class: Public Methods
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index ee8219c65b4e..5c8abf363f01 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4595,40 +4595,40 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
for (sal_uInt16 nShapeNum=0; nShapeNum < nShapeCount; nShapeNum++)
{
- const SvxMSDffShapeOrder *pOrder =
+ SvxMSDffShapeOrder *pOrder =
(*pMSDffManager->GetShapeOrders())[nShapeNum];
// Pointer in neues Sort-Array einfuegen
if (pOrder->nTxBxComp && pOrder->pFly)
- aTxBxSort.Insert(pOrder);
+ aTxBxSort.insert(pOrder);
}
// zu verkettende Rahmen jetzt verketten
- sal_uInt16 nTxBxCount = aTxBxSort.Count();
- if( nTxBxCount )
+ if( !aTxBxSort.empty() )
{
SwFmtChain aChain;
- for (sal_uInt16 nTxBxNum=0; nTxBxNum < nTxBxCount; nTxBxNum++)
+ for( SvxMSDffShapeTxBxSort::iterator it = aTxBxSort.begin(); it != aTxBxSort.end(); ++it )
{
- SvxMSDffShapeOrder *pOrder =
- aTxBxSort.GetObject(nTxBxNum);
+ SvxMSDffShapeOrder *pOrder = *it;
// Fly-Frame-Formate initialisieren
SwFlyFrmFmt* pFlyFmt = pOrder->pFly;
SwFlyFrmFmt* pNextFlyFmt = 0;
SwFlyFrmFmt* pPrevFlyFmt = 0;
// ggfs. Nachfolger ermitteln
- if( 1+nTxBxNum < nTxBxCount )
+ SvxMSDffShapeTxBxSort::iterator tmpIter1 = it;
+ tmpIter1++;
+ if( tmpIter1 != aTxBxSort.end() )
{
- SvxMSDffShapeOrder *pNextOrder =
- aTxBxSort.GetObject(nTxBxNum+1);
+ SvxMSDffShapeOrder *pNextOrder = *tmpIter1;
if ((0xFFFF0000 & pOrder->nTxBxComp)
== (0xFFFF0000 & pNextOrder->nTxBxComp))
pNextFlyFmt = pNextOrder->pFly;
}
// ggfs. Vorgaenger ermitteln
- if( nTxBxNum )
+ if( it != aTxBxSort.begin() )
{
- SvxMSDffShapeOrder *pPrevOrder =
- aTxBxSort.GetObject(nTxBxNum-1);
+ SvxMSDffShapeTxBxSort::iterator tmpIter2 = it;
+ tmpIter2--;
+ SvxMSDffShapeOrder *pPrevOrder = *tmpIter2;
if ((0xFFFF0000 & pOrder->nTxBxComp)
== (0xFFFF0000 & pPrevOrder->nTxBxComp))
pPrevFlyFmt = pPrevOrder->pFly;