[Libreoffice-commits] .: 27 commits - basic/source cui/source editeng/inc editeng/source filter/inc filter/source fpicker/source framework/inc framework/source sc/inc sc/source sd/source sfx2/inc sfx2/source svl/inc svl/source svx/inc svx/source sw/source
Michael Stahl
mst at kemper.freedesktop.org
Tue Jun 12 14:47:53 PDT 2012
basic/source/classes/propacc.cxx | 79 +++----
basic/source/comp/symtbl.cxx | 47 ++--
basic/source/inc/propacc.hxx | 12 -
basic/source/inc/symtbl.hxx | 10
cui/source/customize/cfgutil.cxx | 38 +--
cui/source/customize/selector.cxx | 32 ---
cui/source/dialogs/linkdlg.cxx | 12 -
cui/source/inc/cfgutil.hxx | 4
cui/source/inc/numpages.hxx | 5
cui/source/inc/selector.hxx | 4
cui/source/options/optgdlg.cxx | 4
cui/source/options/optinet2.cxx | 2
cui/source/options/optinet2.hxx | 4
cui/source/tabpages/numpages.cxx | 27 +-
editeng/inc/editeng/svxrtf.hxx | 18 -
editeng/source/rtf/svxrtf.cxx | 53 ++---
filter/inc/filter/msfilter/msdffimp.hxx | 15 -
filter/inc/filter/msfilter/svdfppt.hxx | 11 -
filter/source/msfilter/msdffimp.cxx | 37 +--
filter/source/msfilter/svdfppt.cxx | 55 ++---
fpicker/source/office/iodlg.cxx | 16 -
fpicker/source/office/iodlgimp.cxx | 8
fpicker/source/office/iodlgimp.hxx | 5
framework/inc/xml/imagesconfiguration.hxx | 10
framework/source/uiconfiguration/imagemanagerimpl.cxx | 12 -
framework/source/xml/imagesconfiguration.cxx | 4
framework/source/xml/imagesdocumenthandler.cxx | 18 -
sc/inc/cellsuno.hxx | 5
sc/inc/datauno.hxx | 5
sc/inc/dispuno.hxx | 5
sc/inc/linkuno.hxx | 6
sc/source/core/data/documen2.cxx | 4
sc/source/core/data/documen8.cxx | 32 +--
sc/source/core/tool/ddelink.cxx | 2
sc/source/core/tool/interpr2.cxx | 4
sc/source/ui/docshell/docfunc.cxx | 4
sc/source/ui/docshell/docsh6.cxx | 4
sc/source/ui/navipi/content.cxx | 4
sc/source/ui/undo/areasave.cxx | 6
sc/source/ui/undo/undoblk3.cxx | 2
sc/source/ui/unoobj/cellsuno.cxx | 37 +--
sc/source/ui/unoobj/chart2uno.cxx | 24 +-
sc/source/ui/unoobj/dapiuno.cxx | 18 -
sc/source/ui/unoobj/datauno.cxx | 20 -
sc/source/ui/unoobj/dispuno.cxx | 24 --
sc/source/ui/unoobj/linkuno.cxx | 62 ++---
sc/source/ui/vba/vbaquerytable.cxx | 2
sc/source/ui/view/tabvwshb.cxx | 2
sd/source/core/drawdoc.cxx | 6
sd/source/core/drawdoc2.cxx | 2
sd/source/filter/ppt/pptin.cxx | 14 -
sfx2/inc/sfx2/linkmgr.hxx | 4
sfx2/source/appl/linkmgr2.cxx | 74 +++----
svl/inc/svl/zforlist.hxx | 8
svl/source/numbers/zforlist.cxx | 187 ++++++++----------
svx/inc/svx/numfmtsh.hxx | 3
svx/source/items/numfmtsh.cxx | 54 ++---
sw/source/core/doc/doc.cxx | 4
sw/source/core/doc/docnew.cxx | 6
sw/source/core/doc/swserv.cxx | 2
sw/source/core/docnode/section.cxx | 12 -
sw/source/core/docnode/swbaslnk.cxx | 2
sw/source/core/graphic/ndgrf.cxx | 2
sw/source/filter/rtf/swparrtf.cxx | 2
sw/source/filter/ww8/ww8graf2.cxx | 6
sw/source/filter/ww8/ww8par.cxx | 6
sw/source/ui/app/docsh.cxx | 2
sw/source/ui/shells/basesh.cxx | 6
sw/source/ui/uiview/viewstat.cxx | 2
sw/source/ui/uno/unotxdoc.cxx | 2
70 files changed, 584 insertions(+), 636 deletions(-)
New commits:
commit 3174c0234bd9fdbbd182d05e86a2699e239f7f68
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 12 23:12:14 2012 +0200
remove unused SfxFilterPtrArr
Change-Id: Iea1e44f40a1e2d51947cdeff4f8948f3612dc25c
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index 6303423..74d0578 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -68,8 +68,6 @@ public:
virtual void Modify();
};
-typedef std::vector<SfxFilter*> SfxFilterPtrArr;
-
// class SvxProxyTabPage -------------------------------------------------
class SvxProxyTabPage : public SfxTabPage
commit a96d082bc03683e9920a53ede7becb048240fbd5
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 12 22:43:05 2012 +0200
convert SbPropertyValueArr_Impl to boost::ptr_vector
Change-Id: Id3189a9abff5ee97b93bccefba8193ba36cb043a
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 9728023..b4e351a 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -62,13 +62,13 @@ int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 )
struct SbCompare_UString_PropertyValue_Impl
{
- bool operator() ( const ::rtl::OUString& lhs, PropertyValue* const & rhs )
+ bool operator() (const ::rtl::OUString& lhs, PropertyValue const & rhs)
{
- return lhs.compareTo(rhs->Name) < 0;
+ return lhs.compareTo(rhs.Name) < 0;
}
- bool operator() ( PropertyValue* const & lhs, const ::rtl::OUString& rhs )
+ bool operator() (PropertyValue const & lhs, const ::rtl::OUString& rhs)
{
- return lhs->Name.compareTo(rhs) < 0;
+ return lhs.Name.compareTo(rhs) < 0;
}
};
@@ -95,9 +95,6 @@ SbPropertyValues::SbPropertyValues()
SbPropertyValues::~SbPropertyValues()
{
m_xInfo = Reference< XPropertySetInfo >();
-
- for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n )
- delete m_aPropVals[ n ];
}
//----------------------------------------------------------------------------
@@ -141,8 +138,8 @@ void SbPropertyValues::setPropertyValue(
::com::sun::star::uno::RuntimeException)
{
size_t const nIndex = GetIndex_Impl( aPropertyName );
- PropertyValue *const pPropVal = m_aPropVals[nIndex];
- pPropVal->Value = aValue;
+ PropertyValue & rPropVal = m_aPropVals[nIndex];
+ rPropVal.Value = aValue;
}
//----------------------------------------------------------------------------
@@ -154,7 +151,7 @@ Any SbPropertyValues::getPropertyValue(
::com::sun::star::uno::RuntimeException)
{
size_t const nIndex = GetIndex_Impl( aPropertyName );
- return m_aPropVals[nIndex]->Value;
+ return m_aPropVals[nIndex].Value;
}
//----------------------------------------------------------------------------
@@ -202,8 +199,8 @@ void SbPropertyValues::removeVetoableChangeListener(
Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException)
{
Sequence<PropertyValue> aRet( m_aPropVals.size() );
- for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n )
- aRet.getArray()[n] = *m_aPropVals[n];
+ for (size_t n = 0; n < m_aPropVals.size(); ++n)
+ aRet.getArray()[n] = m_aPropVals[n];
return aRet;
}
@@ -220,7 +217,7 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope
throw PropertyExistException();
const PropertyValue *pPropVals = rPropertyValues.getConstArray();
- for ( sal_Int16 n = 0; n < rPropertyValues.getLength(); ++n )
+ for (sal_Int32 n = 0; n < rPropertyValues.getLength(); ++n)
{
PropertyValue *pPropVal = new PropertyValue(pPropVals[n]);
m_aPropVals.push_back( pPropVal );
@@ -272,7 +269,7 @@ SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals )
for ( sal_uInt16 n = 0; n < rPropVals.size(); ++n )
{
Property &rProp = aImpl._aProps.getArray()[n];
- const PropertyValue &rPropVal = *rPropVals[n];
+ const PropertyValue &rPropVal = rPropVals[n];
rProp.Name = rPropVal.Name;
rProp.Handle = rPropVal.Handle;
rProp.Type = getCppuVoidType();
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 3afbd22..d14cf51 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -35,9 +35,10 @@
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
-#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
-typedef std::vector< ::com::sun::star::beans::PropertyValue* > SbPropertyValueArr_Impl;
+typedef ::boost::ptr_vector< ::com::sun::star::beans::PropertyValue >
+ SbPropertyValueArr_Impl;
typedef ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertySet,
::com::sun::star::beans::XPropertyAccess > SbPropertyValuesHelper;
commit a7a6f775826a7d1c365b5ca0725b61c7fedf0f0b
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 12 22:30:01 2012 +0200
SbPropertyValues: rename members
Change-Id: Iad6bc5af052a0795608ec11ee11c8dea3d091868
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index b34cdf6..9728023 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -94,10 +94,10 @@ SbPropertyValues::SbPropertyValues()
SbPropertyValues::~SbPropertyValues()
{
- _xInfo = Reference< XPropertySetInfo >();
+ m_xInfo = Reference< XPropertySetInfo >();
- for ( sal_uInt16 n = 0; n < _aPropVals.size(); ++n )
- delete _aPropVals[ n ];
+ for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n )
+ delete m_aPropVals[ n ];
}
//----------------------------------------------------------------------------
@@ -105,12 +105,12 @@ SbPropertyValues::~SbPropertyValues()
Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw( RuntimeException )
{
// create on demand?
- if ( !_xInfo.is() )
+ if (!m_xInfo.is())
{
- SbPropertySetInfo *pInfo = new SbPropertySetInfo( _aPropVals );
- ((SbPropertyValues*)this)->_xInfo = (XPropertySetInfo*)pInfo;
+ SbPropertySetInfo *pInfo = new SbPropertySetInfo( m_aPropVals );
+ m_xInfo.set(pInfo);
}
- return _xInfo;
+ return m_xInfo;
}
//-------------------------------------------------------------------------
@@ -118,15 +118,15 @@ Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw(
size_t SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const
{
SbPropertyValueArr_Impl::const_iterator it = std::lower_bound(
- _aPropVals.begin(), _aPropVals.end(), rPropName,
+ m_aPropVals.begin(), m_aPropVals.end(), rPropName,
SbCompare_UString_PropertyValue_Impl() );
- if (it == _aPropVals.end())
+ if (it == m_aPropVals.end())
{
throw beans::UnknownPropertyException(
"Property not found: " + rPropName,
const_cast<SbPropertyValues&>(*this));
}
- return it - _aPropVals.begin();
+ return it - m_aPropVals.begin();
}
//----------------------------------------------------------------------------
@@ -141,7 +141,7 @@ void SbPropertyValues::setPropertyValue(
::com::sun::star::uno::RuntimeException)
{
size_t const nIndex = GetIndex_Impl( aPropertyName );
- PropertyValue *const pPropVal = _aPropVals[nIndex];
+ PropertyValue *const pPropVal = m_aPropVals[nIndex];
pPropVal->Value = aValue;
}
@@ -154,7 +154,7 @@ Any SbPropertyValues::getPropertyValue(
::com::sun::star::uno::RuntimeException)
{
size_t const nIndex = GetIndex_Impl( aPropertyName );
- return _aPropVals[nIndex]->Value;
+ return m_aPropVals[nIndex]->Value;
}
//----------------------------------------------------------------------------
@@ -201,9 +201,9 @@ void SbPropertyValues::removeVetoableChangeListener(
Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException)
{
- Sequence<PropertyValue> aRet( _aPropVals.size() );
- for ( sal_uInt16 n = 0; n < _aPropVals.size(); ++n )
- aRet.getArray()[n] = *_aPropVals[n];
+ Sequence<PropertyValue> aRet( m_aPropVals.size() );
+ for ( sal_uInt16 n = 0; n < m_aPropVals.size(); ++n )
+ aRet.getArray()[n] = *m_aPropVals[n];
return aRet;
}
@@ -216,14 +216,14 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException)
{
- if ( !_aPropVals.empty() )
+ if ( !m_aPropVals.empty() )
throw PropertyExistException();
const PropertyValue *pPropVals = rPropertyValues.getConstArray();
for ( sal_Int16 n = 0; n < rPropertyValues.getLength(); ++n )
{
PropertyValue *pPropVal = new PropertyValue(pPropVals[n]);
- _aPropVals.push_back( pPropVal );
+ m_aPropVals.push_back( pPropVal );
}
}
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 09cd9bf..3afbd22 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -47,8 +47,8 @@ typedef ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertySet,
class SbPropertyValues: public SbPropertyValuesHelper
{
- SbPropertyValueArr_Impl _aPropVals;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo;
+ SbPropertyValueArr_Impl m_aPropVals;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xInfo;
private:
size_t GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
commit f9c5a36609523317b6634f18d834296c6b3dcb22
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 12 22:25:23 2012 +0200
SbPropertyValues::setPropertyValue doesn't check that property exists
Change-Id: Ia63eea0c19bfa750b80f4c99f278f8d144c714a8
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 945e719..b34cdf6 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -34,6 +34,7 @@
#include <sbunoobj.hxx>
using com::sun::star::uno::Reference;
+using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
@@ -114,12 +115,18 @@ Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw(
//-------------------------------------------------------------------------
-sal_Int32 SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const
+size_t SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const
{
SbPropertyValueArr_Impl::const_iterator it = std::lower_bound(
_aPropVals.begin(), _aPropVals.end(), rPropName,
SbCompare_UString_PropertyValue_Impl() );
- return it != _aPropVals.end() ? it - _aPropVals.begin() : USHRT_MAX;
+ if (it == _aPropVals.end())
+ {
+ throw beans::UnknownPropertyException(
+ "Property not found: " + rPropName,
+ const_cast<SbPropertyValues&>(*this));
+ }
+ return it - _aPropVals.begin();
}
//----------------------------------------------------------------------------
@@ -133,9 +140,8 @@ void SbPropertyValues::setPropertyValue(
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException)
{
- sal_Int32 nIndex = GetIndex_Impl( aPropertyName );
- PropertyValue *pPropVal = _aPropVals[
- sal::static_int_cast< sal_uInt16 >(nIndex)];
+ size_t const nIndex = GetIndex_Impl( aPropertyName );
+ PropertyValue *const pPropVal = _aPropVals[nIndex];
pPropVal->Value = aValue;
}
@@ -147,11 +153,8 @@ Any SbPropertyValues::getPropertyValue(
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException)
{
- sal_Int32 nIndex = GetIndex_Impl( aPropertyName );
- if ( nIndex != USHRT_MAX )
- return _aPropVals[
- sal::static_int_cast< sal_uInt16 >(nIndex)]->Value;
- return Any();
+ size_t const nIndex = GetIndex_Impl( aPropertyName );
+ return _aPropVals[nIndex]->Value;
}
//----------------------------------------------------------------------------
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index b5a2e71..09cd9bf 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -51,7 +51,7 @@ class SbPropertyValues: public SbPropertyValuesHelper
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo;
private:
- sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
+ size_t GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
public:
SbPropertyValues();
commit 6ec1108370d9e27f3e75c1a50f9525b06d5a3c82
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 12 21:53:44 2012 +0200
convert NfWSStringsDtor further to vector<OUString>
Change-Id: I4fac64952abf208864281fda722d8b7242689395
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 10bac7e..b1e0162 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -318,18 +318,7 @@ public:
typedef boost::ptr_vector<NfCurrencyEntry> NfCurrencyTable;
-typedef String* WSStringPtr;
-class SVL_DLLPUBLIC NfWSStringsDtor : public std::vector<WSStringPtr>
-{
-public:
- ~NfWSStringsDtor()
- {
- for( const_iterator it = begin(); it != end(); ++it )
- delete *it;
- }
-
-};
-
+typedef std::vector< ::rtl::OUString > NfWSStringsDtor;
class SvNumberFormatterRegistry_Impl;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 0228ac7..e40a224 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3189,7 +3189,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
DBG_ASSERT( aCurrList.size(), "where is the NewCurrency System standard format?!?" );
// if already loaded or user defined nDefaultSystemCurrencyFormat
// will be set to the right value
- PutEntry( *aCurrList[ nDefault ], nCheck, nType,
+ PutEntry( aCurrList[ nDefault ], nCheck, nType,
nDefaultSystemCurrencyFormat, LANGUAGE_SYSTEM );
DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
DBG_ASSERT( nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
@@ -3234,7 +3234,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
// if already loaded or user defined nDefaultSystemCurrencyFormat
// will be set to the right value
short nType;
- PutEntry( *aCurrList[ nDefault ], nCheck, nType,
+ PutEntry( aCurrList[ nDefault ], nCheck, nType,
nDefaultCurrencyFormat, ActLnge );
DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
@@ -3671,21 +3671,23 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
rCurr.BuildPositiveFormatString( aPositiveBank, true, *xLocaleData, 1 );
rCurr.BuildNegativeFormatString( aNegativeBank, true, *xLocaleData, 1 );
- WSStringPtr pFormat1 = new String( aPositiveBank );
- *pFormat1 += ';';
- WSStringPtr pFormat2 = new String( *pFormat1 );
+ ::rtl::OUStringBuffer format1(aPositiveBank);
+ format1.append(';');
+ format1.append(aNegativeBank);
+ rStrArr.push_back(format1.makeStringAndClear());
+
+ ::rtl::OUStringBuffer format2(aPositiveBank);
+ format2.append(';');
String aRed( '[' );
aRed += pFormatScanner->GetRedString();
aRed += ']';
- *pFormat2 += aRed;
+ format2.append(aRed);
- *pFormat1 += aNegativeBank;
- *pFormat2 += aNegativeBank;
+ format2.append(aNegativeBank);
+ rStrArr.push_back(format2.makeStringAndClear());
- rStrArr.push_back( pFormat1 );
- rStrArr.push_back( pFormat2 );
nDefault = rStrArr.size() - 1;
}
else
@@ -3694,7 +3696,6 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
// duplicates if no decimals in currency.
String aPositive, aNegative, aPositiveNoDec, aNegativeNoDec,
aPositiveDashed, aNegativeDashed;
- WSStringPtr pFormat1, pFormat2, pFormat3, pFormat4, pFormat5;
String aRed( '[' );
aRed += pFormatScanner->GetRedString();
@@ -3702,6 +3703,11 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
rCurr.BuildPositiveFormatString( aPositive, false, *xLocaleData, 1 );
rCurr.BuildNegativeFormatString( aNegative, false, *xLocaleData, 1 );
+ ::rtl::OUStringBuffer format1;
+ ::rtl::OUStringBuffer format2;
+ ::rtl::OUStringBuffer format3;
+ ::rtl::OUStringBuffer format4;
+ ::rtl::OUStringBuffer format5;
if ( rCurr.GetDigits() )
{
rCurr.BuildPositiveFormatString( aPositiveNoDec, false, *xLocaleData, 0 );
@@ -3709,45 +3715,42 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
rCurr.BuildPositiveFormatString( aPositiveDashed, false, *xLocaleData, 2 );
rCurr.BuildNegativeFormatString( aNegativeDashed, false, *xLocaleData, 2 );
- pFormat1 = new String( aPositiveNoDec );
- *pFormat1 += ';';
- pFormat3 = new String( *pFormat1 );
- pFormat5 = new String( aPositiveDashed );
- *pFormat5 += ';';
-
- *pFormat1 += aNegativeNoDec;
+ format1.append(aPositiveNoDec);
+ format1.append(';');
+ format1.append(aNegativeNoDec);
- *pFormat3 += aRed;
- *pFormat5 += aRed;
+ format3.append(aPositiveNoDec);
+ format3.append(';');
+ format3.append(aRed);
+ format3.append(aNegativeNoDec);
- *pFormat3 += aNegativeNoDec;
- *pFormat5 += aNegativeDashed;
- }
- else
- {
- pFormat1 = NULL;
- pFormat3 = NULL;
- pFormat5 = NULL;
+ format5.append(aPositiveDashed);
+ format5.append(';');
+ format5.append(aRed);
+ format5.append(aNegativeDashed);
}
- pFormat2 = new String( aPositive );
- *pFormat2 += ';';
- pFormat4 = new String( *pFormat2 );
+ format2.append(aPositive);
+ format2.append(';');
+ format2.append(aNegative);
- *pFormat2 += aNegative;
+ format4.append(aPositive);
+ format4.append(';');
+ format4.append(aRed);
+ format4.append(aNegative);
- *pFormat4 += aRed;
- *pFormat4 += aNegative;
-
- if ( pFormat1 )
- rStrArr.push_back( pFormat1 );
- rStrArr.push_back( pFormat2 );
- if ( pFormat3 )
- rStrArr.push_back( pFormat3 );
- rStrArr.push_back( pFormat4 );
+ if (rCurr.GetDigits()) {
+ rStrArr.push_back(format1.makeStringAndClear());
+ }
+ rStrArr.push_back(format2.makeStringAndClear());
+ if (rCurr.GetDigits()) {
+ rStrArr.push_back(format3.makeStringAndClear());
+ }
+ rStrArr.push_back(format4.makeStringAndClear());
nDefault = rStrArr.size() - 1;
- if ( pFormat5 )
- rStrArr.push_back( pFormat5 );
+ if (rCurr.GetDigits()) {
+ rStrArr.push_back(format5.makeStringAndClear());
+ }
}
return nDefault;
}
diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx
index d6005ab..ba3b04c 100644
--- a/svx/inc/svx/numfmtsh.hxx
+++ b/svx/inc/svx/numfmtsh.hxx
@@ -183,7 +183,8 @@ public:
void GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag );
sal_uInt16 FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking );
- bool IsInTable(sal_uInt16 nPos,bool bTmpBanking,const String &rFmtString);
+ bool IsInTable(sal_uInt16 nPos, bool bTmpBanking,
+ ::rtl::OUString const& rFmtString);
private:
static const double DEFAULT_NUMVALUE;
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index ef25577..014b548 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -1029,7 +1029,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
for( size_t i = 0, nPos = nOldListCount; i < aWSStringsDtor.size(); ++i )
{
bool bFlag = true;
- String aInsStr(*aWSStringsDtor[i]);
+ String aInsStr(aWSStringsDtor[i]);
size_t j;
for( j=0; j < aList.size(); ++j )
{
@@ -1771,7 +1771,8 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const NfCurrencyEntry* pTmpC
return (sal_uInt16) -1;
}
-bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,bool bTmpBanking,const String &rFmtString)
+bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos,
+ bool const bTmpBanking, ::rtl::OUString const& rFmtString)
{
bool bFlag=false;
@@ -1793,7 +1794,7 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,bool bTmpBanking,const Stri
for(sal_uInt16 i=0;i<aWSStringsDtor.size();i++)
{
- if(*aWSStringsDtor[i]==rFmtString)
+ if (aWSStringsDtor[i] == rFmtString)
{
bFlag=true;
break;
commit 586df9f1ec5a733082ced2a51f416c8baa2cc914
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jun 12 14:18:56 2012 +0200
Convert SV_DECL_PTRARR_DEL(SvxRTFItemStackList) to boost::ptr_vector
I had to make the destructor of SvxRTFItemStackType public.
The combination of friend class, boost, and a private destructor
does not make OSX's gcc happy.
Change-Id: I2d9a3bff3c5edaf5435fb543389a9a2822c6b2ad
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx
index 4d255da..926846f 100644
--- a/editeng/inc/editeng/svxrtf.hxx
+++ b/editeng/inc/editeng/svxrtf.hxx
@@ -39,6 +39,7 @@
#include <utility>
#include <vector>
#include "boost/ptr_container/ptr_map.hpp"
+#include "boost/ptr_container/ptr_vector.hpp"
class Font;
class Color;
@@ -46,7 +47,7 @@ class Graphic;
class DateTime;
struct SvxRTFStyleType;
class SvxRTFItemStackType;
-class SvxRTFItemStackList;
+class SvxRTFItemStackList : public boost::ptr_vector<SvxRTFItemStackType> {};
namespace com { namespace sun { namespace star {
namespace document {
@@ -88,12 +89,10 @@ typedef Color* ColorPtr;
typedef std::deque< ColorPtr > SvxRTFColorTbl;
typedef boost::ptr_map<short, Font> SvxRTFFontTbl;
typedef boost::ptr_map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl;
-typedef SvxRTFItemStackType* SvxRTFItemStackTypePtr;
-SV_DECL_PTRARR_DEL( SvxRTFItemStackList, SvxRTFItemStackTypePtr, 1 )
-// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackTypePtr >" type, because
+// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackType* >" type, because
// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file
-typedef std::deque< SvxRTFItemStackTypePtr > SvxRTFItemStack;
+typedef std::deque< SvxRTFItemStackType* > SvxRTFItemStack;
// own helper classes for the RTF Parser
struct SvxRTFStyleType
@@ -262,7 +261,7 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
void ClearStyleTbl();
void ClearAttrStack();
- SvxRTFItemStackTypePtr _GetAttrSet( int bCopyAttr=sal_False ); // Create new ItemStackType:s
+ SvxRTFItemStackType* _GetAttrSet( int bCopyAttr=sal_False ); // Create new ItemStackType:s
void _ClearStyleAttr( SvxRTFItemStackType& rStkType );
// Sets all the attributes that are different from the current
@@ -413,7 +412,6 @@ public:
class EDITENG_DLLPUBLIC SvxRTFItemStackType
{
friend class SvxRTFParser;
- friend class SvxRTFItemStackList;
SfxItemSet aAttrSet;
SvxNodeIdx *pSttNd, *pEndNd;
@@ -423,14 +421,14 @@ class EDITENG_DLLPUBLIC SvxRTFItemStackType
SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange,
const SvxPosition& );
- ~SvxRTFItemStackType();
- void Add( SvxRTFItemStackTypePtr );
+ void Add( SvxRTFItemStackType* );
void Compress( const SvxRTFParser& );
public:
SvxRTFItemStackType( const SvxRTFItemStackType&, const SvxPosition&,
int bCopyAttr = sal_False );
+ ~SvxRTFItemStackType();
//cmc, I'm very suspicios about SetStartPos, it doesn't change
//its children's starting position, and the implementation looks
//bad, consider this deprecated.
@@ -469,7 +467,7 @@ inline const Color& SvxRTFParser::GetColor( size_t nId ) const
inline SfxItemSet& SvxRTFParser::GetAttrSet()
{
- SvxRTFItemStackTypePtr pTmp;
+ SvxRTFItemStackType* pTmp;
if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) )
pTmp = _GetAttrSet();
return pTmp->aAttrSet;
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index c57d3c5..48e3efb 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -50,8 +50,6 @@
using namespace ::com::sun::star;
-SV_IMPL_PTRARR( SvxRTFItemStackList, SvxRTFItemStackType* )
-
CharSet lcl_GetDefaultTextEncodingForRTF()
{
@@ -224,11 +222,11 @@ INSINGLECHAR:
{
InsertText();
// all collected Attributes are set
- for( sal_uInt16 n = aAttrSetList.Count(); n; )
+ for( sal_uInt16 n = aAttrSetList.size(); n; )
{
- SvxRTFItemStackType* pStkSet = aAttrSetList[--n];
+ SvxRTFItemStackType* pStkSet = &aAttrSetList[--n];
SetAttrSet( *pStkSet );
- aAttrSetList.DeleteAndDestroy( n );
+ aAttrSetList.pop_back();
}
}
break;
@@ -1005,8 +1003,8 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
// Last off the stack, thus cache it until the next text was
// read. (Span no attributes!)
- aAttrSetList.Insert( pOld, aAttrSetList.Count() );
- aAttrSetList.Insert( pNew, aAttrSetList.Count() );
+ aAttrSetList.push_back( pOld );
+ aAttrSetList.push_back( pNew );
}
pOld = 0; // Do not delete pOld
break;
@@ -1035,7 +1033,7 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
pAkt->Add( pOld );
// split up and create new entry, because it make no sense
// to create a "so long" depend list. Bug 95010
- if( bCrsrBack && 50 < pAkt->pChildList->Count() )
+ if( bCrsrBack && 50 < pAkt->pChildList->size() )
{
// at the beginning of a paragraph? Move back one position
MovePos( sal_True );
@@ -1057,7 +1055,7 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
else
// Last off the stack, thus cache it until the next text was
// read. (Span no attributes!)
- aAttrSetList.Insert( pOld, aAttrSetList.Count() );
+ aAttrSetList.push_back( pOld );
pOld = 0;
}
@@ -1081,11 +1079,11 @@ void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc
while( !aAttrStack.empty() )
AttrGroupEnd();
- for( sal_uInt16 n = aAttrSetList.Count(); n; )
+ for( sal_uInt16 n = aAttrSetList.size(); n; )
{
- SvxRTFItemStackType* pStkSet = aAttrSetList[--n];
+ SvxRTFItemStackType* pStkSet = &aAttrSetList[--n];
SetAttrSet( *pStkSet );
- aAttrSetList.DeleteAndDestroy( n );
+ aAttrSetList.pop_back();
}
}
@@ -1103,8 +1101,8 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet )
// then process all the children
if( rSet.pChildList )
- for( sal_uInt16 n = 0; n < rSet.pChildList->Count(); ++n )
- SetAttrSet( *(*rSet.pChildList)[ n ] );
+ for( sal_uInt16 n = 0; n < rSet.pChildList->size(); ++n )
+ SetAttrSet( (*rSet.pChildList)[ n ] );
}
// Has no Text been inserted yet? (SttPos from the top Stack entry!)
@@ -1205,8 +1203,8 @@ SvxRTFItemStackType::~SvxRTFItemStackType()
void SvxRTFItemStackType::Add( SvxRTFItemStackType* pIns )
{
if( !pChildList )
- pChildList = new SvxRTFItemStackList( 4 );
- pChildList->Insert( pIns, pChildList->Count() );
+ pChildList = new SvxRTFItemStackList();
+ pChildList->push_back( pIns );
}
void SvxRTFItemStackType::SetStartPos( const SvxPosition& rPos )
@@ -1239,10 +1237,10 @@ void SvxRTFItemStackType::MoveFullNode(const SvxNodeIdx &rOldNode,
}
//And the same for all the children
- sal_uInt16 nCount = pChildList ? pChildList->Count() : 0;
+ sal_uInt16 nCount = pChildList ? pChildList->size() : 0;
for (sal_uInt16 i = 0; i < nCount; ++i)
{
- SvxRTFItemStackType* pStk = (*pChildList)[i];
+ SvxRTFItemStackType* pStk = &(*pChildList)[i];
pStk->MoveFullNode(rOldNode, rNewNode);
}
}
@@ -1257,7 +1255,7 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
DBG_ASSERT( pChildList, "There is no child list" );
sal_uInt16 n;
- SvxRTFItemStackType* pTmp = (*pChildList)[0];
+ SvxRTFItemStackType* pTmp = &(*pChildList)[0];
if( !pTmp->aAttrSet.Count() ||
pSttNd->GetIdx() != pTmp->pSttNd->GetIdx() ||
@@ -1268,9 +1266,9 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
xub_StrLen nLastCnt = pTmp->nEndCnt;
SfxItemSet aMrgSet( pTmp->aAttrSet );
- for( n = 1; n < pChildList->Count(); ++n )
+ for( n = 1; n < pChildList->size(); ++n )
{
- pTmp = (*pChildList)[n];
+ pTmp = &(*pChildList)[n];
if( pTmp->pChildList )
pTmp->Compress( rParser );
@@ -1280,8 +1278,8 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
: ( pTmp->nSttCnt != nLastCnt ||
pLastNd->GetIdx() != pTmp->pSttNd->GetIdx() ))
{
- while( ++n < pChildList->Count() )
- if( (pTmp = (*pChildList)[n])->pChildList )
+ while( ++n < pChildList->size() )
+ if( (pTmp = &(*pChildList)[n])->pChildList )
pTmp->Compress( rParser );
return;
}
@@ -1319,20 +1317,19 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
// It can be merged
aAttrSet.Put( aMrgSet );
- for( n = 0; n < pChildList->Count(); ++n )
+ for( n = 0; n < pChildList->size(); ++n )
{
- pTmp = (*pChildList)[n];
+ pTmp = &(*pChildList)[n];
pTmp->aAttrSet.Differentiate( aMrgSet );
if( !pTmp->pChildList && !pTmp->aAttrSet.Count() && !pTmp->nStyleNo )
{
- pChildList->Remove( n );
- delete pTmp;
+ pChildList->erase( pChildList->begin() + n );
--n;
continue;
}
}
- if( !pChildList->Count() )
+ if( pChildList->empty() )
{
delete pChildList;
pChildList = 0;
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 396de09..5a73aa1 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -3589,7 +3589,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
// wurde an der Position ein Escapement aufgespannt, so entferne
// das jetzt. Fussnoten sind bei uns immer hochgestellt.
- SvxRTFItemStackTypePtr pTmp = aSaveStack.empty() ? 0 : aSaveStack.back();
+ SvxRTFItemStackType* pTmp = aSaveStack.empty() ? 0 : aSaveStack.back();
if( pTmp && pTmp->GetSttNodeIdx() ==
pPam->GetPoint()->nNode.GetIndex() &&
pTmp->GetSttCnt() == nPos )
commit c2fc98fa9e46cd18201d3940beb67d74630c8604
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Jun 10 22:09:49 2012 +0200
Convert SV_IMPL_PTRARR(SfxFilterPtrArr) to std::vector
Change-Id: I6b0fee0f5d736006938d3d6ab69745219bffa227
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 979e334..19a95a7 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -111,8 +111,6 @@ using ::rtl::OUString;
#include <sal/config.h>
-SV_IMPL_PTRARR( SfxFilterPtrArr, SfxFilterPtr )
-
// -----------------------------------------------------------------------
void SvxNoSpaceEdit::KeyInput( const KeyEvent& rKEvent )
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index 30f249a..6303423 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -32,7 +32,6 @@
#include <vcl/lstbox.hxx>
#include <vcl/group.hxx>
#include <vcl/field.hxx>
-#include <svl/svarray.hxx>
#include <svtools/stdctrl.hxx>
#include <svtools/svtabbx.hxx>
#include <sfx2/tabdlg.hxx>
@@ -69,8 +68,7 @@ public:
virtual void Modify();
};
-typedef SfxFilter* SfxFilterPtr;
-SV_DECL_PTRARR( SfxFilterPtrArr, SfxFilterPtr, 0 )
+typedef std::vector<SfxFilter*> SfxFilterPtrArr;
// class SvxProxyTabPage -------------------------------------------------
commit 42d57f94fa3202e53f38bfcbef0683c8f0bc1a61
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Jun 10 18:28:02 2012 +0200
Convert SV_DECL_PTRARR_DEL(SvxGroupInfoArr_Impl) to boost::ptr_vector
Change-Id: I90d357107f69ea5939952e9640b5e1f4cbdcec3d
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index 21b5e61..012bd6b 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -76,8 +76,6 @@ using namespace ::com::sun::star::container;
#include <tools/urlobj.hxx>
#include <tools/diagnose_ex.h>
-SV_IMPL_PTRARR(SvxGroupInfoArr_Impl, SvxGroupInfoPtr);
-
/*
* The implementations of SvxConfigFunctionListBox_Impl and
* SvxConfigGroupListBox_Impl are copied from sfx2/source/dialog/cfg.cxx
@@ -140,14 +138,7 @@ IMPL_LINK_NOARG(SvxConfigFunctionListBox_Impl, TimerHdl)
void SvxConfigFunctionListBox_Impl::ClearAll()
{
- sal_uInt16 nCount = aArr.Count();
- for ( sal_uInt16 i=0; i<nCount; ++i )
- {
- SvxGroupInfo_Impl *pData = aArr[i];
- delete pData;
- }
-
- aArr.Remove( 0, nCount );
+ aArr.clear();
Clear();
}
@@ -236,14 +227,7 @@ SvxConfigGroupListBox_Impl::~SvxConfigGroupListBox_Impl()
void SvxConfigGroupListBox_Impl::ClearAll()
{
- sal_uInt16 nCount = aArr.Count();
- for ( sal_uInt16 i=0; i<nCount; ++i )
- {
- SvxGroupInfo_Impl *pData = aArr[i];
- delete pData;
- }
-
- aArr.Remove( 0, nCount );
+ aArr.clear();
Clear();
}
@@ -376,7 +360,7 @@ void SvxConfigGroupListBox_Impl::fillScriptList( const Reference< browse::XBrows
SvxGroupInfo_Impl* pInfo =
new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, theChild );
pNewEntry->SetUserData( pInfo );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
if ( _bCheapChildrenOnDemand )
{
@@ -524,7 +508,7 @@ void SvxConfigGroupListBox_Impl::Init()
SvxGroupInfo_Impl *pInfo =
new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
pEntry->SetUserData( pInfo );
}
@@ -564,7 +548,7 @@ void SvxConfigGroupListBox_Impl::Init()
SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL );
pNewEntry->SetUserData( pInfo );
pNewEntry->EnableChildrenOnDemand( sal_True );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
}
else
{
@@ -772,8 +756,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl(
SVX_CFGFUNCTION_SLOT, 123, aCmdURL, ::rtl::OUString() );
- pFunctionListBox->aArr.Insert(
- _pGroupInfo, pFunctionListBox->aArr.Count() );
+ pFunctionListBox->aArr.push_back( _pGroupInfo );
pFuncEntry->SetUserData( _pGroupInfo );
}
@@ -832,8 +815,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected()
pNewEntry->SetUserData( _pGroupInfo );
- pFunctionListBox->aArr.Insert(
- _pGroupInfo, pFunctionListBox->aArr.Count() );
+ pFunctionListBox->aArr.push_back( _pGroupInfo );
}
}
diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx
index d515c53..2bad598 100644
--- a/cui/source/inc/selector.hxx
+++ b/cui/source/inc/selector.hxx
@@ -40,6 +40,7 @@
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include <sfx2/minarray.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
#define SVX_CFGGROUP_FUNCTION 1
#define SVX_CFGFUNCTION_SLOT 2
@@ -87,8 +88,7 @@ struct SvxGroupInfo_Impl
}
};
-typedef SvxGroupInfo_Impl* SvxGroupInfoPtr;
-SV_DECL_PTRARR_DEL(SvxGroupInfoArr_Impl, SvxGroupInfoPtr, 5)
+typedef boost::ptr_vector<SvxGroupInfo_Impl> SvxGroupInfoArr_Impl;
class ImageProvider
{
commit 4449da41bcdcd7f8b572a8d7f535cc72b1db28a5
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Jun 10 18:19:06 2012 +0200
Convert SV_DECL_PTRARR_DEL(SvxNumSettingsArr_Impl) to boost::ptr_vector
Change-Id: I1d53e6815c4da5ef5f525dbc11bca73723bb3bd2
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 00f0ddd..9dfcba2 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -31,6 +31,7 @@
// include ---------------------------------------------------------------
#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
#include <sfx2/tabdlg.hxx>
#include <vcl/group.hxx>
@@ -41,7 +42,6 @@
#include <vcl/field.hxx>
#include <editeng/numdef.hxx>
#include <svtools/ctrlbox.hxx>
-#include <svl/svarray.hxx>
// -----------------------------------------------------------------------
class SvxNumRule;
@@ -68,8 +68,7 @@ struct SvxNumSettings_Impl
{}
};
-typedef SvxNumSettings_Impl* SvxNumSettings_ImplPtr;
-SV_DECL_PTRARR_DEL(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr,8)
+typedef boost::ptr_vector<SvxNumSettings_Impl> SvxNumSettingsArr_Impl;
//------------------------------------------------
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 63e4ae4..81b8fa4 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -89,8 +89,6 @@ using namespace com::sun::star::container;
using namespace com::sun::star::style;
using rtl::OUString;
-SV_IMPL_PTRARR(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr);
-
#define NUM_PAGETYPE_BULLET 0
#define NUM_PAGETYPE_SINGLENUM 1
#define NUM_PAGETYPE_NUM 2
@@ -119,10 +117,10 @@ Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider()
return xRet;
}
-SvxNumSettings_ImplPtr lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
+SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
{
const PropertyValue* pValues = rLevelProps.getConstArray();
- SvxNumSettings_ImplPtr pNew = new SvxNumSettings_Impl;
+ SvxNumSettings_Impl* pNew = new SvxNumSettings_Impl;
for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
{
if ( pValues[j].Name == cNumberingType )
@@ -238,8 +236,8 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
for(sal_Int32 i = 0; i < nLength; i++)
{
- SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
- aNumSettingsArr.Insert(pNew, aNumSettingsArr.Count());
+ SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
+ aNumSettingsArr.push_back(pNew);
}
}
catch(Exception&)
@@ -255,7 +253,6 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
delete pActNum;
delete pExamplesVS;
delete pSaveNum;
- aNumSettingsArr.DeleteAndDestroy(0, aNumSettingsArr.Count());
}
SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent,
@@ -352,10 +349,10 @@ IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl)
bPreset = sal_False;
bModified = sal_True;
sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1;
- DBG_ASSERT(aNumSettingsArr.Count() > nIdx, "wrong index");
- if(aNumSettingsArr.Count() <= nIdx)
+ DBG_ASSERT(aNumSettingsArr.size() > nIdx, "wrong index");
+ if(aNumSettingsArr.size() <= nIdx)
return 0;
- SvxNumSettings_ImplPtr _pSet = aNumSettingsArr.GetObject(nIdx);
+ SvxNumSettings_Impl* _pSet = &aNumSettingsArr[nIdx];
sal_Int16 eNewType = _pSet->nNumberType;
const sal_Unicode cLocalPrefix = !_pSet->sPrefix.isEmpty() ? _pSet->sPrefix.getStr()[0] : 0;
const sal_Unicode cLocalSuffix = !_pSet->sSuffix.isEmpty() ? _pSet->sSuffix.getStr()[0] : 0;
@@ -606,8 +603,8 @@ SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
Any aValueAny = xLevel->getByIndex(nLevel);
Sequence<PropertyValue> aLevelProps;
aValueAny >>= aLevelProps;
- SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(aLevelProps);
- rItemArr.Insert( pNew, rItemArr.Count() );
+ SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aLevelProps);
+ rItemArr.push_back( pNew );
}
}
}
@@ -725,11 +722,11 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl)
SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1];
Font& rActBulletFont = lcl_GetDefaultBulletFont();
- SvxNumSettings_ImplPtr pLevelSettings = 0;
+ SvxNumSettings_Impl* pLevelSettings = 0;
for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
{
- if(rItemArr.Count() > i)
- pLevelSettings = rItemArr[i];
+ if(rItemArr.size() > i)
+ pLevelSettings = &rItemArr[i];
if(!pLevelSettings)
break;
SvxNumberFormat aFmt(pActNum->GetLevel(i));
commit bbe2cb404a11bc68e1b94d7e0e2aaa935fe21c80
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Jun 10 18:00:37 2012 +0200
Convert SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl) to boost::ptr_vector
Change-Id: I90628a60e3eb33097728e1036b22a5c000be02bc
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index bb3e085..dc4571a 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -262,7 +262,7 @@ void SfxStylesInfo_Impl::getLabel4Style(SfxStyleInfo_Impl& aStyle)
}
return lStyles;
}
-SV_IMPL_PTRARR(SfxGroupInfoArr_Impl, SfxGroupInfoPtr);
+
SfxConfigFunctionListBox_Impl::SfxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId)
: SvTreeListBox( pParent, rResId )
, pCurEntry( 0 )
@@ -303,10 +303,10 @@ void SfxConfigFunctionListBox_Impl::ClearAll()
possibly existing MacroInfo.
*/
{
- sal_uInt16 nCount = aArr.Count();
+ sal_uInt16 nCount = aArr.size();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- SfxGroupInfo_Impl *pData = aArr[i];
+ SfxGroupInfo_Impl *pData = &aArr[i];
if ( pData->nKind == SFX_CFGFUNCTION_SCRIPT )
{
@@ -314,8 +314,7 @@ void SfxConfigFunctionListBox_Impl::ClearAll()
delete pScriptURI;
}
- if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER
- )
+ if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER )
{
XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL)
@@ -323,11 +322,9 @@ void SfxConfigFunctionListBox_Impl::ClearAll()
xi->release();
}
}
-
- delete pData;
}
- aArr.Remove( 0, nCount );
+ aArr.clear();
Clear();
}
@@ -433,12 +430,11 @@ SfxConfigGroupListBox_Impl::~SfxConfigGroupListBox_Impl()
void SfxConfigGroupListBox_Impl::ClearAll()
{
- sal_uInt16 nCount = aArr.Count();
+ sal_uInt16 nCount = aArr.size();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- SfxGroupInfo_Impl *pData = aArr[i];
- if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER
- )
+ SfxGroupInfo_Impl *pData = &aArr[i];
+ if (pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER)
{
XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL)
@@ -446,10 +442,9 @@ void SfxConfigGroupListBox_Impl::ClearAll()
xi->release();
}
}
- delete pData;
}
- aArr.Remove( 0, nCount );
+ aArr.clear();
Clear();
}
@@ -635,7 +630,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL );
pNewEntry->SetUserData( pInfo );
pNewEntry->EnableChildrenOnDemand( sal_True );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
}
else
{
@@ -709,7 +704,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
SetCollapsedEntryBmp( pNewEntry, aImage );
pNewEntry->SetUserData( pInfo );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
if ( children[n]->hasChildNodes() )
{
@@ -741,7 +736,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
String sStyle( pImp->m_aStrGroupStyles );
SvLBoxEntry *pEntry = InsertEntry( sStyle, 0 );
SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, 0 ); // TODO last parameter should contain user data
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
pEntry->SetUserData( pInfo );
pEntry->EnableChildrenOnDemand( sal_True );
}
@@ -969,8 +964,7 @@ void SfxConfigGroupListBox_Impl::GroupSelected()
pGrpInfo->sLabel = children[n]->getName();
pNewEntry->SetUserData( pGrpInfo );
- pFunctionListBox->aArr.Insert(
- pGrpInfo, pFunctionListBox->aArr.Count() );
+ pFunctionListBox->aArr.push_back( pGrpInfo );
}
}
@@ -997,7 +991,7 @@ void SfxConfigGroupListBox_Impl::GroupSelected()
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt);
SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel, NULL );
SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pStyle );
- pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() );
+ pFunctionListBox->aArr.push_back( pGrpInfo );
pGrpInfo->sCommand = pStyle->sCommand;
pGrpInfo->sLabel = pStyle->sLabel;
pFuncEntry->SetUserData( pGrpInfo );
@@ -1121,7 +1115,7 @@ void SfxConfigGroupListBox_Impl::RequestingChildren( SvLBoxEntry *pEntry )
SetCollapsedEntryBmp(pNewEntry, aImage );
pNewEntry->SetUserData( pGrpInfo );
- aArr.Insert( pGrpInfo, aArr.Count() );
+ aArr.push_back( pGrpInfo );
if ( children[n]->hasChildNodes() )
{
@@ -1161,7 +1155,7 @@ void SfxConfigGroupListBox_Impl::RequestingChildren( SvLBoxEntry *pEntry )
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt);
SvLBoxEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry );
SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pFamily );
- aArr.Insert( pGrpInfo, aArr.Count() );
+ aArr.push_back( pGrpInfo );
pStyleEntry->SetUserData( pGrpInfo );
pStyleEntry->EnableChildrenOnDemand( sal_False );
}
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 4e0fd27..174bc53 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -29,6 +29,7 @@
#define _CFGUTIL_HXX
#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
#include <rtl/ustring.hxx>
#include <tools/string.hxx>
@@ -115,8 +116,7 @@ struct CuiMacroInfo
{
};
-typedef SfxGroupInfo_Impl* SfxGroupInfoPtr;
-SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl, SfxGroupInfoPtr, 5)
+typedef boost::ptr_vector<SfxGroupInfo_Impl> SfxGroupInfoArr_Impl;
class SfxConfigFunctionListBox_Impl : public SvTreeListBox
{
commit 2110397670695991b3a5cd28a15ba0ffd2a3a611
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Jun 10 12:47:02 2012 +0200
Convert SV_DECL_PTRARR_DEL(SbiSymbols) to std::vector
For reasons I don't understand, the compiler would get uncopy
if I tried to declare the destructor in the header file.
Change-Id: I67fa7941da2f0ee08ae10bf350fb1f3bf1397410
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 8144e76..7452033 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -32,8 +32,6 @@
#include <string.h>
#include <ctype.h>
-SV_IMPL_PTRARR(SbiSymbols,SbiSymDef*)
-
// All symbol names are laid down int the symbol-pool's stringpool, so that
// all symbols are handled in the same case. On saving the code-image, the
// global stringpool with the respective symbols is also saved.
@@ -118,35 +116,33 @@ SbiSymDef* SbiSymPool::First()
SbiSymDef* SbiSymPool::Next()
{
- if( ++nCur >= aData.Count() )
+ if( ++nCur >= aData.size() )
return NULL;
else
- return aData.GetObject( nCur );
+ return aData[ nCur ];
}
SbiSymDef* SbiSymPool::AddSym( const String& rName )
{
SbiSymDef* p = new SbiSymDef( rName );
- p->nPos = aData.Count();
+ p->nPos = aData.size();
p->nId = rStrings.Add( rName );
p->nProcId = nProcId;
p->pIn = this;
- const SbiSymDef* q = p;
- aData.Insert( q, q->nPos );
+ aData.insert( aData.begin() + p->nPos, p );
return p;
}
SbiProcDef* SbiSymPool::AddProc( const String& rName )
{
SbiProcDef* p = new SbiProcDef( pParser, rName );
- p->nPos = aData.Count();
+ p->nPos = aData.size();
p->nId = rStrings.Add( rName );
// procs are always local
p->nProcId = 0;
p->pIn = this;
- const SbiSymDef* q = p;
- aData.Insert( q, q->nPos );
+ aData.insert( aData.begin() + p->nPos, p );
return p;
}
@@ -165,7 +161,7 @@ void SbiSymPool::Add( SbiSymDef* pDef )
return;
}
- pDef->nPos = aData.Count();
+ pDef->nPos = aData.size();
if( !pDef->nId )
{
// A unique name must be created in the string pool
@@ -183,18 +179,17 @@ void SbiSymPool::Add( SbiSymDef* pDef )
if( !pDef->GetProcDef() )
pDef->nProcId = nProcId;
pDef->pIn = this;
- const SbiSymDef* q = pDef;
- aData.Insert( q, q->nPos );
+ aData.insert( aData.begin() + pDef->nPos, pDef );
}
}
SbiSymDef* SbiSymPool::Find( const String& rName ) const
{
- sal_uInt16 nCount = aData.Count();
+ sal_uInt16 nCount = aData.size();
for( sal_uInt16 i = 0; i < nCount; i++ )
{
- SbiSymDef* p = aData.GetObject( nCount - i - 1 );
+ SbiSymDef* p = aData[ nCount - i - 1 ];
if( ( !p->nProcId || ( p->nProcId == nProcId ) )
&& ( p->aName.EqualsIgnoreCaseAscii( rName ) ) )
return p;
@@ -208,9 +203,9 @@ SbiSymDef* SbiSymPool::Find( const String& rName ) const
SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
{
- for( sal_uInt16 i = 0; i < aData.Count(); i++ )
+ for( sal_uInt16 i = 0; i < aData.size(); i++ )
{
- SbiSymDef* p = aData.GetObject( i );
+ SbiSymDef* p = aData[ i ];
if( p->nId == n && ( !p->nProcId || ( p->nProcId == nProcId ) ) )
return p;
}
@@ -224,10 +219,10 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const
{
- if( n >= aData.Count() )
+ if( n >= aData.size() )
return NULL;
else
- return aData.GetObject( n );
+ return aData[ n ];
}
sal_uInt32 SbiSymPool::Define( const String& rName )
@@ -255,9 +250,9 @@ sal_uInt32 SbiSymPool::Reference( const String& rName )
void SbiSymPool::CheckRefs()
{
- for( sal_uInt16 i = 0; i < aData.Count(); i++ )
+ for( sal_uInt16 i = 0; i < aData.size(); i++ )
{
- SbiSymDef* p = aData.GetObject( i );
+ SbiSymDef* p = aData[ i ];
if( !p->IsDefined() )
pParser->Error( SbERR_UNDEF_LABEL, p->GetName() );
}
@@ -449,8 +444,7 @@ void SbiProcDef::Match( SbiProcDef* pOld )
if( !pIn && pOld->pIn )
{
// Replace old entry with the new one
- SbiSymDef** pData = (SbiSymDef**) pOld->pIn->aData.GetData();
- pData[ pOld->nPos ] = this;
+ pOld->pIn->aData[ pOld->nPos ] = this;
nPos = pOld->nPos;
nId = pOld->nId;
pIn = pOld->pIn;
@@ -510,4 +504,11 @@ SbiConstDef* SbiConstDef::GetConstDef()
return this;
}
+SbiSymbols::~SbiSymbols()
+{
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+};
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index a0263f9..cc6320f 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -29,6 +29,8 @@
#ifndef _SYMTBL_HXX
#define _SYMTBL_HXX
+#include <vector>
+
class SbiConstDef;
class SbiParser;
class SbiProcDef;
@@ -57,7 +59,11 @@ public:
};
-SV_DECL_PTRARR_DEL(SbiSymbols,SbiSymDef*,5)
+class SbiSymbols : public std::vector<SbiSymDef*>
+{
+public:
+ ~SbiSymbols();
+};
class SbiSymPool {
friend class SbiSymDef;
@@ -76,7 +82,7 @@ public:
void SetParent( SbiSymPool* p ) { pParent = p; }
void SetProcId( short n ) { nProcId = n; }
- sal_uInt16 GetSize() const { return aData.Count(); }
+ sal_uInt16 GetSize() const { return aData.size(); }
SbiSymScope GetScope() const { return eScope; }
void SetScope( SbiSymScope s ) { eScope = s; }
SbiParser* GetParser() { return pParser; }
commit 56366fa094fdeae8f62b55e0ba7b1ef06a582a84
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 12 22:13:10 2012 +0200
fix previous commit:
Make SbCompare_UString_PropertyValue_Impl a strict weak ordering.
Change-Id: I70d639ad44ceb69311c2d5bc1b95c972ad658451
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index b707abc..945e719 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -63,11 +63,11 @@ struct SbCompare_UString_PropertyValue_Impl
{
bool operator() ( const ::rtl::OUString& lhs, PropertyValue* const & rhs )
{
- return lhs.compareTo( rhs->Name );
+ return lhs.compareTo(rhs->Name) < 0;
}
bool operator() ( PropertyValue* const & lhs, const ::rtl::OUString& rhs )
{
- return !rhs.compareTo( lhs->Name );
+ return lhs->Name.compareTo(rhs) < 0;
}
};
commit 8de787a2669c2ae375820428009b411c9ab1f2bf
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sat Jun 9 18:07:07 2012 +0200
Convert SV_DECL_PTRARR(SbPropertyValueArr_Impl) to std::vector
Change-Id: I3e072c165d83e9ade06caf2508031b473ef7691d
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index ce9c027..b707abc 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -59,12 +59,17 @@ int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 )
return ((PropertyValue*)arg1)->Name.compareTo( ((PropertyValue*)arg2)->Name );
}
-extern "C" int CDECL SbCompare_UString_PropertyValue_Impl( const void *arg1, const void *arg2 )
+struct SbCompare_UString_PropertyValue_Impl
{
- const ::rtl::OUString *pArg1 = (::rtl::OUString*) arg1;
- const PropertyValue **pArg2 = (const PropertyValue**) arg2;
- return pArg1->compareTo( (*pArg2)->Name );
-}
+ bool operator() ( const ::rtl::OUString& lhs, PropertyValue* const & rhs )
+ {
+ return lhs.compareTo( rhs->Name );
+ }
+ bool operator() ( PropertyValue* const & lhs, const ::rtl::OUString& rhs )
+ {
+ return !rhs.compareTo( lhs->Name );
+ }
+};
int CDECL SbCompare_Properties_Impl( const void *arg1, const void *arg2 )
{
@@ -90,8 +95,8 @@ SbPropertyValues::~SbPropertyValues()
{
_xInfo = Reference< XPropertySetInfo >();
- for ( sal_uInt16 n = 0; n < _aPropVals.Count(); ++n )
- delete _aPropVals.GetObject( n );
+ for ( sal_uInt16 n = 0; n < _aPropVals.size(); ++n )
+ delete _aPropVals[ n ];
}
//----------------------------------------------------------------------------
@@ -111,12 +116,10 @@ Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw(
sal_Int32 SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const
{
- PropertyValue **ppPV;
- ppPV = (PropertyValue **)
- bsearch( &rPropName, _aPropVals.GetData(), _aPropVals.Count(),
- sizeof( PropertyValue* ),
- SbCompare_UString_PropertyValue_Impl );
- return ppPV ? ppPV - _aPropVals.GetData() : USHRT_MAX;
+ SbPropertyValueArr_Impl::const_iterator it = std::lower_bound(
+ _aPropVals.begin(), _aPropVals.end(), rPropName,
+ SbCompare_UString_PropertyValue_Impl() );
+ return it != _aPropVals.end() ? it - _aPropVals.begin() : USHRT_MAX;
}
//----------------------------------------------------------------------------
@@ -131,8 +134,8 @@ void SbPropertyValues::setPropertyValue(
::com::sun::star::uno::RuntimeException)
{
sal_Int32 nIndex = GetIndex_Impl( aPropertyName );
- PropertyValue *pPropVal = _aPropVals.GetObject(
- sal::static_int_cast< sal_uInt16 >(nIndex));
+ PropertyValue *pPropVal = _aPropVals[
+ sal::static_int_cast< sal_uInt16 >(nIndex)];
pPropVal->Value = aValue;
}
@@ -146,8 +149,8 @@ Any SbPropertyValues::getPropertyValue(
{
sal_Int32 nIndex = GetIndex_Impl( aPropertyName );
if ( nIndex != USHRT_MAX )
- return _aPropVals.GetObject(
- sal::static_int_cast< sal_uInt16 >(nIndex))->Value;
+ return _aPropVals[
+ sal::static_int_cast< sal_uInt16 >(nIndex)]->Value;
return Any();
}
@@ -195,9 +198,9 @@ void SbPropertyValues::removeVetoableChangeListener(
Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException)
{
- Sequence<PropertyValue> aRet( _aPropVals.Count());
- for ( sal_uInt16 n = 0; n < _aPropVals.Count(); ++n )
- aRet.getArray()[n] = *_aPropVals.GetObject(n);
+ Sequence<PropertyValue> aRet( _aPropVals.size() );
+ for ( sal_uInt16 n = 0; n < _aPropVals.size(); ++n )
+ aRet.getArray()[n] = *_aPropVals[n];
return aRet;
}
@@ -210,14 +213,14 @@ void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPrope
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException)
{
- if ( _aPropVals.Count() )
+ if ( !_aPropVals.empty() )
throw PropertyExistException();
const PropertyValue *pPropVals = rPropertyValues.getConstArray();
for ( sal_Int16 n = 0; n < rPropertyValues.getLength(); ++n )
{
PropertyValue *pPropVal = new PropertyValue(pPropVals[n]);
- _aPropVals.Insert( pPropVal, n );
+ _aPropVals.push_back( pPropVal );
}
}
@@ -262,11 +265,11 @@ sal_Bool PropertySetInfoImpl::hasPropertyByName(const ::rtl::OUString& Name) thr
SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals )
{
- aImpl._aProps.realloc( rPropVals.Count() );
- for ( sal_uInt16 n = 0; n < rPropVals.Count(); ++n )
+ aImpl._aProps.realloc( rPropVals.size() );
+ for ( sal_uInt16 n = 0; n < rPropVals.size(); ++n )
{
Property &rProp = aImpl._aProps.getArray()[n];
- const PropertyValue &rPropVal = *rPropVals.GetObject(n);
+ const PropertyValue &rPropVal = *rPropVals[n];
rProp.Name = rPropVal.Name;
rProp.Handle = rPropVal.Handle;
rProp.Type = getCppuVoidType();
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index f8e91d1..b5a2e71 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -28,7 +28,6 @@
#ifndef _SFX_PROPBAG_HXX
#define _SFX_PROPBAG_HXX
-#include <svl/svarray.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
@@ -36,9 +35,9 @@
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <vector>
-typedef ::com::sun::star::beans::PropertyValue* SbPropertyValuePtr;
-SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4 )
+typedef std::vector< ::com::sun::star::beans::PropertyValue* > SbPropertyValueArr_Impl;
typedef ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertySet,
::com::sun::star::beans::XPropertyAccess > SbPropertyValuesHelper;
commit 6d0961d194b02707faab5fb64207b8dc40488c2b
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sat Jun 9 17:15:22 2012 +0200
Convert SV_DECL_PTRARR_DEL(NfCurrencyTable) to boost::ptr_vector
Change-Id: I4e288a90f3b1662462ba06053343c8bab5fe46cf
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 762ec3d..40fd21e 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1356,11 +1356,11 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe
aCurrencyLB.InsertEntry( aDefaultCurr );
// all currencies
String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) );
- sal_uInt16 nCurrCount = rCurrTab.Count();
+ sal_uInt16 nCurrCount = rCurrTab.size();
// first entry is SYSTEM, skip it
for ( sal_uInt16 j=1; j < nCurrCount; ++j )
{
- const NfCurrencyEntry* pCurr = rCurrTab[j];
+ const NfCurrencyEntry* pCurr = &rCurrTab[j];
String aStr_( pCurr->GetBankSymbol() );
aStr_ += aTwoSpace;
aStr_ += pCurr->GetSymbol();
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 79bff15..10bac7e 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -31,7 +31,6 @@
#include "svl/svldllapi.h"
#include <tools/string.hxx>
#include <i18npool/lang.h>
-#include <svl/svarray.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/i18n/NumberFormatCode.hpp>
@@ -42,6 +41,7 @@
#include <map>
#include <set>
+#include <boost/ptr_container/ptr_vector.hpp>
class Date;
class SvStream;
@@ -316,8 +316,7 @@ public:
static sal_Char GetEuroSymbol( rtl_TextEncoding eTextEncoding );
};
-typedef NfCurrencyEntry* NfCurrencyEntryPtr;
-SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128 )
+typedef boost::ptr_vector<NfCurrencyEntry> NfCurrencyTable;
typedef String* WSStringPtr;
class SVL_DLLPUBLIC NfWSStringsDtor : public std::vector<WSStringPtr>
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 65f4922..0228ac7 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -185,7 +185,6 @@ namespace
}
sal_uInt16 SvNumberFormatter::nSystemCurrencyPosition = 0;
-SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* );
// Whether BankSymbol (not CurrencySymbol!) is always at the end (1 $;-1 $) or
// language dependent.
@@ -3064,7 +3063,7 @@ const NfCurrencyEntry* SvNumberFormatter::MatchSystemCurrency()
{
// MUST call GetTheCurrencyTable() before accessing nSystemCurrencyPosition
const NfCurrencyTable& rTable = GetTheCurrencyTable();
- return nSystemCurrencyPosition ? rTable[nSystemCurrencyPosition] : NULL;
+ return nSystemCurrencyPosition ? &rTable[nSystemCurrencyPosition] : NULL;
}
@@ -3074,20 +3073,19 @@ const NfCurrencyEntry& SvNumberFormatter::GetCurrencyEntry( LanguageType eLang )
if ( eLang == LANGUAGE_SYSTEM )
{
const NfCurrencyEntry* pCurr = MatchSystemCurrency();
- return pCurr ? *pCurr : *(GetTheCurrencyTable()[0]);
+ return pCurr ? *pCurr : GetTheCurrencyTable()[0];
}
else
{
eLang = MsLangId::getRealLanguage( eLang );
const NfCurrencyTable& rTable = GetTheCurrencyTable();
- sal_uInt16 nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( sal_uInt16 j = 0; j < nCount; j++, ppData++ )
+ sal_uInt16 nCount = rTable.size();
+ for ( sal_uInt16 j = 0; j < nCount; j++ )
{
- if ( (*ppData)->GetLanguage() == eLang )
- return **ppData;
+ if ( rTable[j].GetLanguage() == eLang )
+ return rTable[j];
}
- return *(rTable[0]);
+ return rTable[0];
}
}
@@ -3098,13 +3096,12 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry(
{
eLang = MsLangId::getRealLanguage( eLang );
const NfCurrencyTable& rTable = GetTheCurrencyTable();
- sal_uInt16 nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( sal_uInt16 j = 0; j < nCount; j++, ppData++ )
+ sal_uInt16 nCount = rTable.size();
+ for ( sal_uInt16 j = 0; j < nCount; j++ )
{
- if ( (*ppData)->GetLanguage() == eLang &&
- (*ppData)->GetBankSymbol() == rAbbrev )
- return *ppData;
+ if ( rTable[j].GetLanguage() == eLang &&
+ rTable[j].GetBankSymbol() == rAbbrev )
+ return &rTable[j];
}
return NULL;
}
@@ -3117,13 +3114,12 @@ const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry(
if (!bCurrencyTableInitialized)
GetTheCurrencyTable(); // just for initialization
const NfCurrencyTable& rTable = theLegacyOnlyCurrencyTable::get();
- sal_uInt16 nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( sal_uInt16 j = 0; j < nCount; j++, ppData++ )
+ sal_uInt16 nCount = rTable.size();
+ for ( sal_uInt16 j = 0; j < nCount; j++ )
{
- if ( (*ppData)->GetSymbol() == rSymbol &&
- (*ppData)->GetBankSymbol() == rAbbrev )
- return *ppData;
+ if ( rTable[j].GetSymbol() == rSymbol &&
+ rTable[j].GetBankSymbol() == rAbbrev )
+ return &rTable[j];
}
return NULL;
}
@@ -3148,13 +3144,12 @@ void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, Languag
if ( eLang == LANGUAGE_SYSTEM )
eLang = SvtSysLocale().GetLanguage();
const NfCurrencyTable& rTable = GetTheCurrencyTable();
- sal_uInt16 nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
+ sal_uInt16 nCount = rTable.size();
if ( rAbbrev.Len() )
{
- for ( sal_uInt16 j = 0; j < nCount; j++, ppData++ )
+ for ( sal_uInt16 j = 0; j < nCount; j++ )
{
- if ( (*ppData)->GetLanguage() == eLang && (*ppData)->GetBankSymbol() == rAbbrev )
+ if ( rTable[j].GetLanguage() == eLang && rTable[j].GetBankSymbol() == rAbbrev )
{
nSystemCurrencyPosition = j;
return ;
@@ -3163,9 +3158,9 @@ void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, Languag
}
else
{
- for ( sal_uInt16 j = 0; j < nCount; j++, ppData++ )
+ for ( sal_uInt16 j = 0; j < nCount; j++ )
{
- if ( (*ppData)->GetLanguage() == eLang )
+ if ( rTable[j].GetLanguage() == eLang )
{
nSystemCurrencyPosition = j;
return ;
@@ -3382,23 +3377,22 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
eExtLang = LANGUAGE_DONTKNOW;
const NfCurrencyEntry* pFoundEntry = NULL;
const NfCurrencyTable& rTable = GetTheCurrencyTable();
- sal_uInt16 nCount = rTable.Count();
+ sal_uInt16 nCount = rTable.size();
bool bCont = true;
// first try with given extension language/country
if ( nExtLen )
{
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( sal_uInt16 j = 0; j < nCount && bCont; j++, ppData++ )
+ for ( sal_uInt16 j = 0; j < nCount && bCont; j++ )
{
- LanguageType eLang = (*ppData)->GetLanguage();
+ LanguageType eLang = rTable[j].GetLanguage();
if ( eLang == eExtLang ||
((eExtLang == LANGUAGE_DONTKNOW) &&
(eLang == LANGUAGE_SYSTEM))
)
{
bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank,
- *ppData, j, rSymbol );
+ &rTable[j], j, rSymbol );
}
}
}
@@ -3410,17 +3404,16 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
if ( !bOnlyStringLanguage )
{
// now try the language/country of the number format
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( sal_uInt16 j = 0; j < nCount && bCont; j++, ppData++ )
+ for ( sal_uInt16 j = 0; j < nCount && bCont; j++ )
{
- LanguageType eLang = (*ppData)->GetLanguage();
+ LanguageType eLang = rTable[j].GetLanguage();
if ( eLang == eFormatLanguage ||
((eFormatLanguage == LANGUAGE_DONTKNOW) &&
(eLang == LANGUAGE_SYSTEM))
)
{
bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank,
- *ppData, j, rSymbol );
+ &rTable[j], j, rSymbol );
}
}
@@ -3432,11 +3425,10 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
// then try without language/country if no extension specified
if ( !nExtLen )
{
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( sal_uInt16 j = 0; j < nCount && bCont; j++, ppData++ )
+ for ( sal_uInt16 j = 0; j < nCount && bCont; j++ )
{
bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank,
- *ppData, j, rSymbol );
+ &rTable[j], j, rSymbol );
}
}
@@ -3553,11 +3545,11 @@ void SvNumberFormatter::ImpInitCurrencyTable()
aConfiguredCurrencyAbbrev, eConfiguredCurrencyLanguage );
sal_uInt16 nSecondarySystemCurrencyPosition = 0;
sal_uInt16 nMatchingSystemCurrencyPosition = 0;
- NfCurrencyEntryPtr pEntry;
+ NfCurrencyEntry* pEntry;
// first entry is SYSTEM
pEntry = new NfCurrencyEntry( *pLocaleData, LANGUAGE_SYSTEM );
- theCurrencyTable::get().Insert( pEntry, 0 );
+ theCurrencyTable::get().insert( theCurrencyTable::get().begin(), pEntry );
sal_uInt16 nCurrencyPos = 1;
::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > xLoc =
@@ -3594,7 +3586,7 @@ void SvNumberFormatter::ImpInitCurrencyTable()
if (LocaleDataWrapper::areChecksEnabled())
lcl_CheckCurrencySymbolPosition( *pEntry );
- rCurrencyTable.Insert( pEntry, nCurrencyPos++ );
+ rCurrencyTable.insert( rCurrencyTable.begin() + nCurrencyPos++, pEntry );
if ( !nSystemCurrencyPosition && (aConfiguredCurrencyAbbrev.Len() ?
pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev &&
pEntry->GetLanguage() == eConfiguredCurrencyLanguage : false) )
@@ -3612,19 +3604,18 @@ void SvNumberFormatter::ImpInitCurrencyTable()
if (pCurrencies[nCurrency].LegacyOnly)
{
pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang );
- rLegacyOnlyCurrencyTable.Insert( pEntry, nLegacyOnlyCurrencyPos++ );
+ rLegacyOnlyCurrencyTable.insert( rLegacyOnlyCurrencyTable.begin() + nLegacyOnlyCurrencyPos++, pEntry );
}
else if ( nCurrency != nDefault )
{
pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang );
// no dupes
bool bInsert = true;
- NfCurrencyEntry const * const * pData = rCurrencyTable.GetData();
- sal_uInt16 n = rCurrencyTable.Count();
- pData++; // skip first SYSTEM entry
+ sal_uInt16 n = rCurrencyTable.size();
+ sal_uInt16 aCurrencyIndex = 1; // skip first SYSTEM entry
for ( sal_uInt16 j=1; j<n; j++ )
{
- if ( *(*pData++) == *pEntry )
+ if ( rCurrencyTable[aCurrencyIndex++] == *pEntry )
{
bInsert = false;
break; // for
@@ -3634,7 +3625,7 @@ void SvNumberFormatter::ImpInitCurrencyTable()
delete pEntry;
else
{
- rCurrencyTable.Insert( pEntry, nCurrencyPos++ );
+ rCurrencyTable.insert( rCurrencyTable.begin() + nCurrencyPos++, pEntry );
if ( !nSecondarySystemCurrencyPosition &&
(aConfiguredCurrencyAbbrev.Len() ?
pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev :
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index b2ee52a..ef25577 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -1012,11 +1012,11 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
if ( !bTmpBanking && nCurCategory != NUMBERFORMAT_ALL )
{ // append formats for all currencies defined in the current I18N locale
const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCurrCount = rCurrencyTable.Count();
+ sal_uInt16 nCurrCount = rCurrencyTable.size();
LanguageType eLang = MsLangId::getRealLanguage( eCurLanguage );
for ( sal_uInt16 i=0; i < nCurrCount; ++i )
{
- const NfCurrencyEntry* pCurr = rCurrencyTable[i];
+ const NfCurrencyEntry* pCurr = &rCurrencyTable[i];
if ( pCurr->GetLanguage() == eLang && pTmpCurrencyEntry != pCurr )
{
pFormatter->GetCurrencyFormatStrings( aWSStringsDtor, *pCurr, false );
@@ -1513,7 +1513,7 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList,
if(pPos!=NULL)
{
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nTableCount=rCurrencyTable.Count();
+ sal_uInt16 nTableCount=rCurrencyTable.size();
*pPos=0;
size_t nCount=aCurCurrencyList.size();
@@ -1529,7 +1529,7 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList,
{
const sal_uInt16 j = aCurCurrencyList[i];
if (j != (sal_uInt16)-1 && j < nTableCount &&
- pTmpCurrencyEntry == rCurrencyTable[j])
+ pTmpCurrencyEntry == &rCurrencyTable[j])
{
*pPos=static_cast<sal_uInt16>(i);
nCurCurrencyEntryPos=static_cast<sal_uInt16>(i);
@@ -1546,15 +1546,15 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList,
aCurCurrencyList.clear();
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nCount=rCurrencyTable.size();
SvtLanguageTable* pLanguageTable=new SvtLanguageTable;
sal_uInt16 nStart=1;
- XubString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0]->GetSymbol()));
+ XubString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0].GetSymbol()));
aString += sal_Unicode(' ');
- aString += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[0]->GetLanguage()));
+ aString += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[0].GetLanguage()));
rList.push_back(aString);
sal_uInt16 nAuto=(sal_uInt16)-1;
@@ -1574,11 +1574,11 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList,
for(sal_uInt16 i = 1; i < nCount; ++i)
{
- XubString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol()));
+ XubString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i].GetBankSymbol()));
aStr += aTwoSpace;
- aStr += ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetSymbol());
+ aStr += ApplyLreOrRleEmbedding( rCurrencyTable[i].GetSymbol());
aStr += aTwoSpace;
- aStr += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[i]->GetLanguage()));
+ aStr += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[i].GetLanguage()));
sal_uInt16 j = nStart;
for(; j < rList.size(); ++j)
@@ -1597,7 +1597,7 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList,
for(sal_uInt16 i = 1; i < nCount; ++i)
{
bool bInsert = true;
- rtl::OUString aStr(ApplyLreOrRleEmbedding(rCurrencyTable[i]->GetBankSymbol()));
+ rtl::OUString aStr(ApplyLreOrRleEmbedding(rCurrencyTable[i].GetBankSymbol()));
sal_uInt16 j = nCont;
for(; j < rList.size() && bInsert; ++j)
@@ -1620,7 +1620,7 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList,
void SvxNumberFormatShell::SetCurrencySymbol(sal_uInt16 nPos)
{
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nCount=rCurrencyTable.size();
bBankingSymbol=(nPos>=nCount);
@@ -1629,7 +1629,7 @@ void SvxNumberFormatShell::SetCurrencySymbol(sal_uInt16 nPos)
sal_uInt16 nCurrencyPos=aCurCurrencyList[nPos];
if(nCurrencyPos!=(sal_uInt16)-1)
{
- pCurCurrencyEntry=rCurrencyTable[nCurrencyPos];
+ pCurCurrencyEntry=(NfCurrencyEntry*)&rCurrencyTable[nCurrencyPos];
nCurCurrencyEntryPos=nPos;
}
else
@@ -1667,7 +1667,7 @@ bool SvxNumberFormatShell::IsTmpCurrencyFormat( const String& rFmtString )
sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const String& rFmtString )
{
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nCount=rCurrencyTable.size();
bool bTestBanking=false;
@@ -1693,7 +1693,7 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin
sal_uInt16 nPos=(sal_uInt16) -1;
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nCount=rCurrencyTable.size();
const SvNumberformat* pFormat;
String aSymbol, aExtension;
@@ -1709,7 +1709,7 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin
{
for(sal_uInt16 i=0;i<nCount;i++)
{
- if(pTmpCurrencyEntry==rCurrencyTable[i])
+ if(pTmpCurrencyEntry==&rCurrencyTable[i])
{
nPos=i;
break;
@@ -1721,7 +1721,7 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin
{ // search symbol string only
for(sal_uInt16 i=0;i<nCount;i++)
{
- const NfCurrencyEntry* pTmpCurrencyEntry=rCurrencyTable[i];
+ const NfCurrencyEntry* pTmpCurrencyEntry=&rCurrencyTable[i];
XubString _aSymbol, aBankSymbol;
pTmpCurrencyEntry->BuildSymbolString(_aSymbol,false);
pTmpCurrencyEntry->BuildSymbolString(aBankSymbol,true);
@@ -1747,12 +1747,12 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin
sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,bool bTmpBanking)
{
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nCount=rCurrencyTable.size();
sal_uInt16 nPos=0;
for(sal_uInt16 i=0;i<nCount;i++)
{
- if(pTmpCurrencyEntry==rCurrencyTable[i])
+ if(pTmpCurrencyEntry==&rCurrencyTable[i])
{
nPos=i;
break;
@@ -1778,13 +1778,13 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,bool bTmpBanking,const Stri
if(nPos!=(sal_uInt16)-1)
{
const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
- sal_uInt16 nCount=rCurrencyTable.Count();
+ sal_uInt16 nCount=rCurrencyTable.size();
if(nPos<nCount)
{
NfWSStringsDtor aWSStringsDtor;
- const NfCurrencyEntry* pTmpCurrencyEntry=rCurrencyTable[nPos];
+ const NfCurrencyEntry* pTmpCurrencyEntry=&rCurrencyTable[nPos];
if ( pTmpCurrencyEntry!=NULL)
{
commit 072a67d198120a1e7a0cea16e834e33fcc9631bc
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jun 12 17:22:34 2012 +0200
Convert SV_DECL_PTRARR_DEL(NfWSStringsDtor) to std::vector
I had to keep the pointer typedef because MacOS gcc gets
confused otherwise.
Change-Id: I0681585f7273dcac25b2cb835601b29353e2183a
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 7012164..79bff15 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -318,8 +318,18 @@ public:
typedef NfCurrencyEntry* NfCurrencyEntryPtr;
SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128 )
+
typedef String* WSStringPtr;
-SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, SVL_DLLPUBLIC )
+class SVL_DLLPUBLIC NfWSStringsDtor : public std::vector<WSStringPtr>
+{
+public:
+ ~NfWSStringsDtor()
+ {
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+ }
+
+};
class SvNumberFormatterRegistry_Impl;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 7c8a49c..65f4922 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -186,7 +186,6 @@ namespace
}
sal_uInt16 SvNumberFormatter::nSystemCurrencyPosition = 0;
SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* );
-SV_IMPL_PTRARR( NfWSStringsDtor, String* );
// Whether BankSymbol (not CurrencySymbol!) is always at the end (1 $;-1 $) or
// language dependent.
@@ -3192,10 +3191,10 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
NfWSStringsDtor aCurrList;
sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList,
GetCurrencyEntry( LANGUAGE_SYSTEM ), false );
- DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency System standard format?!?" );
+ DBG_ASSERT( aCurrList.size(), "where is the NewCurrency System standard format?!?" );
// if already loaded or user defined nDefaultSystemCurrencyFormat
// will be set to the right value
- PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType,
+ PutEntry( *aCurrList[ nDefault ], nCheck, nType,
nDefaultSystemCurrencyFormat, LANGUAGE_SYSTEM );
DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
DBG_ASSERT( nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
@@ -3234,13 +3233,13 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
NfWSStringsDtor aCurrList;
sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList,
GetCurrencyEntry( ActLnge ), false );
- DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency standard format?" );
- if ( aCurrList.Count() )
+ DBG_ASSERT( aCurrList.size(), "where is the NewCurrency standard format?" );
+ if ( !aCurrList.empty() )
{
// if already loaded or user defined nDefaultSystemCurrencyFormat
// will be set to the right value
short nType;
- PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType,
+ PutEntry( *aCurrList[ nDefault ], nCheck, nType,
nDefaultCurrencyFormat, ActLnge );
DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
@@ -3694,9 +3693,9 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
*pFormat1 += aNegativeBank;
*pFormat2 += aNegativeBank;
- rStrArr.Insert( pFormat1, rStrArr.Count() );
- rStrArr.Insert( pFormat2, rStrArr.Count() );
- nDefault = rStrArr.Count() - 1;
+ rStrArr.push_back( pFormat1 );
+ rStrArr.push_back( pFormat2 );
+ nDefault = rStrArr.size() - 1;
}
else
{
@@ -3750,14 +3749,14 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
*pFormat4 += aNegative;
if ( pFormat1 )
- rStrArr.Insert( pFormat1, rStrArr.Count() );
- rStrArr.Insert( pFormat2, rStrArr.Count() );
+ rStrArr.push_back( pFormat1 );
+ rStrArr.push_back( pFormat2 );
if ( pFormat3 )
- rStrArr.Insert( pFormat3, rStrArr.Count() );
- rStrArr.Insert( pFormat4, rStrArr.Count() );
- nDefault = rStrArr.Count() - 1;
+ rStrArr.push_back( pFormat3 );
+ rStrArr.push_back( pFormat4 );
+ nDefault = rStrArr.size() - 1;
if ( pFormat5 )
- rStrArr.Insert( pFormat5, rStrArr.Count() );
+ rStrArr.push_back( pFormat5 );
}
return nDefault;
}
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index d696123..b2ee52a 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -1026,8 +1026,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
}
size_t nOldListCount = rList.size();
- for( size_t i = 0, nPos = nOldListCount;
- i < static_cast<size_t>(aWSStringsDtor.Count()); ++i )
+ for( size_t i = 0, nPos = nOldListCount; i < aWSStringsDtor.size(); ++i )
{
bool bFlag = true;
String aInsStr(*aWSStringsDtor[i]);
@@ -1792,7 +1791,7 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,bool bTmpBanking,const Stri
pFormatter->GetCurrencyFormatStrings( aWSStringsDtor,
*pTmpCurrencyEntry, bTmpBanking );
- for(sal_uInt16 i=0;i<aWSStringsDtor.Count();i++)
+ for(sal_uInt16 i=0;i<aWSStringsDtor.size();i++)
{
if(*aWSStringsDtor[i]==rFmtString)
{
commit 2a360b68475d6fff5b6618feddb0b52f3a4a2373
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jun 12 15:41:27 2012 +0200
Convert SV_DECL_PTRARR(SvBaseLinks) to std::vector
Change-Id: I9197dc4fd7ed32f030de8121913265ec78c83585
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index b61e721..5df9370 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -283,7 +283,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl)
SvBaseLinkRef xLink = aLnkArr[ n ];
// first look for the entry in the array
- for( sal_uInt16 i = 0; i < pLinkMgr->GetLinks().Count(); ++i )
+ for( sal_uInt16 i = 0; i < pLinkMgr->GetLinks().size(); ++i )
if( &xLink == *pLinkMgr->GetLinks()[ i ] )
{
xLink->SetUseCache( sal_False );
@@ -513,7 +513,7 @@ IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink*, _pLink )
// anymore, fill the list completely new. Otherwise only the
// edited link needs to be refreshed.
sal_Bool bLinkFnd = sal_False;
- for( sal_uInt16 n = pLinkMgr->GetLinks().Count(); n; )
+ for( sal_uInt16 n = pLinkMgr->GetLinks().size(); n; )
if( _pLink == &(*pLinkMgr->GetLinks()[ --n ]) )
{
bLinkFnd = sal_True;
@@ -575,12 +575,12 @@ void SvBaseLinksDlg::SetManager( LinkManager* pNewMgr )
if( pLinkMgr )
{
SvBaseLinks& rLnks = (SvBaseLinks&)pLinkMgr->GetLinks();
- for( sal_uInt16 n = 0; n < rLnks.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rLnks.size(); ++n )
{
SvBaseLinkRef* pLinkRef = rLnks[ n ];
if( !pLinkRef->Is() )
{
- rLnks.Remove( n, 1 );
+ rLnks.erase( rLnks.begin() + n );
--n;
continue;
}
@@ -588,7 +588,7 @@ void SvBaseLinksDlg::SetManager( LinkManager* pNewMgr )
InsertEntry( **pLinkRef );
}
- if( rLnks.Count() )
+ if( !rLnks.empty() )
{
SvLBoxEntry* pEntry = Links().GetEntry( 0 );
Links().SetCurEntry( pEntry );
@@ -673,7 +673,7 @@ void SvBaseLinksDlg::SetActLink( SvBaseLink * pLink )
{
const SvBaseLinks& rLnks = pLinkMgr->GetLinks();
sal_uInt16 nSelect = 0;
- for( sal_uInt16 n = 0; n < rLnks.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rLnks.size(); ++n )
{
SvBaseLinkRef* pLinkRef = rLnks[ n ];
// #109573# only visible links have been inserted into the TreeListBox,
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 6fcb80e..2419859 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -378,8 +378,8 @@ ScDocument::~ScDocument()
for( ::sfx2::SvLinkSources::const_iterator it = aTemp.begin(); it != aTemp.end(); ++it )
(*it)->Closed();
- if ( pLinkManager->GetLinks().Count() )
- pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() );
+ if ( pLinkManager->GetLinks().size() )
+ pLinkManager->Remove( 0, pLinkManager->GetLinks().size() );
}
mxFormulaParserPool.reset();
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 1d14078..11a640c 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -908,7 +908,7 @@ bool ScDocument::IdleCheckLinks() // true = demnaechst wieder versuche
if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
@@ -934,7 +934,7 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const
bool bExport40 = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 );
const ::sfx2::SvBaseLinks& rLinks = GetLinkManager()->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
// erstmal zaehlen...
@@ -987,7 +987,7 @@ bool ScDocument::HasDdeLinks() const
if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
if ((*rLinks[i])->ISA(ScDdeLink))
return true;
@@ -1015,7 +1015,7 @@ void ScDocument::UpdateExternalRefLinks(Window* pWin)
return;
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
bool bAny = false;
for (sal_uInt16 i = 0; i < nCount; ++i)
@@ -1069,7 +1069,7 @@ void ScDocument::UpdateDdeLinks(Window* pWin)
if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
sal_uInt16 i;
// falls das Updaten laenger dauert, erstmal alle Werte
@@ -1128,7 +1128,7 @@ bool ScDocument::UpdateDdeLink( const rtl::OUString& rAppl, const rtl::OUString&
if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
@@ -1154,7 +1154,7 @@ void ScDocument::DisconnectDdeLinks()
if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
@@ -1177,7 +1177,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
else if (GetLinkManager()) // Links direkt kopieren
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
@@ -1198,7 +1198,7 @@ sal_uInt16 ScDocument::GetDdeLinkCount() const
if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
if ((*rLinks[i])->ISA(ScDdeLink))
++nDdeCount;
@@ -1222,7 +1222,7 @@ ScDdeLink* lclGetDdeLink(
if( pLinkManager )
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
if( pnDdePos ) *pnDdePos = 0;
for( sal_uInt16 nIndex = 0; nIndex < nCount; ++nIndex )
{
@@ -1249,7 +1249,7 @@ ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* pLinkManager, sal_uInt16 nDde
if( pLinkManager )
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
sal_uInt16 nDdeIndex = 0; // counts only the DDE links
for( sal_uInt16 nIndex = 0; nIndex < nCount; ++nIndex )
{
@@ -1345,7 +1345,7 @@ bool ScDocument::HasAreaLinks() const
if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
if ((*rLinks[i])->ISA(ScAreaLink))
return true;
@@ -1359,7 +1359,7 @@ void ScDocument::UpdateAreaLinks()
if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
@@ -1375,7 +1375,7 @@ void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab )
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
sal_uInt16 nPos = 0;
- while ( nPos < rLinks.Count() )
+ while ( nPos < rLinks.size() )
{
const ::sfx2::SvBaseLink* pBase = *rLinks[nPos];
if ( pBase->ISA(ScAreaLink) &&
@@ -1395,7 +1395,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
bool bAnyUpdate = false;
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
- sal_uInt16 nCount = rLinks.Count();
+ sal_uInt16 nCount = rLinks.size();
for (sal_uInt16 i=0; i<nCount; i++)
{
::sfx2::SvBaseLink* pBase = *rLinks[i];
@@ -1446,7 +1446,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
{
// remove the first link, exit the inner loop, don't increment nFirstIndex
pLinkManager->Remove( pFirst );
- nCount = rLinks.Count();
+ nCount = rLinks.size();
bFound = true;
}
}
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 5d36e52..5bac102 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -238,7 +238,7 @@ void ScDdeLink::ListenersGone()
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list