From 495111b249e1ef17be96dbdfbc5a13de6d5dd5f9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 3 Dec 2012 11:10:46 +0200 Subject: fdo#46808, use service constructor for sdb::DatabaseContext Change-Id: I4d845f289f324912b0fc4d8e26a2947e2d2f889e --- extensions/source/propctrlr/formcomponenthandler.cxx | 20 ++++++++------------ extensions/source/propctrlr/formstrings.hxx | 1 - 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'extensions') diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 992b2d5fb927..350483c974b6 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -527,9 +528,8 @@ namespace pcr if ( !sControlValue.isEmpty() ) { - Reference< XNameAccess > xDatabaseContext; - m_aContext.createComponent( (::rtl::OUString)SERVICE_DATABASE_CONTEXT, xDatabaseContext ); - if ( !xDatabaseContext.is() || !xDatabaseContext->hasByName( sControlValue ) ) + Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create( m_aContext.getUNOContext() ); + if ( !xDatabaseContext->hasByName( sControlValue ) ) { ::svt::OFileNotation aTransformer(sControlValue); aPropertyValue <<= ::rtl::OUString( aTransformer.get( ::svt::OFileNotation::N_URL ) ); @@ -1360,15 +1360,11 @@ namespace pcr ::std::vector< ::rtl::OUString > aListEntries; - Reference< XNameAccess > xDatabaseContext; - m_aContext.createComponent( (rtl::OUString)SERVICE_DATABASE_CONTEXT, xDatabaseContext ); - if (xDatabaseContext.is()) - { - Sequence< ::rtl::OUString > aDatasources = xDatabaseContext->getElementNames(); - aListEntries.resize( aDatasources.getLength() ); - ::std::copy( aDatasources.getConstArray(), aDatasources.getConstArray() + aDatasources.getLength(), - aListEntries.begin() ); - } + Reference< XDatabaseContext > xDatabaseContext = sdb::DatabaseContext::create( m_aContext.getUNOContext() ); + Sequence< ::rtl::OUString > aDatasources = xDatabaseContext->getElementNames(); + aListEntries.resize( aDatasources.getLength() ); + ::std::copy( aDatasources.getConstArray(), aDatasources.getConstArray() + aDatasources.getLength(), + aListEntries.begin() ); aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, sal_False, sal_True ); } diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index 39a05d80125a..48eab4cff6ed 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -280,7 +280,6 @@ namespace pcr PCR_CONSTASCII_STRING( SERVICE_COMPONENT_GROUPBOX, "com.sun.star.form.component.GroupBox" ); PCR_CONSTASCII_STRING( SERVICE_COMPONENT_FIXEDTEXT, "com.sun.star.form.component.FixedText" ); PCR_CONSTASCII_STRING( SERVICE_COMPONENT_FORMATTEDFIELD,"com.sun.star.form.component.FormattedField" ); - PCR_CONSTASCII_STRING( SERVICE_DATABASE_CONTEXT, "com.sun.star.sdb.DatabaseContext" ); PCR_CONSTASCII_STRING( SERVICE_TEXT_DOCUMENT, "com.sun.star.text.TextDocument" ); PCR_CONSTASCII_STRING( SERVICE_WEB_DOCUMENT, "com.sun.star.text.WebDocument" ); -- cgit