20#include <core_resource.hxx>
24#include <com/sun/star/util/NumberFormatter.hpp>
29#include <osl/diagnose.h>
49 : GenericDialogController(pParent,
"dbaccess/ui/parametersdialog.ui",
"Parameters")
50 , m_nCurrentlySelected(-1)
52 , m_aPredicateInput( rxContext, _rxConnection, getParseContext() )
53 , m_aResetVisitFlag(
"dbaccess OParameterDialog m_aResetVisitFlag")
54 , m_xAllParams(m_xBuilder->weld_tree_view(
"allParamTreeview"))
55 , m_xParam(m_xBuilder->weld_entry(
"paramEntry"))
56 , m_xTravelNext(m_xBuilder->weld_button(
"next"))
57 , m_xOKBtn(m_xBuilder->weld_button(
"ok"))
58 , m_xCancelBtn(m_xBuilder->weld_button(
"cancel"))
63 m_xFormatter.set( NumberFormatter::create( rxContext ), UNO_QUERY_THROW);
65 OSL_FAIL(
"OParameterDialog::OParameterDialog: need a service factory!");
69 if (!xNumberFormats.is())
72 m_xFormatter->attachNumberFormatsSupplier(xNumberFormats);
75 OSL_ENSURE(rParamContainer->getCount(),
"OParameterDialog::OParameterDialog : can't handle empty containers !");
83 rParamContainer->getByIndex(
i) >>= xParamAsSet;
84 OSL_ENSURE(xParamAsSet.is(),
"Parameter is null!");
138 CheckValueForError();
154 if (xParamAsSet.is())
158 OUString sParamValue(
m_xParam->get_text());
186 m_xParam->set_tooltip_text(sToolTip);
196 if (m_xCancelBtn.get() == &rButton)
202 else if (m_xOKBtn.get() == &rButton)
205 if (OnEntrySelected())
215 PropertyValue*
pValues = m_aFinalValues.getArray();
219 m_xParams->getByIndex(
i) >>= xParamAsSet;
223 pValues->Value = m_aPredicateInput.getPredicateValue( sValue, xParamAsSet );
234 else if (m_xTravelNext.get() == &rButton)
236 if (sal_Int32
nCount = m_xAllParams->n_children())
238 sal_Int32 nCurrent = m_xAllParams->get_selected_index();
239 OSL_ENSURE(
static_cast<size_t>(
nCount) == m_aVisitedParams.size(),
"OParameterDialog::OnButtonClicked : inconsistent lists !");
242 sal_Int32 nNext = (nCurrent + 1) %
nCount;
244 nNext = (nNext + 1) %
nCount;
248 nNext = (nCurrent + 1) %
nCount;
250 m_xAllParams->select(nNext);
282 sal_Int32 nSelected =
m_xAllParams->get_selected_index();
283 OSL_ENSURE(nSelected != -1,
"OParameterDialog::OnEntrySelected : no current entry !");
300 OSL_ENSURE(m_nCurrentlySelected != -1,
"OParameterDialog::OnVisitedTimeout : invalid call !");
303 OSL_ENSURE(
o3tl::make_unsigned(m_nCurrentlySelected) < m_aVisitedParams.size(),
"OParameterDialog::OnVisitedTimeout : invalid entry !");
307 bool bVisited =
false;
308 for (
auto const& visitedParam : m_aVisitedParams)
320 m_xDialog->change_default_widget(m_xTravelNext.get(), m_xOKBtn.get());
327 OSL_ENSURE(
o3tl::make_unsigned(m_nCurrentlySelected) < m_aVisitedParams.size(),
"OParameterDialog::OnValueModified : invalid entry !");
const PropertyValue * pValues
Reference< XExecutableDialog > m_xDialog
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
OParameterDialog(weld::Window *_pParent, const css::uno::Reference< css::container::XIndexAccess > &_rParamContainer, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::uno::Reference< css::sdbc::XConnection > m_xConnection
css::uno::Reference< css::util::XNumberFormatter > m_xFormatter
bool CheckValueForError()
virtual ~OParameterDialog() override
std::vector< VisitFlags > m_aVisitedParams
std::unique_ptr< weld::Button > m_xOKBtn
css::uno::Sequence< css::beans::PropertyValue > m_aFinalValues
std::unique_ptr< weld::Button > m_xTravelNext
css::uno::Reference< css::container::XIndexAccess > m_xParams
::dbtools::OPredicateInputController m_aPredicateInput
std::unique_ptr< weld::Entry > m_xParam
std::unique_ptr< weld::TreeView > m_xAllParams
the final values as entered by the user
std::unique_ptr< weld::Button > m_xCancelBtn
sal_Int32 m_nCurrentlySelected
std::shared_ptr< weld::Dialog > m_xDialog
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
Reference< XConnection > m_xConnection
constexpr OUStringLiteral PROPERTY_NAME(u"Name")