1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "adminpages.hxx"
23 #include <charsetlistbox.hxx>
24 #include "TextConnectionHelper.hxx"
25 #include "admincontrols.hxx"
27 #include <o3tl/typed_flags_set.hxx>
29 enum class OCommonBehaviourTabPageFlags
{
35 template<> struct typed_flags
<OCommonBehaviourTabPageFlags
> : is_typed_flags
<OCommonBehaviourTabPageFlags
, 0x0006> {};
40 /** eases the implementation of tab pages handling user/password and/or character
41 set and/or generic options input
43 The controls to be used have to be defined within the resource, as usual, but
44 this class does all the handling necessary.
46 class OCommonBehaviourTabPage
: public OGenericAdministrationPage
48 OCommonBehaviourTabPageFlags m_nControlFlags
;
50 std::unique_ptr
<weld::Label
> m_xOptionsLabel
;
51 std::unique_ptr
<weld::Entry
> m_xOptions
;
53 std::unique_ptr
<weld::Label
> m_xDataConvertLabel
;
54 std::unique_ptr
<weld::Label
> m_xCharsetLabel
;
55 std::unique_ptr
<CharSetListBox
> m_xCharset
;
58 virtual bool FillItemSet (SfxItemSet
* _rCoreAttrs
) override
;
60 OCommonBehaviourTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const OUString
& rUIXMLDescription
, const OUString
& rId
, const SfxItemSet
& _rCoreAttrs
, OCommonBehaviourTabPageFlags nControlFlags
);
63 virtual ~OCommonBehaviourTabPage() override
;
65 // subclasses must override this, but it isn't pure virtual
66 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
68 // <method>OGenericAdministrationPage::fillControls</method>
69 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
71 // <method>OGenericAdministrationPage::fillWindows</method>
72 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
74 DECL_LINK(CharsetSelectHdl
, weld::ComboBox
&, void);
79 class ODbaseDetailsPage
: public OCommonBehaviourTabPage
82 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
84 ODbaseDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
);
85 virtual ~ODbaseDetailsPage() override
;
89 std::unique_ptr
<weld::CheckButton
> m_xShowDeleted
;
90 std::unique_ptr
<weld::Label
> m_xFT_Message
;
91 std::unique_ptr
<weld::Button
> m_xIndexes
;
94 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
97 DECL_LINK(OnButtonClicked
, weld::Button
&, void);
98 DECL_LINK(OnButtonToggled
, weld::Toggleable
&, void);
102 class OAdoDetailsPage
: public OCommonBehaviourTabPage
105 OAdoDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
109 class OOdbcDetailsPage
: public OCommonBehaviourTabPage
112 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
114 OOdbcDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
115 virtual ~OOdbcDetailsPage() override
;
117 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
119 std::unique_ptr
<weld::CheckButton
> m_xUseCatalog
;
122 // OUserDriverDetailsPage
123 class OUserDriverDetailsPage
: public OCommonBehaviourTabPage
126 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
128 OUserDriverDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
);
129 virtual ~OUserDriverDetailsPage() override
;
131 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
132 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
133 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
135 std::unique_ptr
<weld::Label
> m_xFTHostname
;
136 std::unique_ptr
<weld::Entry
> m_xEDHostname
;
137 std::unique_ptr
<weld::Label
> m_xPortNumber
;
138 std::unique_ptr
<weld::SpinButton
> m_xNFPortNumber
;
139 std::unique_ptr
<weld::CheckButton
> m_xUseCatalog
;
142 // OMySQLODBCDetailsPage
143 class OMySQLODBCDetailsPage
: public OCommonBehaviourTabPage
146 OMySQLODBCDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
149 // OGeneralSpecialJDBCDetailsPage
150 class OGeneralSpecialJDBCDetailsPage final
: public OCommonBehaviourTabPage
153 OGeneralSpecialJDBCDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
,
154 const SfxItemSet
& _rCoreAttrs
,
156 bool bShowSocket
= true);
157 virtual ~OGeneralSpecialJDBCDetailsPage() override
;
161 virtual bool FillItemSet( SfxItemSet
* _rCoreAttrs
) override
;
162 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
163 virtual void callModifiedHdl(weld::Widget
* pControl
= nullptr) override
;
165 DECL_LINK(OnTestJavaClickHdl
, weld::Button
&, void);
167 OUString m_sDefaultJdbcDriverName
;
168 TypedWhichId
<SfxInt32Item
> m_nPortId
;
171 std::unique_ptr
<weld::Entry
> m_xEDHostname
;
172 std::unique_ptr
<weld::SpinButton
> m_xNFPortNumber
;
173 std::unique_ptr
<weld::Label
> m_xFTSocket
;
174 std::unique_ptr
<weld::Entry
> m_xEDSocket
;
175 std::unique_ptr
<weld::Label
> m_xFTDriverClass
;
176 std::unique_ptr
<weld::Entry
> m_xEDDriverClass
;
177 std::unique_ptr
<weld::Button
> m_xTestJavaDriver
;
181 class MySQLNativePage
: public OCommonBehaviourTabPage
184 MySQLNativePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
185 virtual ~MySQLNativePage() override
;
188 std::unique_ptr
<weld::Widget
> m_xMySQLSettingsContainer
;
189 std::unique_ptr
<MySQLNativeSettings
> m_xMySQLSettings
;
190 std::unique_ptr
<weld::Label
> m_xSeparator1
;
191 std::unique_ptr
<weld::Label
> m_xSeparator2
;
192 std::unique_ptr
<weld::Label
> m_xUserNameLabel
;
193 std::unique_ptr
<weld::Entry
> m_xUserName
;
194 std::unique_ptr
<weld::CheckButton
> m_xPasswordRequired
;
197 virtual bool FillItemSet( SfxItemSet
* _rCoreAttrs
) override
;
198 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
199 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
200 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
204 class OLDAPDetailsPage
: public OCommonBehaviourTabPage
207 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
209 OLDAPDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
210 virtual ~OLDAPDetailsPage() override
;
212 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
214 sal_Int32 m_iSSLPort
;
215 sal_Int32 m_iNormalPort
;
217 std::unique_ptr
<weld::Entry
> m_xETBaseDN
;
218 std::unique_ptr
<weld::CheckButton
> m_xCBUseSSL
;
219 std::unique_ptr
<weld::SpinButton
> m_xNFPortNumber
;
220 std::unique_ptr
<weld::SpinButton
> m_xNFRowCount
;
222 DECL_LINK(OnCheckBoxClick
, weld::Toggleable
&, void);
226 class OTextDetailsPage
: public OCommonBehaviourTabPage
229 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
231 OTextDetailsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
232 virtual ~OTextDetailsPage() override
;
235 virtual bool prepareLeave() override
;
237 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
238 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
239 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
242 std::unique_ptr
<OTextConnectionHelper
> m_xTextConnectionHelper
;
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */