summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2012-01-21 01:53:20 -0500
committerAugust Sodora <augsod@gmail.com>2012-01-21 01:54:20 -0500
commit411d8c2dd1cb3a9a6dbd78f34852e46c6e80f904 (patch)
tree5eee86529c88f0851c8047e1534eb177765e001b /svtools
parentcba8c3b64ef1fbd7c1454546d1de1fb0a9fe1ebd (diff)
SV_DECL_PTRARR_DEL->boost::ptr_vector
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/config/fontsubstconfig.cxx47
1 files changed, 22 insertions, 25 deletions
diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx
index 7f9af4e4f169..57ef12234eae 100644
--- a/svtools/source/config/fontsubstconfig.cxx
+++ b/svtools/source/config/fontsubstconfig.cxx
@@ -26,17 +26,17 @@
*
************************************************************************/
-
#include <svtools/fontsubstconfig.hxx>
#include <svl/svarray.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <tools/debug.hxx>
-
#include <vcl/outdev.hxx>
#include <rtl/logfile.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
+
using namespace utl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -54,11 +54,8 @@ const sal_Char cSubstituteFont[]= "SubstituteFont";
const sal_Char cOnScreenOnly[] = "OnScreenOnly";
const sal_Char cAlways[] = "Always";
-//-----------------------------------------------------------------------------
-typedef SubstitutionStruct* SubstitutionStructPtr;
-SV_DECL_PTRARR_DEL(SubstitutionStructArr, SubstitutionStructPtr, 2, 2)
-SV_IMPL_PTRARR(SubstitutionStructArr, SubstitutionStructPtr);
-//-----------------------------------------------------------------------------
+typedef boost::ptr_vector<SubstitutionStruct> SubstitutionStructArr;
+
struct SvtFontSubstConfig_Impl
{
SubstitutionStructArr aSubstArr;
@@ -101,12 +98,12 @@ SvtFontSubstConfig::SvtFontSubstConfig() :
nName = 0;
for(nNode = 0; nNode < aNodeNames.getLength(); nNode++)
{
- SubstitutionStructPtr pInsert = new SubstitutionStruct;
+ SubstitutionStruct* pInsert = new SubstitutionStruct;
pNodeValues[nName++] >>= pInsert->sFont;
pNodeValues[nName++] >>= pInsert->sReplaceBy;
pInsert->bReplaceAlways = *(sal_Bool*)pNodeValues[nName++].getValue();
pInsert->bReplaceOnScreenOnly = *(sal_Bool*)pNodeValues[nName++].getValue();
- pImpl->aSubstArr.Insert(pInsert, pImpl->aSubstArr.Count());
+ pImpl->aSubstArr.push_back(pInsert);
}
}
@@ -128,11 +125,11 @@ void SvtFontSubstConfig::Commit()
PutProperties(aNames, aValues);
OUString sNode(C2U(cFontPairs));
- if(!pImpl->aSubstArr.Count())
+ if(pImpl->aSubstArr.empty())
ClearNodeSet(sNode);
else
{
- Sequence<PropertyValue> aSetValues(4 * pImpl->aSubstArr.Count());
+ Sequence<PropertyValue> aSetValues(4 * pImpl->aSubstArr.size());
PropertyValue* pSetValues = aSetValues.getArray();
sal_Int32 nSetValue = 0;
@@ -142,22 +139,22 @@ void SvtFontSubstConfig::Commit()
const OUString sOnScreenOnly(C2U(cOnScreenOnly));
const uno::Type& rBoolType = ::getBooleanCppuType();
- for(sal_uInt16 i = 0; i < pImpl->aSubstArr.Count(); i++)
+ for(size_t i = 0; i < pImpl->aSubstArr.size(); i++)
{
OUString sPrefix(sNode);
sPrefix += C2U("/_");
sPrefix += OUString::valueOf((sal_Int32)i);
sPrefix += C2U("/");
- SubstitutionStructPtr pSubst = pImpl->aSubstArr[i];
+ SubstitutionStruct& pSubst = pImpl->aSubstArr[i];
pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sReplaceFont;
- pSetValues[nSetValue++].Value <<= pSubst->sFont;
+ pSetValues[nSetValue++].Value <<= pSubst.sFont;
pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sSubstituteFont;
- pSetValues[nSetValue++].Value <<= pSubst->sReplaceBy;
+ pSetValues[nSetValue++].Value <<= pSubst.sReplaceBy;
pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sAlways;
- pSetValues[nSetValue++].Value.setValue(&pSubst->bReplaceAlways, rBoolType);
+ pSetValues[nSetValue++].Value.setValue(&pSubst.bReplaceAlways, rBoolType);
pSetValues[nSetValue].Name = sPrefix; pSetValues[nSetValue].Name += sOnScreenOnly;
- pSetValues[nSetValue++].Value.setValue(&pSubst->bReplaceOnScreenOnly, rBoolType);
+ pSetValues[nSetValue++].Value.setValue(&pSubst.bReplaceOnScreenOnly, rBoolType);
}
ReplaceSetProperties(sNode, aSetValues);
}
@@ -165,26 +162,26 @@ void SvtFontSubstConfig::Commit()
sal_Int32 SvtFontSubstConfig::SubstitutionCount() const
{
- return pImpl->aSubstArr.Count();
+ return pImpl->aSubstArr.size();
}
void SvtFontSubstConfig::ClearSubstitutions()
{
- pImpl->aSubstArr.DeleteAndDestroy(0, pImpl->aSubstArr.Count());
+ pImpl->aSubstArr.clear();
}
const SubstitutionStruct* SvtFontSubstConfig::GetSubstitution(sal_Int32 nPos)
{
- DBG_ASSERT(nPos >= 0 && nPos < pImpl->aSubstArr.Count(), "illegal array index");
- if(nPos >= 0 && nPos < pImpl->aSubstArr.Count())
- return pImpl->aSubstArr[(sal_uInt16)nPos];
- return 0;
+ sal_Int32 nCount = static_cast<sal_Int32>(pImpl->aSubstArr.size());
+ DBG_ASSERT(nPos >= 0 && nPos < nCount, "illegal array index");
+ if(nPos >= 0 && nPos < nCount)
+ return &pImpl->aSubstArr[nPos];
+ return NULL;
}
void SvtFontSubstConfig::AddSubstitution(const SubstitutionStruct& rToAdd)
{
- SubstitutionStructPtr pInsert = new SubstitutionStruct(rToAdd);
- pImpl->aSubstArr.Insert(pInsert, pImpl->aSubstArr.Count());
+ pImpl->aSubstArr.push_back(new SubstitutionStruct(rToAdd));
}
void SvtFontSubstConfig::Apply()