22#include <com/sun/star/sdbc/XConnection.hpp>
23#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
24#include <com/sun/star/container/XNameAccess.hpp>
25#include <com/sun/star/form/ListSourceType.hpp>
26#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
31#include <osl/diagnose.h>
48 const Reference< XPropertySet >& _rxObjectModel,
const Reference< XComponentContext >& _rxContext )
51 , m_bHadDataSelection(true)
72 case FormComponentType::LISTBOX:
76 case FormComponentType::COMBOBOX:
86 OUString sIdent(OUString::number(_nState));
92 return std::make_unique<OTableSelectionPage>(pPageContainer,
this);
94 return std::make_unique<OContentTableSelection>(pPageContainer,
this);
96 return std::make_unique<OContentFieldSelection>(pPageContainer,
this);
98 return std::make_unique<OLinkFieldsPage>(pPageContainer,
this);
100 return std::make_unique<OComboDBFieldPage>(pPageContainer,
this);
108 switch (_nCurrentState)
153 DBG_ASSERT(xConn.is(),
"OListComboWizard::implApplySettings: no connection, unable to quote!");
154 Reference< XDatabaseMetaData > xMetaData;
156 xMetaData = xConn->getMetaData();
161 OUString sQuoteString = xMetaData->getIdentifierQuoteString();
166 ::dbtools::qualifiedNameComponents( xMetaData,
getSettings().sListContentTable,
sCatalog,
sSchema,
sName, ::dbtools::EComposeRule::InDataManipulation );
181 OUString sStatement =
"SELECT " +
184 Sequence< OUString > aListSource { sStatement };
190 OUString sStatement =
"SELECT DISTINCT " +
201 OSL_FAIL(
"OListComboWizard::implApplySettings: could not set the property values for the listbox!");
218 DBG_ASSERT(xConn.is(),
"OLCPage::getTables: should have an active connection when reaching this page!");
220 Reference< XTablesSupplier > xSuppTables(xConn, UNO_QUERY);
221 Reference< XNameAccess > xTables;
222 if (xSuppTables.is())
223 xTables = xSuppTables->getTables();
225 DBG_ASSERT(xTables.is() || !xConn.is(),
"OLCPage::getTables: got no tables from the connection!");
233 Reference< XNameAccess > xTables =
getTables();
234 Sequence< OUString > aColumnNames;
240 Reference< XColumnsSupplier > xSuppCols;
241 xTables->getByName(
getSettings().sListContentTable) >>= xSuppCols;
242 DBG_ASSERT(xSuppCols.is(),
"OLCPage::getTableFields: no columns supplier!");
245 Reference< XNameAccess > xColumns;
247 xColumns = xSuppCols->getColumns();
251 aColumnNames = xColumns->getElementNames();
255 TOOLS_WARN_EXCEPTION(
"extensions.dbpilots",
"OLinkFieldsPage::initializePage: caught an exception while retrieving the columns");
262 :
OLCPage(pPage, pWizard,
"modules/sabpilot/ui/contenttablepage.ui",
"TableSelectionPage")
263 , m_xSelectTable(m_xBuilder->weld_tree_view(
"table"))
291 updateDialogTravelUI();
296 if (_rListBox.count_selected_rows())
297 getDialog()->travelNext();
309 Reference< XNameAccess > xTables =
getTables();
310 Sequence< OUString > aTableNames;
312 aTableNames = xTables->getElementNames();
317 OSL_FAIL(
"OContentTableSelection::initializePage: could not retrieve the table names!");
331 if (rSettings.
sListContentTable.isEmpty() && (::vcl::WizardTypes::eTravelBackward != _eReason))
339 :
OLCPage(pPage, pWizard,
"modules/sabpilot/ui/contentfieldpage.ui",
"FieldSelectionPage")
340 , m_xSelectTableField(m_xBuilder->weld_tree_view(
"selectfield"))
341 , m_xDisplayedField(m_xBuilder->weld_entry(
"displayfield"))
342 ,
m_xInfo(m_xBuilder->weld_label(
"info"))
374 if (m_xSelectTableField->count_selected_rows())
375 getDialog()->travelNext();
381 updateDialogTravelUI();
382 m_xDisplayedField->set_text(m_xSelectTableField->get_selected_text());
396 :
OLCPage(pPage, pWizard,
"modules/sabpilot/ui/fieldlinkpage.ui",
"FieldLinkPage")
397 , m_xValueListField(m_xBuilder->weld_combo_box(
"valuefield"))
398 , m_xTableField(m_xBuilder->weld_combo_box(
"listtable"))
const char *const aFieldNames[]
virtual OUString & getDBFieldSetting() override
virtual bool canAdvance() const override
virtual void Activate() override
OComboDBFieldPage(weld::Container *pPage, OControlWizard *pWizard)
std::unique_ptr< weld::Label > m_xInfo
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
std::unique_ptr< weld::TreeView > m_xSelectTableField
virtual void initializePage() override
OContentFieldSelection(weld::Container *pPage, OListComboWizard *pWizard)
virtual bool canAdvance() const override
std::unique_ptr< weld::Entry > m_xDisplayedField
virtual ~OContentFieldSelection() override
virtual void Activate() override
virtual bool canAdvance() const override
virtual void initializePage() override
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
OContentTableSelection(weld::Container *pPage, OListComboWizard *pWizard)
virtual ~OContentTableSelection() override
std::unique_ptr< weld::TreeView > m_xSelectTable
OControlWizard * getDialog()
css::uno::Reference< css::sdbc::XConnection > getFormConnection() const
virtual void initializePage() override
const OControlWizardContext & getContext() const
void enableFormDatasourceDisplay()
static void fillListBox(weld::TreeView &_rList, const css::uno::Sequence< OUString > &_rItems)
void initControlSettings(OControlWizardSettings *_pSettings)
bool needDatasourceSelection()
css::uno::Reference< css::sdbc::XConnection > getFormConnection() const
const OControlWizardContext & getContext() const
void setDescriptionText(const OUString &rDesc)
css::uno::Reference< css::container::XNameAccess > getTables() const
OListComboSettings & getSettings()
css::uno::Sequence< OUString > getTableFields()
virtual bool canAdvance() const override
virtual void initializePage() override
std::unique_ptr< weld::ComboBox > m_xTableField
virtual bool commitPage(::vcl::WizardTypes::CommitPageReason _eReason) override
OLinkFieldsPage(weld::Container *pPage, OListComboWizard *pWizard)
virtual ~OLinkFieldsPage() override
std::unique_ptr< weld::ComboBox > m_xValueListField
virtual void Activate() override
virtual bool approveControl(sal_Int16 _nClassId) override
OListComboSettings m_aSettings
virtual bool onFinish() override
virtual void enterState(WizardState _nState) override
virtual bool leaveState(WizardState _nState) override
OListComboWizard(weld::Window *pParent, const css::uno::Reference< css::beans::XPropertySet > &_rxObjectModel, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
virtual WizardState determineNextState(WizardState _nCurrentState) const override
WizardState getFinalState() const
virtual std::unique_ptr< BuilderPage > createPage(WizardState _nState) override
OListComboSettings & getSettings()
virtual bool canAdvance() const override
virtual bool commitPage(WizardTypes::CommitPageReason _eReason) override
virtual void Activate() override
virtual bool leaveState(WizardTypes::WizardState nState)
std::unique_ptr< weld::Button > m_xNextPage
std::unique_ptr< weld::Button > m_xCancel
void defaultButton(WizardButtonFlags _nWizardButtonFlags)
std::unique_ptr< weld::Button > m_xPrevPage
void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable)
std::unique_ptr< weld::Button > m_xFinish
virtual void enterState(WizardTypes::WizardState _nState)
void setTitleBase(const OUString &_rTitleBase)
std::unique_ptr< weld::Assistant > m_xAssistant
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< beans::XPropertySetInfo > m_xInfo
constexpr OUStringLiteral HID_LISTWIZARD_NEXT
constexpr OUStringLiteral HID_LISTWIZARD_PREVIOUS
constexpr OUStringLiteral HID_LISTWIZARD_CANCEL
constexpr OUStringLiteral HID_LISTWIZARD_FINISH
#define LINK(Instance, Class, Member)
#define LCW_STATE_COMBODBFIELD
#define LCW_STATE_FIELDLINK
#define LCW_STATE_TABLESELECTION
#define LCW_STATE_FIELDSELECTION
#define LCW_STATE_DATASOURCE_SELECTION
OUString ModuleRes(TranslateId pId)
IMPL_LINK_NOARG(OTableSelectionPage, OnSearchClicked, weld::Button &, void)
IMPL_LINK(OTableSelectionPage, OnListboxDoubleClicked, weld::TreeView &, _rBox, bool)
css::uno::Reference< css::beans::XPropertySet > xObjectModel
OUString sListContentTable
OUString sListContentField
OUString sLinkedFormField
OUString sLinkedListField
#define WZS_INVALID_STATE