29#include <com/sun/star/sdbc/SQLException.hpp>
30#include <com/sun/star/util/XModifiable.hpp>
33#include <osl/diagnose.h>
55 , m_bCatalogAtStart(true)
56 , m_pTablesDlg(pTablesDlg)
57 , m_xTables(m_xBuilder->weld_widget(
"TablesFilterPage"))
58 , m_xTablesList(new
OTableTreeListBox(m_xBuilder->weld_tree_view(
"treeview"), true))
94 OSL_FAIL(
"OTableSubscriptionPage::implCheckTables : could not retrieve the current connection's meta data!");
103 std::unique_ptr<weld::TreeIter> xRootEntry(
m_xTablesList->getAllObjectsEntry());
105 for (
const OUString& rIncludeTable : _rTables)
110 sName = rIncludeTable;
112 bool bAllTables = (1 ==
sName.getLength()) && (
'%' ==
sName[0]);
113 bool bAllSchemas = (1 ==
sSchema.getLength()) && (
'%' ==
sSchema[0]);
116 std::unique_ptr<weld::TreeIter> xCatalog(
m_xTablesList->GetEntryPosByName(
sCatalog, xRootEntry.get()));
117 if (!(xCatalog ||
sCatalog.isEmpty()))
121 if (bAllSchemas && xCatalog)
128 std::unique_ptr<weld::TreeIter> xSchema =
m_xTablesList->GetEntryPosByName(
sSchema, (xCatalog ? xCatalog.get() : xRootEntry.get()));
129 if (!(xSchema ||
sSchema.isEmpty()))
133 if (bAllTables && xSchema)
139 std::unique_ptr<weld::TreeIter> xEntry(
m_xTablesList->GetEntryPosByName(
sName, xSchema ? xSchema.get() : (xCatalog ? xCatalog.get() : xRootEntry.get())));
148 if (!_rTableFilter.hasElements())
154 if ((1 == _rTableFilter.getLength()) && _rTableFilter[0] ==
"%")
166 bool bValid, bReadonly;
171 OSL_ENSURE(pNameItem,
"OTableSubscriptionPage::implInitControls: missing the name attribute!");
172 OUString sDSName = pNameItem->
GetValue();
179 OSL_ENSURE(
m_pTablesDlg,
"OTableSubscriptionPage::implInitControls: need a parent dialog doing the translation!");
198 OSL_ENSURE(xProp.is(),
"No data source set!");
205 bool bModified = ( xModi.is() && xModi->isModified() );
217 if ( xModi.is() && !bModified )
218 xModi->setModified(
false);
229 catch (
const SQLException&)
231 aErrorInfo = ::cppu::getCaughtException();
258 if (xMeta.is() && xMeta->supportsCatalogsInDataManipulation())
275 aTableFilter = pTableFilter->
getList();
280 std::unique_ptr<weld::TreeIter> xExpand =
m_xTablesList->getAllObjectsEntry();
286 std::unique_ptr<weld::TreeIter> xSibling(
m_xTablesList->GetWidget().make_iterator(xExpand.get()));
297 std::unique_ptr<weld::TreeIter> xEntry(
m_xTablesList->GetWidget().make_iterator());
331 m_xTablesList->checkedButton_noBroadcast(rRowCol.first);
338 constexpr OUStringLiteral sWildcard =
u"%";
340 std::unique_ptr<weld::TreeIter> xAllObjectsEntry(
m_xTablesList->getAllObjectsEntry());
341 if (!xAllObjectsEntry)
343 std::unique_ptr<weld::TreeIter> xEntry(
m_xTablesList->GetWidget().make_iterator(xAllObjectsEntry.get()));
348 bool bCatalogWildcard =
false;
349 bool bSchemaWildcard =
false;
350 std::unique_ptr<weld::TreeIter> xSchema;
351 std::unique_ptr<weld::TreeIter> xCatalog;
359 xSchema =
m_xTablesList->GetWidget().make_iterator(xEntry.get());
361 if (xAllObjectsEntry->equal(*xSchema))
371 xCatalog =
m_xTablesList->GetWidget().make_iterator(xSchema.get());
373 if (xAllObjectsEntry->equal(*xCatalog))
381 bCatalogWildcard =
m_xTablesList->isWildcardChecked(*xCatalog);
385 if (bCatalogWildcard)
390 if (bCatalogWildcard)
398 bSchemaWildcard =
m_xTablesList->isWildcardChecked(*xSchema);
405 if (!bSchemaWildcard && !bCatalogWildcard)
412 sal_Int32 nOldLen = aTableFilter.getLength();
413 aTableFilter.realloc(nOldLen + 1);
415 aTableFilter.getArray()[nOldLen] =
sComposedName.makeStringAndClear();
418 if (bCatalogWildcard)
420 else if (bSchemaWildcard)
434 std::unique_ptr<weld::TreeIter> xReturn;
440 std::unique_ptr<weld::TreeIter> xParent =
m_xTablesList->GetWidget().make_iterator(pEntry);
452 bool bValid, bReadonly;
453 getFlags(*_rCoreAttrs, bValid, bReadonly);
455 if (!bValid || bReadonly)
466 aTableFilter = {
"%" };
OptionalString sComposedName
const OUString & GetValue() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
weld::Window * GetFrameWeld() const
static void getFlags(const SfxItemSet &_rSet, bool &_rValid, bool &_rReadonly)
analyze the invalid and the readonly flag which may be present in the set
css::uno::Reference< css::uno::XComponentContext > m_xORB
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
default implementation: call FillItemSet, call prepareLeave,
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue)
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
<type>SfxPoolItem</type> which transports a sequence of <type scope="rtl">OUString</type>'s
const css::uno::Sequence< OUString > & getList() const
void successfullyConnected()
bool getCurrentSettings(css::uno::Sequence< css::beans::PropertyValue > &_rDriverParams)
css::uno::Reference< css::beans::XPropertySet > const & getCurrentDataSource()
css::uno::Sequence< OUString > collectDetailedSelection() const
return the current selection in <member>m_aTablesList</member>
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
OUString m_sCatalogSeparator
virtual DeactivateRC DeactivatePage(SfxItemSet *_pSet) override
default implementation: call FillItemSet, call prepareLeave,
virtual ~OTableSubscriptionPage() override
OTableSubscriptionPage(weld::Container *pPage, OTableSubscriptionDialog *pController, const SfxItemSet &_rCoreAttrs)
OTableSubscriptionDialog * m_pTablesDlg
valid as long as the page is active
void implCheckTables(const css::uno::Sequence< OUString > &_rTables)
check the tables in <member>m_aTablesList</member> according to <arg>_rTables</arg>
void implCompleteTablesCheck(const css::uno::Sequence< OUString > &_rTableFilter)
virtual void fillControls(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to save the value if necessary
std::unique_ptr< OTableTreeListBox > m_xTablesList
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
std::unique_ptr< weld::Widget > m_xTables
virtual void fillWindows(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to disable if necessary
std::unique_ptr< weld::TreeIter > implNextSibling(const weld::TreeIter *pEntry) const
returns the next sibling, if not available, the next sibling of the parent, a.s.o.
css::uno::Reference< css::sdbc::XConnection > m_xCurrentConnection
void CheckAll(bool bCheck=true)
(un)check all entries
void connect_toggled(const Link< const iter_col &, void > &rLink)
virtual void set_selection_mode(SelectionMode eMode)=0
std::pair< const TreeIter &, int > iter_col
virtual int get_height_rows(int nRows) const=0
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
::dbtools::SQLExceptionInfo createConnection(const OUString &_rsDataSourceName, const css::uno::Reference< css::container::XNameAccess > &_xDatabaseContext, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, css::uno::Reference< css::lang::XEventListener > const &_rEvtLst, css::uno::Reference< css::sdbc::XConnection > &_rOUTConnection)
creates a new connection and appends the eventlistener
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
css::uno::Reference< css::uno::XInterface > getDataSourceOrModel(const css::uno::Reference< css::uno::XInterface > &_xObject)
returns either the model when data source is given as parameter, or returns a data source when a mode...
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral PROPERTY_TABLETYPEFILTER(u"TableTypeFilter")