38 using ::com::sun::star::uno::Reference;
39 using ::com::sun::star::uno::Any;
40 using ::com::sun::star::uno::XComponentContext;
41 using ::com::sun::star::beans::XPropertySet;
42 using ::com::sun::star::sdbc::XConnection;
43 using ::com::sun::star::sdbc::XDriver;
58 , m_aBooleanSettings {
66 { m_xCatalog,
"usecatalogname",
DSID_CATALOG,
false,
false },
67 { m_xSchema,
"useschemaname",
DSID_SCHEMA,
false,
false },
78 const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() );
80 for (
auto & booleanSetting : m_aBooleanSettings)
82 sal_uInt16 nItemId = booleanSetting.nItemId;
83 if ( rFeatures.has( nItemId ) )
86 const SfxPoolItem& rItem = _rCoreAttrs.Get(nItemId);
87 booleanSetting.bOptionalBool =
dynamic_cast<const OptionalBoolItem*
>(&rItem) !=
nullptr;
88 booleanSetting.xControl = m_xBuilder->weld_check_button(booleanSetting.sControlId);
89 if (booleanSetting.bOptionalBool)
90 booleanSetting.xControl->connect_toggled(
LINK(
this, SpecialSettingsPage, OnTriStateToggleHdl));
92 booleanSetting.xControl->connect_toggled(
LINK(
this, SpecialSettingsPage, OnToggleHdl));
93 booleanSetting.xControl->show();
98 if ( m_bHasBooleanComparisonMode )
100 m_xBooleanComparisonModeLabel = m_xBuilder->weld_label(
"comparisonft");
101 m_xBooleanComparisonMode = m_xBuilder->weld_combo_box(
"comparison");
102 m_xBooleanComparisonMode->connect_changed(
LINK(
this, SpecialSettingsPage, BooleanComparisonSelectHdl));
103 m_xBooleanComparisonModeLabel->show();
104 m_xBooleanComparisonMode->show();
107 if ( m_bHasMaxRowScan )
109 m_xMaxRowScanLabel = m_xBuilder->weld_label(
"rowsft");
110 m_xMaxRowScan = m_xBuilder->weld_spin_button(
"rows");
111 m_xMaxRowScan->connect_value_changed(
LINK(
this, OGenericAdministrationPage, OnControlSpinButtonModifyHdl));
112 m_xMaxRowScanLabel->show();
113 m_xMaxRowScan->show();
119 auto eOldState = m_aTriStates[&rToggle];
132 m_aTriStates[&rToggle] = rToggle.get_state();
133 OnToggleHdl(rToggle);
138 if (&rBtn == m_xAppendTableAlias.get() && m_xAsBeforeCorrelationName)
141 m_xAsBeforeCorrelationName->set_sensitive(m_xAppendTableAlias->get_active());
143 OnControlModifiedButtonClick(rBtn);
148 callModifiedHdl(&rControl);
151 SpecialSettingsPage::~SpecialSettingsPage()
155 void SpecialSettingsPage::fillWindows( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList )
157 if ( m_bHasBooleanComparisonMode )
161 if ( m_bHasMaxRowScan )
167 void SpecialSettingsPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
169 for (
auto const& booleanSetting : m_aBooleanSettings)
171 if (booleanSetting.xControl)
177 if ( m_bHasBooleanComparisonMode )
179 if ( m_bHasMaxRowScan )
183 void SpecialSettingsPage::implInitControls(
const SfxItemSet& _rSet,
bool _bSaveValue)
186 bool bValid, bReadonly;
187 getFlags( _rSet, bValid, bReadonly );
191 OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
195 m_aTriStates.clear();
198 for (
auto const& booleanSetting : m_aBooleanSettings)
200 if (!booleanSetting.xControl)
203 bool bTriState =
false;
205 std::optional<bool> aValue;
210 aValue = pBoolItem->GetValue();
214 aValue = pOptionalItem->GetFullValue();
218 OSL_FAIL(
"SpecialSettingsPage::implInitControls: unknown boolean item type!" );
226 bool bValue = *aValue;
227 if ( booleanSetting.bInvertedDisplay )
229 booleanSetting.xControl->set_active(bValue);
232 m_aTriStates[booleanSetting.xControl.get()] = booleanSetting.xControl->get_state();
235 if (m_xAppendTableAlias && m_xAsBeforeCorrelationName)
238 m_xAsBeforeCorrelationName->set_sensitive(m_xAppendTableAlias->get_active());
242 if ( m_bHasBooleanComparisonMode )
245 m_xBooleanComparisonMode->set_active(
static_cast<sal_uInt16
>(pBooleanComparison->
GetValue()));
248 if ( m_bHasMaxRowScan )
251 m_xMaxRowScan->set_value(pMaxRowScan->
GetValue());
254 OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
259 bool bChangedSomething =
false;
262 for (
auto const& booleanSetting : m_aBooleanSettings)
264 if (!booleanSetting.xControl)
266 fillBool(*_rSet, booleanSetting.xControl.get(), booleanSetting.nItemId, booleanSetting.bOptionalBool, bChangedSomething, booleanSetting.bInvertedDisplay);
270 if ( m_bHasBooleanComparisonMode )
272 if (m_xBooleanComparisonMode->get_value_changed_from_saved())
275 bChangedSomething =
true;
278 if ( m_bHasMaxRowScan )
282 return bChangedSomething;
288 , m_xAutoRetrievingEnabled(m_xBuilder->weld_check_button(
"autoretrieve"))
289 , m_xGrid(m_xBuilder->weld_widget(
"grid"))
290 , m_xAutoIncrement(m_xBuilder->weld_entry(
"statement"))
291 , m_xAutoRetrieving(m_xBuilder->weld_entry(
"query"))
300 m_xGrid->set_sensitive(rBtn.get_active());
301 OnControlModifiedButtonClick(rBtn);
323 bool bValid, bReadonly;
334 bool bEnabled = pAutoRetrieveEnabledItem->
GetValue();
347 bool bChangedSomething =
false;
353 return bChangedSomething;
359 :
SfxTabDialogController(pParent,
"dbaccess/ui/advancedsettingsdialog.ui",
"AdvancedSettingsDialog", _pItems)
362 m_pImpl->setDataSourceOrName(_aDataSourceName);
364 m_pImpl->translateProperties(xDatasource, *_pItems);
433 return m_pImpl->createConnection();
Reference< XExecutableDialog > m_xDialog
sal_Int32 GetValue() const
const OUString & GetValue() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool PrepareLeaveCurrentPage()
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void SetInputSet(const SfxItemSet *pInSet)
void RemoveTabPage(const OUString &rName)
std::unique_ptr< SfxItemSet > m_xExampleSet
virtual void PageCreated(const OUString &rName, SfxTabPage &rPage)
const SfxItemSet * GetOutputItemSet() const
SfxItemSet * GetInputSetImpl()
virtual ~AdvancedSettingsDialog() override
virtual void PageCreated(const OUString &rId, SfxTabPage &_rPage) override
virtual short Ok() override
AdvancedSettingsDialog(weld::Window *pParent, SfxItemSet *_pItems, const css::uno::Reference< css::uno::XComponentContext > &_rxORB, const css::uno::Any &_aDataSourceName)
static bool doesHaveAnyAdvancedSettings(const OUString &_sURL)
determines whether or not the given data source type has any advanced setting
virtual void saveDatasource() override
virtual void setTitle(const OUString &_sTitle) override
virtual OUString getDatasourceType(const SfxItemSet &_rSet) const override
std::unique_ptr< ODbDataSourceAdministrationHelper > m_pImpl
virtual std::pair< css::uno::Reference< css::sdbc::XConnection >, bool > createConnection() override
virtual void enableConfirmSettings(bool _bEnable) override
enables or disables the user's possibility to confirm the settings
virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override
virtual SfxItemSet * getWriteOutputSet() override
virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override
virtual const SfxItemSet * getOutputSet() const override
virtual void clearPassword() override
can be used to ask for (UI) support for certain advanced features
bool supportsAnySpecialSetting() const
bool supportsGeneratedValues() const
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...
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
std::unique_ptr< weld::Entry > m_xAutoIncrement
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< weld::CheckButton > m_xAutoRetrievingEnabled
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::Entry > m_xAutoRetrieving
virtual ~GeneratedValuesPage() override
static OUString getDatasourceType(const SfxItemSet &_rSet)
extracts the connection type from the given setThe connection type is determined by the value of the ...
static void getFlags(const SfxItemSet &_rSet, bool &_rValid, bool &_rReadonly)
analyze the invalid and the readonly flag which may be present in the set
static void fillString(SfxItemSet &_rSet, const weld::Entry *pEdit, TypedWhichId< SfxStringItem > _nID, bool &_bChangedSomething)
fills the String value into the item set when the value changed.
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...
static void fillBool(SfxItemSet &_rSet, const weld::CheckButton *pCheckBox, sal_uInt16 _nID, bool bOptionalBool, bool &_bChangedSomething, bool _bRevertValue=false)
fills the Boolean value into the item set when the value changed.
std::unique_ptr< weld::CheckButton > m_xIsSQL92Check
SpecialSettingsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &_rCoreAttrs, const DataSourceMetaData &_rDSMeta)
#define DSID_RESPECTRESULTSETTYPE
#define DSID_ESCAPE_DATETIME
#define DSID_ENABLEOUTERJOIN
#define DSID_AS_BEFORE_CORRNAME
#define DSID_INDEXAPPENDIX
#define DSID_MAX_ROW_SCAN
#define DSID_BOOLEANCOMPARISON
#define DSID_PARAMETERNAMESUBST
#define DSID_CHECK_REQUIRED_FIELDS
#define DSID_AUTOINCREMENTVALUE
#define DSID_PRIMARY_KEY_SUPPORT
#define DSID_IGNOREDRIVER_PRIV
#define DSID_AUTORETRIEVEENABLED
#define DSID_IGNORECURRENCY
#define DSID_SUPPRESSVERSIONCL
#define DSID_APPEND_TABLE_ALIAS
#define DSID_AUTORETRIEVEVALUE
#define LINK(Instance, Class, Member)
IMPL_LINK(GeneratedValuesPage, OnAutoToggleHdl, weld::Toggleable &, rBtn, void)
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
Reference< XNameAccess > m_xContainer
std::unique_ptr< weld::CheckButton > & xControl