From 41a71413f4ebe69a48ee068fd5c785d6015c0cca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 1 Nov 2012 13:25:57 +0200 Subject: fdo#46808, use service constructor for ucb::PropertiesManager Change-Id: Ib0c7375ac9f72647b10adcb2cea8a0f8e2fdcca0 --- ucbhelper/source/provider/resultset.cxx | 3 +- ucbhelper/source/provider/resultsetmetadata.cxx | 50 +++++++++++-------------- 2 files changed, 24 insertions(+), 29 deletions(-) (limited to 'ucbhelper/source') diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx index 9af7a6d38b69..281434f08edc 100644 --- a/ucbhelper/source/provider/resultset.cxx +++ b/ucbhelper/source/provider/resultset.cxx @@ -23,6 +23,7 @@ ************************************************************************** *************************************************************************/ +#include #include #include #include @@ -371,7 +372,7 @@ uno::Reference< sdbc::XResultSetMetaData > SAL_CALL ResultSet::getMetaData() osl::MutexGuard aGuard( m_pImpl->m_aMutex ); if ( !m_pImpl->m_xMetaData.is() ) - m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xSMgr, + m_pImpl->m_xMetaData = new ResultSetMetaData( comphelper::getComponentContext(m_pImpl->m_xSMgr), m_pImpl->m_aProperties ); return m_pImpl->m_xMetaData; diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx index 1d7c8dca9fd8..13e94ed2cc92 100644 --- a/ucbhelper/source/provider/resultsetmetadata.cxx +++ b/ucbhelper/source/provider/resultsetmetadata.cxx @@ -37,12 +37,14 @@ #include #include #include +#include #include using namespace com::sun::star::beans; using namespace com::sun::star::io; using namespace com::sun::star::lang; using namespace com::sun::star::sdbc; +using namespace com::sun::star::ucb; using namespace com::sun::star::uno; using namespace com::sun::star::util; @@ -82,11 +84,11 @@ namespace ucbhelper { //========================================================================= ResultSetMetaData::ResultSetMetaData( - const Reference< XMultiServiceFactory >& rxSMgr, + const Reference< XComponentContext >& rxContext, const Sequence< Property >& rProps, sal_Bool bReadOnly ) : m_pImpl( new ResultSetMetaData_Impl( rProps.getLength() ) ), - m_xSMgr( rxSMgr ), + m_xContext( rxContext ), m_aProps( rProps ), m_bReadOnly( bReadOnly ) { @@ -94,11 +96,11 @@ ResultSetMetaData::ResultSetMetaData( //========================================================================= ResultSetMetaData::ResultSetMetaData( - const Reference< XMultiServiceFactory >& rxSMgr, + const Reference< XComponentContext >& rxContext, const Sequence< Property >& rProps, const std::vector< ResultSetColumnData >& rColumnData ) : m_pImpl( new ResultSetMetaData_Impl( rColumnData ) ), - m_xSMgr( rxSMgr ), + m_xContext( rxContext ), m_aProps( rProps ), m_bReadOnly( sal_True ) { @@ -400,35 +402,27 @@ sal_Int32 SAL_CALL ResultSetMetaData::getColumnType( sal_Int32 column ) { try { - Reference< XPropertySetInfo > xInfo( - m_xSMgr->createInstance( - OUString( - "com.sun.star.ucb.PropertiesManager" ) ), - UNO_QUERY ); - if ( xInfo.is() ) - { - + Reference< XPropertySetInfo > xInfo = PropertiesManager::create( m_xContext ); // Less (remote) calls... - Sequence< Property > aProps = xInfo->getProperties(); - const Property* pProps1 = aProps.getConstArray(); - sal_Int32 nCount1 = aProps.getLength(); + Sequence< Property > aProps = xInfo->getProperties(); + const Property* pProps1 = aProps.getConstArray(); + sal_Int32 nCount1 = aProps.getLength(); - sal_Int32 nCount = m_aProps.getLength(); - Property* pProps = m_aProps.getArray(); - for ( sal_Int32 n = 0; n < nCount; ++n ) - { - Property& rProp = pProps[ n ]; + sal_Int32 nCount = m_aProps.getLength(); + Property* pProps = m_aProps.getArray(); + for ( sal_Int32 n = 0; n < nCount; ++n ) + { + Property& rProp = pProps[ n ]; - for ( sal_Int32 m = 0; m < nCount1; ++m ) + for ( sal_Int32 m = 0; m < nCount1; ++m ) + { + const Property& rProp1 = pProps1[ m ]; + if ( rProp.Name == rProp1.Name ) { - const Property& rProp1 = pProps1[ m ]; - if ( rProp.Name == rProp1.Name ) - { - // Found... - rProp.Type = rProp1.Type; - break; - } + // Found... + rProp.Type = rProp1.Type; + break; } } } -- cgit