summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-04-15 00:16:52 +0200
committerMichael Stahl <mstahl@redhat.com>2012-04-18 15:30:04 +0200
commitb06d5cc4c234e3495833263192e694c0e9fc0533 (patch)
tree3fdc001dcad54e1a6d5d809d67961ce1fd890426 /xmloff
parenta1a6e8e28515570dc7c002349d7f11285552dcb0 (diff)
Convert SV_DECL_PTRARR_SORT_DEL to boost:ptr_set
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlnumfi.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 3bb00d19a5b5..255aa94c5010 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -52,6 +52,7 @@
#include <xmloff/xmltoken.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -86,8 +87,7 @@ struct SvXMLEmbeddedElement
sal_Bool operator < ( const SvXMLEmbeddedElement& r ) const { return nFormatPos < r.nFormatPos; }
};
-typedef SvXMLEmbeddedElement* SvXMLEmbeddedElementPtr;
-SV_DECL_PTRARR_SORT_DEL( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr, 0 )
+typedef boost::ptr_set<SvXMLEmbeddedElement> SvXMLEmbeddedElementArr;
//-------------------------------------------------------------------------
@@ -380,10 +380,6 @@ static SvXMLDefaultDateFormat aDefaultDateFormats[] =
//-------------------------------------------------------------------------
-SV_IMPL_OP_PTRARR_SORT( SvXMLEmbeddedElementArr, SvXMLEmbeddedElementPtr );
-
-//-------------------------------------------------------------------------
-
//
// SvXMLNumImpData
//
@@ -1047,15 +1043,15 @@ void SvXMLNumFmtElementContext::AddEmbeddedElement( sal_Int32 nFormatPos, const
if ( !rContent.isEmpty() )
{
SvXMLEmbeddedElement* pObj = new SvXMLEmbeddedElement( nFormatPos, rContent );
- if ( !aNumInfo.aEmbeddedElements.Insert( pObj ) )
+ if ( !aNumInfo.aEmbeddedElements.insert( pObj ).second )
{
// there's already an element at this position - append text to existing element
delete pObj;
- sal_uInt16 nElementCount = aNumInfo.aEmbeddedElements.Count();
- for (sal_uInt16 i=0; i<nElementCount; i++)
+ for (SvXMLEmbeddedElementArr::iterator it = aNumInfo.aEmbeddedElements.begin();
+ it != aNumInfo.aEmbeddedElements.end(); ++it)
{
- pObj = aNumInfo.aEmbeddedElements[i];
+ pObj = &*it;
if ( pObj->nFormatPos == nFormatPos )
{
pObj->aText += rContent;
@@ -1754,7 +1750,7 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
nGenPrec = 0; // generate format without decimals...
sal_Bool bGrouping = rInfo.bGrouping;
- sal_uInt16 nEmbeddedCount = rInfo.aEmbeddedElements.Count();
+ sal_uInt16 nEmbeddedCount = rInfo.aEmbeddedElements.size();
if ( nEmbeddedCount )
bGrouping = sal_False; // grouping and embedded characters can't be used together
@@ -1782,7 +1778,7 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
nZeroPos = aNumStr.Len();
// aEmbeddedElements is sorted - last entry has the largest position (leftmost)
- const SvXMLEmbeddedElement* pLastObj = rInfo.aEmbeddedElements[nEmbeddedCount - 1];
+ const SvXMLEmbeddedElement* pLastObj = &*rInfo.aEmbeddedElements.rbegin();
sal_Int32 nLastFormatPos = pLastObj->nFormatPos;
if ( nLastFormatPos >= nZeroPos )
{
@@ -1797,9 +1793,10 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
}
// aEmbeddedElements is sorted with ascending positions - loop is from right to left
- for (sal_uInt16 nElement = 0; nElement < nEmbeddedCount; nElement++)
+ for (SvXMLEmbeddedElementArr::const_iterator it = rInfo.aEmbeddedElements.begin();
+ it != rInfo.aEmbeddedElements.end(); ++it)
{
- const SvXMLEmbeddedElement* pObj = rInfo.aEmbeddedElements[nElement];
+ const SvXMLEmbeddedElement* pObj = &*it;
sal_Int32 nFormatPos = pObj->nFormatPos;
sal_Int32 nInsertPos = nZeroPos - nFormatPos;
if ( nFormatPos >= 0 && nInsertPos >= 0 )