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-12 08:26:40 +0100
commita62c2a5fa5d5be465b0edab6adeb1fd16ace462f (patch)
tree47cf29b4b7a0ba3ce321ce628a6b0a6175d978d7 /svl
parentcff72ec4bf87c6484be97d954966309ba7a5eb8a (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..b71d52bcd9ff 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}
+ {OUString(PROPERTYNAME_FMTSTR), 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_LOCALE), 0, getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_TYPE), 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_COMMENT), 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_CURREXT), 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_CURRSYM), 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_DECIMALS), 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_LEADING), 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_NEGRED), 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_STDFORM), 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_THOUS), 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_USERDEF), 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ {OUString(PROPERTYNAME_CURRABB), 0, getCppuType((OUString*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
+ { OUString(), 0, css::uno::Type(), 0, 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}
+ {OUString(PROPERTYNAME_NOZERO), 0, getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0},
+ {OUString(PROPERTYNAME_NULLDATE), 0, getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0},
+ {OUString(PROPERTYNAME_STDDEC), 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
+ {OUString(PROPERTYNAME_TWODIGIT), 0, getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
+ { OUString(), 0, css::uno::Type(), 0, 0 }
};
return aNumberSettingsPropertyMap_Impl;
}