LibreOffice Module extensions (master) 1
Public Member Functions | Private Attributes | List of all members
abp::ODataSource Class Reference

a non-UNO wrapper for a data source More...

#include <datasourcehandling.hxx>

Public Member Functions

 ODataSource (const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
 constructs an object which is initially invalid More...
 
 ODataSource (const ODataSource &_rSource)
 copy ctor More...
 
 ~ODataSource ()
 dtor More...
 
ODataSourceoperator= (const ODataSource &_rSource)
 copy assignment More...
 
ODataSourceoperator= (ODataSource &&_rSource) noexcept
 move assignment More...
 
bool isValid () const
 checks whether or not the object represents a valid data source More...
 
void remove ()
 removes the data source represented by the object from the data source context More...
 
OUString getName () const
 returns the name of the data source More...
 
bool rename (const OUString &_rName)
 renames the data source More...
 
bool connect (weld::Window *_pMessageParent)
 connects to the data source represented by this object More...
 
bool isConnected () const
 returns <TRUE> if the object has a valid connection, obtained from its data source More...
 
void disconnect ()
 disconnects from the data source (i.e. disposes the UNO connection hold internally) More...
 
void store (const AddressSettings &rSettings)
 stores the database file More...
 
void registerDataSource (const OUString &_sRegisteredDataSourceName)
 register the data source under the given name in the configuration More...
 
const StringBaggetTableNames () const
 retrieves the tables names from the connection More...
 
bool hasTable (const OUString &_rTableName) const
 determines whether a given table exists More...
 
css::uno::Reference< css::beans::XPropertySetgetDataSource () const
 return the internal data source object More...
 
void setDataSource (const css::uno::Reference< css::beans::XPropertySet > &_rxDS, const OUString &_sName)
 set a new data source. More...
 

Private Attributes

std::unique_ptr< ODataSourceImplm_pImpl
 

Detailed Description

a non-UNO wrapper for a data source

This class allows to access data sources without the need to compile the respective file with exception handling enabled (hopefully :).

In addition to wrapping a UNO data source, an instance of this class can handle at most one valid connection, as obtained from the data source.

Definition at line 91 of file datasourcehandling.hxx.

Constructor & Destructor Documentation

◆ ODataSource() [1/2]

abp::ODataSource::ODataSource ( const css::uno::Reference< css::uno::XComponentContext > &  _rxORB)
explicit

constructs an object which is initially invalid

◆ ODataSource() [2/2]

abp::ODataSource::ODataSource ( const ODataSource _rSource)

copy ctor

Definition at line 298 of file datasourcehandling.cxx.

◆ ~ODataSource()

abp::ODataSource::~ODataSource ( )

dtor

Definition at line 323 of file datasourcehandling.cxx.

Member Function Documentation

◆ connect()

bool abp::ODataSource::connect ( weld::Window _pMessageParent)

connects to the data source represented by this object

Parameters
_pMessageParentthe window to use as parent for any error messages. If this is <NULL>, no messages are displayed at all.
See also
isConnected

Definition at line 505 of file datasourcehandling.cxx.

References Any, DBG_ASSERT, Exception, isConnected(), m_pImpl, compmodule::ModuleRes(), ShowServiceNotAvailableError(), TOOLS_WARN_EXCEPTION, and u.

Referenced by abp::OAddressBookSourcePilot::connectToDataSource().

◆ disconnect()

void abp::ODataSource::disconnect ( )

disconnects from the data source (i.e. disposes the UNO connection hold internally)

Definition at line 593 of file datasourcehandling.cxx.

References m_pImpl.

Referenced by abp::OAddressBookSourcePilot::connectToDataSource(), setDataSource(), and abp::OAddressBookSourcePilot::typeSelectionChanged().

◆ getDataSource()

Reference< XPropertySet > abp::ODataSource::getDataSource ( ) const

return the internal data source object

Definition at line 611 of file datasourcehandling.cxx.

References m_pImpl.

◆ getName()

OUString abp::ODataSource::getName ( ) const

returns the name of the data source

Definition at line 448 of file datasourcehandling.cxx.

References isValid(), and m_pImpl.

Referenced by abp::OAddressBookSourcePilot::implCommitAll().

◆ getTableNames()

const StringBag & abp::ODataSource::getTableNames ( ) const

retrieves the tables names from the connection

to be called when <method>isConnected</method> returns <TRUE> only

Definition at line 466 of file datasourcehandling.cxx.

References DBG_ASSERT, Exception, isConnected(), and m_pImpl.

Referenced by hasTable(), abp::OAddressBookSourcePilot::implDefaultTableName(), abp::TableSelectionPage::initializePage(), and abp::OAddressBookSourcePilot::prepareLeaveCurrentState().

◆ hasTable()

bool abp::ODataSource::hasTable ( const OUString &  _rTableName) const

determines whether a given table exists

Definition at line 456 of file datasourcehandling.cxx.

References getTableNames(), and isConnected().

Referenced by abp::OAddressBookSourcePilot::impl_updateRoadmap().

◆ isConnected()

bool abp::ODataSource::isConnected ( ) const

◆ isValid()

bool abp::ODataSource::isValid ( ) const

◆ operator=() [1/2]

ODataSource & abp::ODataSource::operator= ( const ODataSource _rSource)

copy assignment

Definition at line 303 of file datasourcehandling.cxx.

References m_pImpl.

◆ operator=() [2/2]

ODataSource & abp::ODataSource::operator= ( ODataSource &&  _rSource)
noexcept

move assignment

Definition at line 312 of file datasourcehandling.cxx.

References m_pImpl.

◆ registerDataSource()

void abp::ODataSource::registerDataSource ( const OUString &  _sRegisteredDataSourceName)

register the data source under the given name in the configuration

Definition at line 385 of file datasourcehandling.cxx.

References Exception, isValid(), abp::lcl_registerDataSource(), m_pImpl, and TOOLS_WARN_EXCEPTION.

Referenced by abp::OAddressBookSourcePilot::implCommitAll().

◆ remove()

void abp::ODataSource::remove ( )

removes the data source represented by the object from the data source context

Definition at line 418 of file datasourcehandling.cxx.

References Exception, isValid(), m_pImpl, and TOOLS_WARN_EXCEPTION.

Referenced by abp::OAddressBookSourcePilot::implCleanup(), and abp::OAddressBookSourcePilot::implCreateDataSource().

◆ rename()

bool abp::ODataSource::rename ( const OUString &  _rName)

renames the data source

Definition at line 437 of file datasourcehandling.cxx.

References isValid(), and m_pImpl.

Referenced by abp::OAddressBookSourcePilot::implCommitAll().

◆ setDataSource()

void abp::ODataSource::setDataSource ( const css::uno::Reference< css::beans::XPropertySet > &  _rxDS,
const OUString &  _sName 
)

set a new data source.

Available to selected clients only

Definition at line 404 of file datasourcehandling.cxx.

References disconnect(), isConnected(), and m_pImpl.

Referenced by abp::lcl_implCreateAndSetURL().

◆ store()

void abp::ODataSource::store ( const AddressSettings rSettings)

Member Data Documentation

◆ m_pImpl

std::unique_ptr<ODataSourceImpl> abp::ODataSource::m_pImpl
private

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