LibreOffice Module extensions (master) 1
|
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... | |
ODataSource & | operator= (const ODataSource &_rSource) |
copy assignment More... | |
ODataSource & | operator= (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 StringBag & | getTableNames () 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::XPropertySet > | getDataSource () 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< ODataSourceImpl > | m_pImpl |
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.
|
explicit |
constructs an object which is initially invalid
abp::ODataSource::ODataSource | ( | const ODataSource & | _rSource | ) |
copy ctor
Definition at line 298 of file datasourcehandling.cxx.
abp::ODataSource::~ODataSource | ( | ) |
dtor
Definition at line 323 of file datasourcehandling.cxx.
bool abp::ODataSource::connect | ( | weld::Window * | _pMessageParent | ) |
connects to the data source represented by this object
_pMessageParent | the window to use as parent for any error messages. If this is <NULL>, no messages are displayed at all. |
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().
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().
Reference< XPropertySet > abp::ODataSource::getDataSource | ( | ) | const |
return the internal data source object
Definition at line 611 of file datasourcehandling.cxx.
References m_pImpl.
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().
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().
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().
bool abp::ODataSource::isConnected | ( | ) | const |
returns <TRUE> if the object has a valid connection, obtained from its data source
Definition at line 600 of file datasourcehandling.cxx.
References m_pImpl.
Referenced by abp::AdminDialogInvokationPage::canAdvance(), connect(), abp::OAddressBookSourcePilot::connectToDataSource(), getTableNames(), hasTable(), abp::OAddressBookSourcePilot::impl_updateRoadmap(), abp::AdminDialogInvokationPage::implUpdateErrorMessage(), and setDataSource().
bool abp::ODataSource::isValid | ( | ) | const |
checks whether or not the object represents a valid data source
Definition at line 606 of file datasourcehandling.cxx.
References m_pImpl.
Referenced by abp::OAddressBookSourcePilot::connectToDataSource(), getName(), abp::OAddressBookSourcePilot::implCleanup(), abp::OAddressBookSourcePilot::implCreateDataSource(), registerDataSource(), remove(), rename(), and store().
ODataSource & abp::ODataSource::operator= | ( | const ODataSource & | _rSource | ) |
|
noexcept |
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().
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().
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().
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().
void abp::ODataSource::store | ( | const AddressSettings & | rSettings | ) |
stores the database file
Definition at line 327 of file datasourcehandling.cxx.
References abp::AddressSettings::bEmbedDataSource, SfxViewFrame::Current(), Exception, SfxObjectShell::GetModel(), SfxViewFrame::GetObjectShell(), comphelper::getProcessComponentContext(), SfxObjectShell::GetStorage(), comphelper::InitPropertySequence(), isValid(), m_pImpl, TOOLS_WARN_EXCEPTION, and xFactory.
Referenced by abp::OAddressBookSourcePilot::implCommitAll().
|
private |
Definition at line 94 of file datasourcehandling.hxx.
Referenced by connect(), disconnect(), getDataSource(), getName(), getTableNames(), isConnected(), isValid(), operator=(), registerDataSource(), remove(), rename(), setDataSource(), and store().