23#include <com/sun/star/sdb/DatabaseContext.hpp>
43 Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
44 Reference< XDatabaseContext > xRegistrations(
45 DatabaseContext::create(xContext) );
48 const OUString* pRegistrationName = aRegistrationNames.getConstArray();
49 const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
50 for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
52 OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) );
53 aSettings[ *pRegistrationName ] =
54 DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) );
70 if ( !pRegistrations )
75 Reference< XDatabaseContext > xRegistrations(
76 DatabaseContext::create(
80 for ( DatabaseRegistrations::const_iterator reg = rNewRegistrations.begin();
81 reg != rNewRegistrations.end();
85 const OUString
sName = reg->first;
86 const OUString sLocation = reg->second.sLocation;
88 if ( xRegistrations->hasRegisteredDatabase(
sName ) )
90 if ( !xRegistrations->isDatabaseRegistrationReadOnly(
sName ) )
91 xRegistrations->changeDatabaseLocation(
sName, sLocation );
94 OSL_ENSURE( xRegistrations->getDatabaseLocation(
sName ) == sLocation,
95 "DbRegisteredNamesConfig::SetOptions: somebody changed a read-only registration. How unrespectful." );
99 xRegistrations->registerDatabaseLocation(
sName, sLocation );
104 const OUString* pRegistrationName = aRegistrationNames.getConstArray();
105 const OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength();
106 for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName )
108 if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() )
109 xRegistrations->revokeDatabaseLocation( *pRegistrationName );
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const DatabaseRegistrations & getRegistrations() const
static void SetOptions(const SfxItemSet &_rSourceItems)
static void GetOptions(SfxItemSet &_rFillItems)
#define SID_SB_DB_REGISTER
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XComponentContext > getProcessComponentContext()
std::map< OUString, DatabaseRegistration > DatabaseRegistrations