summaryrefslogtreecommitdiff
path: root/svx/source/form
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 /svx/source/form
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 'svx/source/form')
-rw-r--r--svx/source/form/dataaccessdescriptor.cxx50
1 files changed, 24 insertions, 26 deletions
diff --git a/svx/source/form/dataaccessdescriptor.cxx b/svx/source/form/dataaccessdescriptor.cxx
index 02dde6b27ab4..5c80ac6d159f 100644
--- a/svx/source/form/dataaccessdescriptor.cxx
+++ b/svx/source/form/dataaccessdescriptor.cxx
@@ -37,8 +37,6 @@ namespace svx
using namespace ::com::sun::star::ucb;
using namespace ::comphelper;
-#define CONST_CHAR( propname ) propname, sizeof(propname) - 1
-
//====================================================================
//= ODADescriptorImpl
//====================================================================
@@ -54,7 +52,7 @@ namespace svx
Sequence< PropertyValue > m_aAsSequence;
Reference< XPropertySet > m_xAsSet;
- typedef ::std::map< OUString, PropertyMapEntry* > MapString2PropertyEntry;
+ typedef ::std::map< OUString, PropertyMapEntry const * > MapString2PropertyEntry;
public:
ODADescriptorImpl();
@@ -79,7 +77,7 @@ namespace svx
protected:
static PropertyValue buildPropertyValue( const DescriptorValues::const_iterator& _rPos );
static const MapString2PropertyEntry& getPropertyMap( );
- static PropertyMapEntry* getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos );
+ static PropertyMapEntry const * getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos );
};
//--------------------------------------------------------------------
@@ -187,29 +185,29 @@ namespace svx
static MapString2PropertyEntry s_aProperties;
if ( s_aProperties.empty() )
{
- static PropertyMapEntry s_aDesriptorProperties[] =
+ static PropertyMapEntry const s_aDesriptorProperties[] =
{
- { CONST_CHAR("ActiveConnection"), daConnection, &::getCppuType( static_cast< Reference< XConnection >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("BookmarkSelection"), daBookmarkSelection, &::getBooleanCppuType( ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("Column"), daColumnObject, &::getCppuType( static_cast< Reference< XPropertySet >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("ColumnName"), daColumnName, &::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("Command"), daCommand, &::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("CommandType"), daCommandType, &::getCppuType( static_cast< sal_Int32* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("Component"), daComponent, &::getCppuType( static_cast< Reference< XContent >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("ConnectionResource"), daConnectionResource, &::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("Cursor"), daCursor, &::getCppuType( static_cast< Reference< XResultSet>* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("DataSourceName"), daDataSource, &::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("DatabaseLocation"), daDatabaseLocation, &::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("EscapeProcessing"), daEscapeProcessing, &::getBooleanCppuType( ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("Filter"), daFilter, &::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { CONST_CHAR("Selection"), daSelection, &::getCppuType( static_cast< Sequence< Any >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
- { NULL, 0, 0, NULL, 0, 0 }
+ { OUString("ActiveConnection"), daConnection, ::getCppuType( static_cast< Reference< XConnection >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("BookmarkSelection"), daBookmarkSelection, ::getBooleanCppuType( ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("Column"), daColumnObject, ::getCppuType( static_cast< Reference< XPropertySet >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("ColumnName"), daColumnName, ::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("Command"), daCommand, ::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("CommandType"), daCommandType, ::getCppuType( static_cast< sal_Int32* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("Component"), daComponent, ::getCppuType( static_cast< Reference< XContent >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("ConnectionResource"), daConnectionResource, ::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("Cursor"), daCursor, ::getCppuType( static_cast< Reference< XResultSet>* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("DataSourceName"), daDataSource, ::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("DatabaseLocation"), daDatabaseLocation, ::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("EscapeProcessing"), daEscapeProcessing, ::getBooleanCppuType( ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("Filter"), daFilter, ::getCppuType( static_cast< OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString("Selection"), daSelection, ::getCppuType( static_cast< Sequence< Any >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { OUString(), 0, css::uno::Type(), 0, 0 }
};
- PropertyMapEntry* pEntry = s_aDesriptorProperties;
- while ( pEntry->mpName )
+ PropertyMapEntry const * pEntry = s_aDesriptorProperties;
+ while ( !pEntry->maName.isEmpty() )
{
- s_aProperties[ OUString::createFromAscii( pEntry->mpName ) ] = pEntry;
+ s_aProperties[ pEntry->maName ] = pEntry;
++pEntry;
}
}
@@ -218,7 +216,7 @@ namespace svx
}
//--------------------------------------------------------------------
- PropertyMapEntry* ODADescriptorImpl::getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos )
+ PropertyMapEntry const * ODADescriptorImpl::getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos )
{
const MapString2PropertyEntry& rProperties = getPropertyMap();
@@ -239,11 +237,11 @@ namespace svx
PropertyValue ODADescriptorImpl::buildPropertyValue( const DescriptorValues::const_iterator& _rPos )
{
// the map entry
- PropertyMapEntry* pProperty = getPropertyMapEntry( _rPos );
+ PropertyMapEntry const * pProperty = getPropertyMapEntry( _rPos );
// build the property value
PropertyValue aReturn;
- aReturn.Name = OUString( pProperty->mpName, pProperty->mnNameLen, RTL_TEXTENCODING_ASCII_US );
+ aReturn.Name = pProperty->maName;
aReturn.Handle = pProperty->mnHandle;
aReturn.Value = _rPos->second;
aReturn.State = PropertyState_DIRECT_VALUE;