26#include <com/sun/star/beans/XPropertySet.hpp>
27#include <com/sun/star/beans/PropertyValue.hpp>
28#include <com/sun/star/sdb/XDatabaseContext.hpp>
29#include <com/sun/star/sdbc/XConnection.hpp>
30#include <com/sun/star/sdbc/XDriver.hpp>
33#include <com/sun/star/frame/XModel.hpp>
39 namespace DataSourceInfoConverter
41 void convert(
const css::uno::Reference< css::uno::XComponentContext> & xContext,
42 const ::dbaccess::ODsnTypeCollection* _pCollection,
43 std::u16string_view _sOldURLPrefix,
44 std::u16string_view _sNewURLPrefix,
45 const css::uno::Reference< css::beans::XPropertySet >& _xDatasource);
55 css::uno::Reference< css::uno::XComponentContext >
57 css::uno::Reference< css::sdb::XDatabaseContext >
60 css::uno::Reference< css::frame::XModel >
m_xModel;
77 bool getCurrentSettings(css::uno::Sequence< css::beans::PropertyValue >& _rDriverParams);
87 const css::uno::Reference< css::uno::XComponentContext >&
getORB()
const {
return m_xContext; }
91 std::pair< css::uno::Reference< css::sdbc::XConnection >,
bool>
createConnection();
95 css::uno::Reference< css::sdbc::XDriver >
getDriver();
96 css::uno::Reference< css::sdbc::XDriver >
getDriver(
const OUString& _sURL);
129 const css::uno::Reference< css::beans::XPropertySet >& _rxSource,
140 const css::uno::Reference< css::beans::XPropertySet >& _rxDest);
static void implTranslateProperty(const css::uno::Reference< css::beans::XPropertySet > &_rxSet, const OUString &_rName, const SfxPoolItem *_pItem)
translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>,...
bool getCurrentSettings(css::uno::Sequence< css::beans::PropertyValue > &_rDriverParams)
translate the current dialog SfxItems into driver relevant PropertyValues
const MapInt2String & getIndirectProperties() const
std::pair< css::uno::Reference< css::sdbc::XConnection >, bool > createConnection()
creates a new connection.
OString translatePropertyId(sal_Int32 _nId)
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::sdbc::XDriver > getDriver()
return the corresponding driver for the selected URL
const css::uno::Reference< css::uno::XComponentContext > & getORB() const
std::map< sal_Int32, OUString > MapInt2String
css::uno::Reference< css::beans::XPropertySet > m_xDatasource
database context we're working in
void successfullyConnected()
to be called if the settings got from getCurrentSettings have been used for successfully connecting
void clearPassword()
clear the password in the current data source's item set
static OUString getDocumentUrl(SfxItemSet const &_rDest)
weld::Window * m_pParent
translating property id's into names (indirect properties of a data source)
static void convertUrl(SfxItemSet &_rDest)
fill the necessary information from the url line
void setDataSourceOrName(const css::uno::Any &_rDataSourceOrName)
css::uno::Reference< css::beans::XPropertySet > const & getCurrentDataSource()
returns the data source the dialog is currently working with
static OUString getDatasourceType(const SfxItemSet &_rSet)
extracts the connection type from the given setThe connection type is determined by the value of the ...
void implTranslateProperty(SfxItemSet &_rSet, sal_Int32 _nId, const css::uno::Any &_rValue)
translate the given value into an SfxPoolItem, put this into the given set under the given id
ODbDataSourceAdministrationHelper(const css::uno::Reference< css::uno::XComponentContext > &_xORB, weld::Window *pParent, weld::Window *pTopParent, IItemSetHelper *_pItemSetHelper)
OUString getConnectionURL() const
returns the connection URL
MapInt2String m_aDirectPropTranslator
void translateProperties(const SfxItemSet &_rSource, const css::uno::Reference< css::beans::XPropertySet > &_rxDest)
translate SfxItems into properties of a UNO data source
void translateProperties(const css::uno::Reference< css::beans::XPropertySet > &_rxSource, SfxItemSet &_rDest)
translates properties of a UNO data source into SfxItems
void fillDatasourceInfo(const SfxItemSet &_rSource, css::uno::Sequence< css::beans::PropertyValue > &_rInfo)
fill a data source info array with the settings from a given item set
IItemSetHelper * m_pItemSetHelper
css::uno::Reference< css::sdb::XDatabaseContext > m_xDatabaseContext
service factory
static bool hasAuthentication(const SfxItemSet &_rSet)
check if the data source described by the given set needs authenticationThe return value depends on t...
bool saveChanges(const SfxItemSet &_rSource)
MapInt2String m_aIndirectPropTranslator
translating property id's into names (direct properties of a data source)
css::uno::Reference< css::frame::XModel > m_xModel
css::uno::Any m_aDataSourceOrName
void convert(const css::uno::Reference< css::uno::XComponentContext > &xContext, const ::dbaccess::ODsnTypeCollection *_pCollection, std::u16string_view _sOldURLPrefix, std::u16string_view _sNewURLPrefix, const css::uno::Reference< css::beans::XPropertySet > &_xDatasource)