diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-01 13:25:57 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-05 16:43:14 +0100 |
commit | 41a71413f4ebe69a48ee068fd5c785d6015c0cca (patch) | |
tree | dc46caf73c60f9186e1ce28543715d79e747394e /ucbhelper | |
parent | b70a330d4f06daaeeff940b2f935c8089d8a7be6 (diff) |
fdo#46808, use service constructor for ucb::PropertiesManager
Change-Id: Ib0c7375ac9f72647b10adcb2cea8a0f8e2fdcca0
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/Library_ucbhelper.mk | 1 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/resultsetmetadata.hxx | 6 | ||||
-rw-r--r-- | ucbhelper/source/provider/resultset.cxx | 3 | ||||
-rw-r--r-- | ucbhelper/source/provider/resultsetmetadata.cxx | 50 |
4 files changed, 28 insertions, 32 deletions
diff --git a/ucbhelper/Library_ucbhelper.mk b/ucbhelper/Library_ucbhelper.mk index 73b1afc30c4e..ff92193a5d42 100644 --- a/ucbhelper/Library_ucbhelper.mk +++ b/ucbhelper/Library_ucbhelper.mk @@ -14,6 +14,7 @@ $(eval $(call gb_Library_use_package,ucbhelper,ucbhelper_inc)) $(eval $(call gb_Library_use_sdk_api,ucbhelper)) $(eval $(call gb_Library_use_libraries,ucbhelper,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx index 0b5b331dc2a6..129f1f8b90bf 100644 --- a/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx +++ b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx @@ -145,7 +145,7 @@ private: protected: ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr; + ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > m_aProps; sal_Bool m_bReadOnly; @@ -163,7 +163,7 @@ public: */ ResultSetMetaData( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProps, sal_Bool bReadOnly = sal_True ); @@ -183,7 +183,7 @@ public: */ ResultSetMetaData( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProps, const std::vector< ResultSetColumnData >& rColumnData ); 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 <comphelper/processfactory.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <ucbhelper/resultset.hxx> @@ -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 <com/sun/star/util/Date.hpp> #include <com/sun/star/util/Time.hpp> #include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/ucb/PropertiesManager.hpp> #include <ucbhelper/resultsetmetadata.hxx> 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; } } } |