diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-03 11:10:46 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-06 13:35:36 +0200 |
commit | 495111b249e1ef17be96dbdfbc5a13de6d5dd5f9 (patch) | |
tree | 07c2b5972b0786ae8ff970855574c4915078c09d /extensions | |
parent | 1faac45905a2dc28b36f7957cb008e8c0e7fa3c1 (diff) |
fdo#46808, use service constructor for sdb::DatabaseContext
Change-Id: I4d845f289f324912b0fc4d8e26a2947e2d2f889e
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 20 | ||||
-rw-r--r-- | extensions/source/propctrlr/formstrings.hxx | 1 |
2 files changed, 8 insertions, 13 deletions
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 <com/sun/star/container/XChild.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/form/XGridColumnFactory.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> @@ -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" ); |