diff options
author | Oliver Specht <oliver.specht@cib.de> | 2015-09-30 16:10:07 +0200 |
---|---|---|
committer | Oliver Specht <oliver.specht@cib.de> | 2015-10-06 07:29:37 +0000 |
commit | 89d39bc100aabf5dccbe77c0b5c0c85736e85b39 (patch) | |
tree | 871a91210913ecee91530c95392534bf18f80f3f /dbaccess | |
parent | 32b9901dae7403453d773f5904de15551a323595 (diff) |
tdf#94559: 4th step to remove rtti.hxx
replaced use of PTR_CAST, IS_TYPE, ISA in
idl, editeng, sc, sd, sw, sfx2, sot, starmath
Change-Id: I4a5bba4fdc4829099618c09b690c83f876a3d653
Reviewed-on: https://gerrit.libreoffice.org/19132
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 08bd5f070712..caf452641e66 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -89,7 +89,7 @@ using namespace com::sun::star::frame; namespace { - bool implCheckItemType( SfxItemSet& _rSet, const sal_uInt16 _nId, const TypeId _nExpectedItemType ) + bool implCheckItemType( SfxItemSet& _rSet, const sal_uInt16 _nId, std::function<bool ( const SfxPoolItem* )> isItemType ) { bool bCorrectType = false; @@ -98,7 +98,7 @@ namespace if ( pPool ) { const SfxPoolItem& rDefItem = pPool->GetDefaultItem( _nId ); - bCorrectType = rDefItem.IsA( _nExpectedItemType ); + bCorrectType = isItemType(&rDefItem); } return bCorrectType; } @@ -902,13 +902,14 @@ OString ODbDataSourceAdministrationHelper::translatePropertyId( sal_Int32 _nId ) OString aReturn( aString.getStr(), aString.getLength(), RTL_TEXTENCODING_ASCII_US ); return aReturn; } +template<class T> bool checkItemType(const SfxPoolItem* pItem){ return dynamic_cast<const T*>(pItem) != nullptr;} void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue ) { switch ( _rValue.getValueType().getTypeClass() ) { case TypeClass_STRING: - if ( implCheckItemType( _rSet, _nId, SfxStringItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<SfxStringItem> ) ) { OUString sValue; _rValue >>= sValue; @@ -925,13 +926,13 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_BOOLEAN: - if ( implCheckItemType( _rSet, _nId, SfxBoolItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<SfxBoolItem> ) ) { bool bVal = false; _rValue >>= bVal; _rSet.Put(SfxBoolItem(_nId, bVal)); } - else if ( implCheckItemType( _rSet, _nId, OptionalBoolItem::StaticType() ) ) + else if ( implCheckItemType( _rSet, _nId, checkItemType<OptionalBoolItem> ) ) { OptionalBoolItem aItem( _nId ); if ( _rValue.hasValue() ) @@ -955,7 +956,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_LONG: - if ( implCheckItemType( _rSet, _nId, SfxInt32Item::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<SfxInt32Item> ) ) { sal_Int32 nValue = 0; _rValue >>= nValue; @@ -972,7 +973,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_SEQUENCE: - if ( implCheckItemType( _rSet, _nId, OStringListItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, checkItemType<OStringListItem> ) ) { // determine the element type TypeDescription aTD(_rValue.getValueType()); |