summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-12-11 15:16:51 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-12-11 15:16:51 +0100
commit90f91088d238469b4a2262c91de3117ba40f5bde (patch)
treebad912690be028b4242744eed6755b36bb1bcefa /svl
parent2fa2d39bf3eb2f216e13f6dd2c6c5c35fd19627c (diff)
Don't hold css::uno::Type instances by pointer
...in comphelper::PropertyMapEntry and SfxItemPropertyMapEntry. And as the arrays of such need to be initialized dynamically anyway, also change their name members to proper OUStrings while at it. Plus some const clean-up. Change-Id: I67d4d7b5773fb020605f369daf39528bec930606
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemprop.cxx17
-rw-r--r--svl/source/numbers/numfmuno.cxx38
2 files changed, 26 insertions, 29 deletions
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 00ca36e2218c..8e88b781b22e 100644
--- a/svl/source/items/itemprop.cxx
+++ b/svl/source/items/itemprop.cxx
@@ -62,10 +62,9 @@ SfxItemPropertyMap_Impl::SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl*
SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ) :
m_pImpl( new SfxItemPropertyMap_Impl )
{
- while( pEntries->pName )
+ while( !pEntries->aName.isEmpty() )
{
- OUString sEntry(pEntries->pName, pEntries->nNameLen, RTL_TEXTENCODING_ASCII_US );
- (*m_pImpl) [ sEntry ] = pEntries;
+ (*m_pImpl) [ pEntries->aName ] = pEntries;
++pEntries;
}
}
@@ -102,8 +101,7 @@ uno::Sequence<beans::Property> SfxItemPropertyMap::getProperties() const
const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
pPropArray[n].Name = (*aIt).first;
pPropArray[n].Handle = pEntry->nWID;
- if(pEntry->pType)
- pPropArray[n].Type = *pEntry->pType;
+ pPropArray[n].Type = pEntry->aType;
pPropArray[n].Attributes =
sal::static_int_cast< sal_Int16 >(pEntry->nFlags);
n++;
@@ -124,8 +122,7 @@ beans::Property SfxItemPropertyMap::getPropertyByName( const OUString rName ) co
beans::Property aProp;
aProp.Name = rName;
aProp.Handle = pEntry->nWID;
- if(pEntry->pType)
- aProp.Type = *pEntry->pType;
+ aProp.Type = pEntry->aType;
aProp.Attributes = sal::static_int_cast< sal_Int16 >(pEntry->nFlags);
return aProp;
}
@@ -144,7 +141,7 @@ void SfxItemPropertyMap::mergeProperties( const uno::Sequence< beans::Property >
{
SfxItemPropertySimpleEntry aTemp(
sal::static_int_cast< sal_Int16 >( pPropArray[nElement].Handle ), //nWID
- &pPropArray[nElement].Type, //pType
+ pPropArray[nElement].Type, //aType
pPropArray[nElement].Attributes, //nFlags
0 ); //nMemberId
(*m_pImpl)[pPropArray[nElement].Name] = aTemp;
@@ -209,11 +206,11 @@ void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEn
// convert general SfxEnumItem values to specific values
- if( rEntry.pType && TypeClass_ENUM == rEntry.pType->getTypeClass() &&
+ if( rEntry.aType.getTypeClass() == TypeClass_ENUM &&
rAny.getValueTypeClass() == TypeClass_LONG )
{
sal_Int32 nTmp = *(sal_Int32*)rAny.getValue();
- rAny.setValue( &nTmp, *rEntry.pType );
+ rAny.setValue( &nTmp, rEntry.aType );
}
}
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index daa5bfbe3c45..5ab09bbe9539 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -64,20 +64,20 @@ static const SfxItemPropertyMapEntry* lcl_GetNumberFormatPropertyMap()
{
static const SfxItemPropertyMapEntry aNumberFormatPropertyMap_Impl[] =
{
- {MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_TYPE), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_COMMENT), 0, &getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_CURREXT), 0, &getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_CURRSYM), 0, &getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_DECIMALS), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_LEADING), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_NEGRED), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_STDFORM), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_THOUS), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_USERDEF), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_CURRABB), 0, &getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {0,0,0,0,0,0}
+ {PROPERTYNAME_FMTSTR, 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_LOCALE, 0, getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_TYPE, 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_COMMENT, 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_CURREXT, 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_CURRSYM, 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_DECIMALS, 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_LEADING, 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_NEGRED, 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_STDFORM, 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_THOUS, 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_USERDEF, 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {PROPERTYNAME_CURRABB, 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {}
};
return aNumberFormatPropertyMap_Impl;
}
@@ -86,11 +86,11 @@ static const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap()
{
static const SfxItemPropertyMapEntry aNumberSettingsPropertyMap_Impl[] =
{
- {MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_STDDEC), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_TWODIGIT), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
- {0,0,0,0,0,0}
+ {PROPERTYNAME_NOZERO, 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0},
+ {PROPERTYNAME_NULLDATE, 0, getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0},
+ {PROPERTYNAME_STDDEC, 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
+ {PROPERTYNAME_TWODIGIT, 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
+ {}
};
return aNumberSettingsPropertyMap_Impl;
}