LibreOffice Module dbaccess (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
dbaui::ODbDataSourceAdministrationHelper Class Referencefinal

#include <DbAdminImpl.hxx>

Collaboration diagram for dbaui::ODbDataSourceAdministrationHelper:
[legend]

Public Types

typedef std::map< sal_Int32, OUString > MapInt2String
 

Public Member Functions

 ODbDataSourceAdministrationHelper (const css::uno::Reference< css::uno::XComponentContext > &_xORB, weld::Window *pParent, weld::Window *pTopParent, IItemSetHelper *_pItemSetHelper)
 
bool getCurrentSettings (css::uno::Sequence< css::beans::PropertyValue > &_rDriverParams)
 translate the current dialog SfxItems into driver relevant PropertyValues More...
 
void successfullyConnected ()
 to be called if the settings got from getCurrentSettings have been used for successfully connecting More...
 
void clearPassword ()
 clear the password in the current data source's item set More...
 
const css::uno::Reference< css::uno::XComponentContext > & getORB () const
 
std::pair< css::uno::Reference< css::sdbc::XConnection >, bool > createConnection ()
 creates a new connection. More...
 
css::uno::Reference< css::sdbc::XDriver > getDriver ()
 return the corresponding driver for the selected URL More...
 
css::uno::Reference< css::sdbc::XDriver > getDriver (const OUString &_sURL)
 
css::uno::Reference< css::beans::XPropertySet > const & getCurrentDataSource ()
 returns the data source the dialog is currently working with More...
 
void setDataSourceOrName (const css::uno::Any &_rDataSourceOrName)
 
OUString getConnectionURL () const
 returns the connection URL More...
 
const MapInt2StringgetIndirectProperties () const
 
void translateProperties (const css::uno::Reference< css::beans::XPropertySet > &_rxSource, SfxItemSet &_rDest)
 translates properties of a UNO data source into SfxItems More...
 
void translateProperties (const SfxItemSet &_rSource, const css::uno::Reference< css::beans::XPropertySet > &_rxDest)
 translate SfxItems into properties of a UNO data source More...
 
bool saveChanges (const SfxItemSet &_rSource)
 

Static Public Member Functions

static OUString getDocumentUrl (SfxItemSet const &_rDest)
 
static OUString getDatasourceType (const SfxItemSet &_rSet)
 extracts the connection type from the given setThe connection type is determined by the value of the DSN item, analyzed by the TypeCollection item. More...
 
static void convertUrl (SfxItemSet &_rDest)
 fill the necessary information from the url line More...
 

Private Member Functions

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 More...
 
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 More...
 
OString translatePropertyId (sal_Int32 _nId)
 

Static Private Member Functions

static css::uno::Any implTranslateProperty (const SfxPoolItem *_pItem)
 translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type> More...
 
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>, set it (under the given name) on the given property set More...
 
static bool hasAuthentication (const SfxItemSet &_rSet)
 check if the data source described by the given set needs authenticationThe return value depends on the data source type only. More...
 

Private Attributes

css::uno::Reference< css::uno::XComponentContext > m_xContext
 
css::uno::Reference< css::sdb::XDatabaseContext > m_xDatabaseContext
 service factory More...
 
css::uno::Reference< css::beans::XPropertySetm_xDatasource
 database context we're working in More...
 
css::uno::Reference< css::frame::XModel > m_xModel
 
css::uno::Any m_aDataSourceOrName
 
MapInt2String m_aDirectPropTranslator
 
MapInt2String m_aIndirectPropTranslator
 translating property id's into names (direct properties of a data source) More...
 
weld::Windowm_pParent
 translating property id's into names (indirect properties of a data source) More...
 
IItemSetHelperm_pItemSetHelper
 

Detailed Description

Definition at line 49 of file DbAdminImpl.hxx.

Member Typedef Documentation

◆ MapInt2String

Definition at line 52 of file DbAdminImpl.hxx.

Constructor & Destructor Documentation

◆ ODbDataSourceAdministrationHelper()

dbaui::ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper ( const css::uno::Reference< css::uno::XComponentContext > &  _xORB,
weld::Window pParent,
weld::Window pTopParent,
IItemSetHelper _pItemSetHelper 
)

initialize the property translation map

Definition at line 130 of file DbAdminImpl.cxx.

References DSID_ADDITIONALOPTIONS, DSID_ALLOWLONGTABLENAMES, DSID_APPEND_TABLE_ALIAS, DSID_AS_BEFORE_CORRNAME, DSID_AUTOINCREMENTVALUE, DSID_AUTORETRIEVEENABLED, DSID_AUTORETRIEVEVALUE, DSID_BOOLEANCOMPARISON, DSID_CATALOG, DSID_CHARSET, DSID_CHECK_REQUIRED_FIELDS, DSID_CONN_LDAP_BASEDN, DSID_CONN_LDAP_ROWCOUNT, DSID_CONN_LDAP_USESSL, DSID_CONN_SOCKET, DSID_CONNECTURL, DSID_DECIMALDELIMITER, DSID_DOCUMENT_URL, DSID_DOSLINEENDS, DSID_ENABLEOUTERJOIN, DSID_ESCAPE_DATETIME, DSID_FIELDDELIMITER, DSID_IGNORECURRENCY, DSID_IGNOREDRIVER_PRIV, DSID_INDEXAPPENDIX, DSID_JDBCDRIVERCLASS, DSID_MAX_ROW_SCAN, DSID_NAME, DSID_NAMED_PIPE, DSID_PARAMETERNAMESUBST, DSID_PASSWORD, DSID_PASSWORDREQUIRED, DSID_PRIMARY_KEY_SUPPORT, DSID_READONLY, DSID_RESPECTRESULTSETTYPE, DSID_SCHEMA, DSID_SHOWDELETEDROWS, DSID_SQL92CHECK, DSID_SUPPRESSVERSIONCL, DSID_TABLEFILTER, DSID_TEXTDELIMITER, DSID_TEXTFILEEXTENSION, DSID_TEXTFILEHEADER, DSID_THOUSANDSDELIMITER, DSID_USECATALOG, DSID_USER, Exception, INFO_ADDITIONALOPTIONS, INFO_ALLOWLONGTABLENAMES, INFO_APPEND_TABLE_ALIAS, INFO_AS_BEFORE_CORRELATION_NAME, INFO_AUTORETRIEVEENABLED, INFO_AUTORETRIEVEVALUE, INFO_CHARSET, INFO_CONN_LDAP_BASEDN, INFO_CONN_LDAP_ROWCOUNT, INFO_DECIMALDELIMITER, INFO_ESCAPE_DATETIME, INFO_FIELDDELIMITER, INFO_FORMS_CHECK_REQUIRED_FIELDS, INFO_IGNOREDRIVER_PRIV, INFO_JDBCDRIVERCLASS, INFO_PARAMETERNAMESUBST, INFO_SHOWDELETEDROWS, INFO_TEXTDELIMITER, INFO_TEXTFILEEXTENSION, INFO_TEXTFILEHEADER, INFO_THOUSANDSDELIMITER, INFO_USECATALOG, m_aDirectPropTranslator, m_aIndirectPropTranslator, m_xContext, m_xDatabaseContext, PROPERTY_AUTOINCREMENTCREATION(), PROPERTY_BOOLEANCOMPARISONMODE(), PROPERTY_ENABLEOUTERJOIN(), PROPERTY_ENABLESQL92CHECK(), PROPERTY_ISPASSWORDREQUIRED(), PROPERTY_ISREADONLY(), PROPERTY_NAME(), PROPERTY_PASSWORD(), PROPERTY_SUPPRESSVERSIONCL(), PROPERTY_TABLEFILTER(), PROPERTY_URL(), PROPERTY_USECATALOGINSELECT(), PROPERTY_USER(), PROPERTY_USESCHEMAINSELECT(), ShowServiceNotAvailableError(), and u.

Member Function Documentation

◆ clearPassword()

void dbaui::ODbDataSourceAdministrationHelper::clearPassword ( )

clear the password in the current data source's item set

Definition at line 329 of file DbAdminImpl.cxx.

References SfxItemSet::ClearItem(), DSID_PASSWORD, dbaui::IItemSetHelper::getWriteOutputSet(), and m_pItemSetHelper.

◆ convertUrl()

void dbaui::ODbDataSourceAdministrationHelper::convertUrl ( SfxItemSet _rDest)
static

◆ createConnection()

std::pair< Reference< XConnection >, bool > dbaui::ODbDataSourceAdministrationHelper::createConnection ( )

creates a new connection.

The caller is responsible to dispose it !!!!

Definition at line 335 of file DbAdminImpl.cxx.

References getConnectionURL(), getCurrentSettings(), getDriver(), getORB(), weld::Window::GetXWindow(), m_pParent, showError(), and successfullyConnected().

◆ fillDatasourceInfo()

void dbaui::ODbDataSourceAdministrationHelper::fillDatasourceInfo ( const SfxItemSet _rSource,
css::uno::Sequence< css::beans::PropertyValue > &  _rInfo 
)
private

fill a data source info array with the settings from a given item set

Definition at line 710 of file DbAdminImpl.cxx.

References Any, aProperties, DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, eType, getDatasourceType(), SfxItemSet::GetItem(), getORB(), i, implTranslateProperty(), INFO_CHARSET, m_aIndirectPropTranslator, and nCount.

Referenced by getCurrentSettings().

◆ getConnectionURL()

OUString dbaui::ODbDataSourceAdministrationHelper::getConnectionURL ( ) const

◆ getCurrentDataSource()

Reference< XPropertySet > const & dbaui::ODbDataSourceAdministrationHelper::getCurrentDataSource ( )

returns the data source the dialog is currently working with

Definition at line 398 of file DbAdminImpl.cxx.

References Exception, dbaui::getDataSourceOrModel(), m_aDataSourceOrName, m_xDatabaseContext, m_xDatasource, and m_xModel.

Referenced by saveChanges(), and successfullyConnected().

◆ getCurrentSettings()

bool dbaui::ODbDataSourceAdministrationHelper::getCurrentSettings ( css::uno::Sequence< css::beans::PropertyValue > &  _rDriverParams)

◆ getDatasourceType()

OUString dbaui::ODbDataSourceAdministrationHelper::getDatasourceType ( const SfxItemSet _rSet)
static

◆ getDocumentUrl()

OUString dbaui::ODbDataSourceAdministrationHelper::getDocumentUrl ( SfxItemSet const &  _rDest)
static

◆ getDriver() [1/2]

Reference< XDriver > dbaui::ODbDataSourceAdministrationHelper::getDriver ( )

return the corresponding driver for the selected URL

Definition at line 363 of file DbAdminImpl.cxx.

References getConnectionURL(), and getDriver().

Referenced by createConnection(), and getDriver().

◆ getDriver() [2/2]

Reference< XDriver > dbaui::ODbDataSourceAdministrationHelper::getDriver ( const OUString &  _sURL)

Definition at line 368 of file DbAdminImpl.cxx.

References Any, DBA_RES, Exception, cppu::getCaughtException(), and getORB().

◆ getIndirectProperties()

const MapInt2String & dbaui::ODbDataSourceAdministrationHelper::getIndirectProperties ( ) const
inline

Definition at line 120 of file DbAdminImpl.hxx.

References m_aIndirectPropTranslator.

◆ getORB()

const css::uno::Reference< css::uno::XComponentContext > & dbaui::ODbDataSourceAdministrationHelper::getORB ( ) const
inline

Definition at line 87 of file DbAdminImpl.hxx.

References m_xContext.

Referenced by createConnection(), fillDatasourceInfo(), and getDriver().

◆ hasAuthentication()

bool dbaui::ODbDataSourceAdministrationHelper::hasAuthentication ( const SfxItemSet _rSet)
staticprivate

check if the data source described by the given set needs authenticationThe return value depends on the data source type only.

Definition at line 442 of file DbAdminImpl.cxx.

References dbaui::AuthNone, dbaui::DataSourceMetaData::getAuthentication(), and getDatasourceType().

Referenced by getCurrentSettings(), and successfullyConnected().

◆ implTranslateProperty() [1/3]

static void dbaui::ODbDataSourceAdministrationHelper::implTranslateProperty ( const css::uno::Reference< css::beans::XPropertySet > &  _rxSet,
const OUString &  _rName,
const SfxPoolItem _pItem 
)
staticprivate

translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>, set it (under the given name) on the given property set

◆ implTranslateProperty() [2/3]

Any dbaui::ODbDataSourceAdministrationHelper::implTranslateProperty ( const SfxPoolItem _pItem)
staticprivate

◆ implTranslateProperty() [3/3]

void dbaui::ODbDataSourceAdministrationHelper::implTranslateProperty ( SfxItemSet _rSet,
sal_Int32  _nId,
const css::uno::Any &  _rValue 
)
private

translate the given value into an SfxPoolItem, put this into the given set under the given id

Referenced by fillDatasourceInfo().

◆ saveChanges()

bool dbaui::ODbDataSourceAdministrationHelper::saveChanges ( const SfxItemSet _rSource)

Definition at line 1064 of file DbAdminImpl.cxx.

References getCurrentDataSource(), and translateProperties().

◆ setDataSourceOrName()

void dbaui::ODbDataSourceAdministrationHelper::setDataSourceOrName ( const css::uno::Any &  _rDataSourceOrName)

Definition at line 1076 of file DbAdminImpl.cxx.

References m_aDataSourceOrName.

◆ successfullyConnected()

void dbaui::ODbDataSourceAdministrationHelper::successfullyConnected ( )

to be called if the settings got from getCurrentSettings have been used for successfully connecting

See also
getCurrentSettings

Definition at line 310 of file DbAdminImpl.cxx.

References Any, DSID_PASSWORD, getCurrentDataSource(), SfxItemSet::GetItem(), dbaui::IItemSetHelper::getOutputSet(), CntUnencodedStringItem::GetValue(), hasAuthentication(), m_aDirectPropTranslator, and m_pItemSetHelper.

Referenced by createConnection().

◆ translateProperties() [1/2]

void dbaui::ODbDataSourceAdministrationHelper::translateProperties ( const css::uno::Reference< css::beans::XPropertySet > &  _rxSource,
SfxItemSet _rDest 
)

translates properties of a UNO data source into SfxItems

Parameters
_rxSourceThe data source
_rDestThe item set to fill.

Referenced by saveChanges().

◆ translateProperties() [2/2]

void dbaui::ODbDataSourceAdministrationHelper::translateProperties ( const SfxItemSet _rSource,
const css::uno::Reference< css::beans::XPropertySet > &  _rxDest 
)

translate SfxItems into properties of a UNO data source

Parameters
_rSourceThe item set to read from.
_rxDestThe data source to fill.

◆ translatePropertyId()

OString dbaui::ODbDataSourceAdministrationHelper::translatePropertyId ( sal_Int32  _nId)
private

Member Data Documentation

◆ m_aDataSourceOrName

css::uno::Any dbaui::ODbDataSourceAdministrationHelper::m_aDataSourceOrName
private

Definition at line 62 of file DbAdminImpl.hxx.

Referenced by getCurrentDataSource(), and setDataSourceOrName().

◆ m_aDirectPropTranslator

MapInt2String dbaui::ODbDataSourceAdministrationHelper::m_aDirectPropTranslator
private

◆ m_aIndirectPropTranslator

MapInt2String dbaui::ODbDataSourceAdministrationHelper::m_aIndirectPropTranslator
private

translating property id's into names (direct properties of a data source)

Definition at line 65 of file DbAdminImpl.hxx.

Referenced by fillDatasourceInfo(), getIndirectProperties(), ODbDataSourceAdministrationHelper(), and translatePropertyId().

◆ m_pItemSetHelper

IItemSetHelper* dbaui::ODbDataSourceAdministrationHelper::m_pItemSetHelper
private

◆ m_pParent

weld::Window* dbaui::ODbDataSourceAdministrationHelper::m_pParent
private

translating property id's into names (indirect properties of a data source)

Definition at line 66 of file DbAdminImpl.hxx.

Referenced by createConnection(), and getCurrentSettings().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > dbaui::ODbDataSourceAdministrationHelper::m_xContext
private

Definition at line 56 of file DbAdminImpl.hxx.

Referenced by getCurrentSettings(), getORB(), and ODbDataSourceAdministrationHelper().

◆ m_xDatabaseContext

css::uno::Reference< css::sdb::XDatabaseContext > dbaui::ODbDataSourceAdministrationHelper::m_xDatabaseContext
private

service factory

Definition at line 58 of file DbAdminImpl.hxx.

Referenced by getCurrentDataSource(), and ODbDataSourceAdministrationHelper().

◆ m_xDatasource

css::uno::Reference< css::beans::XPropertySet > dbaui::ODbDataSourceAdministrationHelper::m_xDatasource
private

database context we're working in

Definition at line 59 of file DbAdminImpl.hxx.

Referenced by getCurrentDataSource(), and getCurrentSettings().

◆ m_xModel

css::uno::Reference< css::frame::XModel > dbaui::ODbDataSourceAdministrationHelper::m_xModel
private

Definition at line 60 of file DbAdminImpl.hxx.

Referenced by getCurrentDataSource().


The documentation for this class was generated from the following files: