196de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
396de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
496de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file
596de5490SAndrew Rist * distributed with this work for additional information
696de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file
796de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the
896de5490SAndrew Rist * "License"); you may not use this file except in compliance
996de5490SAndrew Rist * with the License. You may obtain a copy of the License at
1096de5490SAndrew Rist *
1196de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
1296de5490SAndrew Rist *
1396de5490SAndrew Rist * Unless required by applicable law or agreed to in writing,
1496de5490SAndrew Rist * software distributed under the License is distributed on an
1596de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1696de5490SAndrew Rist * KIND, either express or implied. See the License for the
1796de5490SAndrew Rist * specific language governing permissions and limitations
1896de5490SAndrew Rist * under the License.
1996de5490SAndrew Rist *
2096de5490SAndrew Rist *************************************************************/
2196de5490SAndrew Rist
2296de5490SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*b63233d8Sdamjan #include "precompiled_dbui.hxx"
26cdf0e10cSrcweir #ifndef DBAUI_DBSETUPCONNECTIONPAGES_HXX
27cdf0e10cSrcweir #include "DBSetupConnectionPages.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _DBAUI_SQLMESSAGE_HXX_
30cdf0e10cSrcweir #include "sqlmessage.hxx"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _DBU_RESOURCE_HRC_
33cdf0e10cSrcweir #include "dbu_resource.hrc"
34cdf0e10cSrcweir #endif
35*b63233d8Sdamjan #include "AutoControlsDef.hrc"
36cdf0e10cSrcweir #ifndef _DBAUI_DBADMINSETUP_HRC_
37cdf0e10cSrcweir #include "dbadminsetup.hrc"
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _SFXITEMSET_HXX
40cdf0e10cSrcweir #include <svl/itemset.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _SFXSTRITEM_HXX
43cdf0e10cSrcweir #include <svl/stritem.hxx>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _SFXENUMITEM_HXX
46cdf0e10cSrcweir #include <svl/eitem.hxx>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _SFXINTITEM_HXX
49cdf0e10cSrcweir #include <svl/intitem.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _DBAUI_DATASOURCEITEMS_HXX_
52cdf0e10cSrcweir #include "dsitems.hxx"
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #include "dsnItem.hxx"
55cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_
56cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #ifndef _DBAUI_LOCALRESACCESS_HXX_
59cdf0e10cSrcweir #include "localresaccess.hxx"
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
62cdf0e10cSrcweir #include <vcl/msgbox.hxx>
63cdf0e10cSrcweir #endif
64cdf0e10cSrcweir #ifndef _SV_MNEMONIC_HXX
65cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
66cdf0e10cSrcweir #endif
67cdf0e10cSrcweir #ifndef _SVTOOLS_CJKOPTIONS_HXX
68cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
69cdf0e10cSrcweir #endif
70cdf0e10cSrcweir #include <jvmaccess/virtualmachine.hxx>
71cdf0e10cSrcweir #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
72cdf0e10cSrcweir #include <connectivity/CommonTools.hxx>
73cdf0e10cSrcweir #endif
74cdf0e10cSrcweir #ifndef DBAUI_DRIVERSETTINGS_HXX
75cdf0e10cSrcweir #include "DriverSettings.hxx"
76cdf0e10cSrcweir #endif
77cdf0e10cSrcweir #ifndef _DBAUI_DBADMIN_HXX_
78cdf0e10cSrcweir #include "dbadmin.hxx"
79cdf0e10cSrcweir #endif
80cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
81cdf0e10cSrcweir #include <comphelper/types.hxx>
82cdf0e10cSrcweir #endif
83cdf0e10cSrcweir
84cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HPP_
85cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
86cdf0e10cSrcweir #endif
87cdf0e10cSrcweir // #106016# ------------------------------------
88cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
89cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
90cdf0e10cSrcweir #endif
91cdf0e10cSrcweir #include <com/sun/star/sdbc/XDriverAccess.hpp>
92cdf0e10cSrcweir #include "dbustrings.hrc"
93cdf0e10cSrcweir #ifndef SVTOOLS_FILENOTATION_HXX_
94cdf0e10cSrcweir #include <svl/filenotation.hxx>
95cdf0e10cSrcweir #endif
96cdf0e10cSrcweir
97cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
98cdf0e10cSrcweir #include <unotools/ucbhelper.hxx>
99cdf0e10cSrcweir #include <ucbhelper/commandenvironment.hxx>
100cdf0e10cSrcweir #include "finteraction.hxx"
101cdf0e10cSrcweir #include <connectivity/CommonTools.hxx>
102cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
103cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
104cdf0e10cSrcweir #include <svtools/roadmapwizard.hxx>
105cdf0e10cSrcweir #include "TextConnectionHelper.hxx"
106cdf0e10cSrcweir
107cdf0e10cSrcweir
108cdf0e10cSrcweir //.........................................................................
109cdf0e10cSrcweir namespace dbaui
110cdf0e10cSrcweir {
111cdf0e10cSrcweir //.........................................................................
112cdf0e10cSrcweir using namespace ::com::sun::star;
113cdf0e10cSrcweir // using namespace ::com::sun::star::ucb;
114cdf0e10cSrcweir // using namespace ::com::sun::star::ui::dialogs;
115cdf0e10cSrcweir // using namespace ::com::sun::star::sdbc;
116cdf0e10cSrcweir // using namespace ::com::sun::star::beans;
117cdf0e10cSrcweir // using namespace ::com::sun::star::lang;
118cdf0e10cSrcweir // using namespace ::com::sun::star::container;
119cdf0e10cSrcweir // using namespace ::dbtools;
120cdf0e10cSrcweir // using namespace ::svt;
121cdf0e10cSrcweir
CreateTextTabPage(Window * pParent,const SfxItemSet & _rAttrSet)122cdf0e10cSrcweir OGenericAdministrationPage* OTextConnectionPageSetup::CreateTextTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir return ( new OTextConnectionPageSetup( pParent, _rAttrSet ) );
125cdf0e10cSrcweir }
126cdf0e10cSrcweir
127cdf0e10cSrcweir
128cdf0e10cSrcweir //========================================================================
129cdf0e10cSrcweir //= OTextConnectionPageSetup
130cdf0e10cSrcweir //========================================================================
DBG_NAME(OTextConnectionPageSetup)131cdf0e10cSrcweir DBG_NAME(OTextConnectionPageSetup)
132cdf0e10cSrcweir //------------------------------------------------------------------------
133cdf0e10cSrcweir OTextConnectionPageSetup::OTextConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
134cdf0e10cSrcweir :OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_TEXT, _rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
135cdf0e10cSrcweir {
136cdf0e10cSrcweir DBG_CTOR(OTextConnectionPageSetup,NULL);
137cdf0e10cSrcweir
138cdf0e10cSrcweir m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_SEPARATORS );
139cdf0e10cSrcweir m_pTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
140cdf0e10cSrcweir
141cdf0e10cSrcweir FreeResource();
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
144cdf0e10cSrcweir
145cdf0e10cSrcweir // -----------------------------------------------------------------------
~OTextConnectionPageSetup()146cdf0e10cSrcweir OTextConnectionPageSetup::~OTextConnectionPageSetup()
147cdf0e10cSrcweir {
148cdf0e10cSrcweir DELETEZ(m_pTextConnectionHelper);
149cdf0e10cSrcweir
150cdf0e10cSrcweir DBG_DTOR(OTextConnectionPageSetup,NULL);
151cdf0e10cSrcweir }
152cdf0e10cSrcweir
153cdf0e10cSrcweir IMPL_LINK(OTextConnectionPageSetup, ImplGetExtensionHdl, OTextConnectionHelper*, /*_pTextConnectionHelper*/)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir SetRoadmapStateValue((m_pTextConnectionHelper->GetExtension().Len() > 0) && OConnectionTabPageSetup::checkTestConnection());
156cdf0e10cSrcweir callModifiedHdl();
157cdf0e10cSrcweir return sal_True;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir
checkTestConnection()161cdf0e10cSrcweir bool OTextConnectionPageSetup::checkTestConnection()
162cdf0e10cSrcweir {
163cdf0e10cSrcweir bool bDoEnable = OConnectionTabPageSetup::checkTestConnection();
164cdf0e10cSrcweir bDoEnable = (m_pTextConnectionHelper->GetExtension().Len() > 0) && bDoEnable;
165cdf0e10cSrcweir return bDoEnable;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir
168cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)169cdf0e10cSrcweir void OTextConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
170cdf0e10cSrcweir {
171cdf0e10cSrcweir OConnectionTabPageSetup::fillControls(_rControlList);
172cdf0e10cSrcweir m_pTextConnectionHelper->fillControls(_rControlList);
173cdf0e10cSrcweir }
174cdf0e10cSrcweir // -----------------------------------------------------------------------
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)175cdf0e10cSrcweir void OTextConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
176cdf0e10cSrcweir {
177cdf0e10cSrcweir OConnectionTabPageSetup::fillWindows(_rControlList);
178cdf0e10cSrcweir m_pTextConnectionHelper->fillWindows(_rControlList);
179cdf0e10cSrcweir }
180cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)181cdf0e10cSrcweir void OTextConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
182cdf0e10cSrcweir {
183cdf0e10cSrcweir // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
184cdf0e10cSrcweir sal_Bool bValid, bReadonly;
185cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly);
186cdf0e10cSrcweir OConnectionTabPageSetup::implInitControls( _rSet, _bSaveValue);
187cdf0e10cSrcweir m_pTextConnectionHelper->implInitControls(_rSet, bValid);
188cdf0e10cSrcweir }
189cdf0e10cSrcweir
190cdf0e10cSrcweir
191cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)192cdf0e10cSrcweir sal_Bool OTextConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
195cdf0e10cSrcweir bChangedSomething = m_pTextConnectionHelper->FillItemSet(_rSet, bChangedSomething);
196cdf0e10cSrcweir return bChangedSomething;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
199cdf0e10cSrcweir
prepareLeave()200cdf0e10cSrcweir sal_Bool OTextConnectionPageSetup::prepareLeave(){
201cdf0e10cSrcweir return m_pTextConnectionHelper->prepareLeave();
202cdf0e10cSrcweir }
203cdf0e10cSrcweir
204cdf0e10cSrcweir
CreateLDAPTabPage(Window * pParent,const SfxItemSet & _rAttrSet)205cdf0e10cSrcweir OGenericAdministrationPage* OLDAPConnectionPageSetup::CreateLDAPTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) );
208cdf0e10cSrcweir }
209cdf0e10cSrcweir
210cdf0e10cSrcweir
211cdf0e10cSrcweir //========================================================================
212cdf0e10cSrcweir //= OLDAPPageSetup
213cdf0e10cSrcweir //========================================================================
OLDAPConnectionPageSetup(Window * pParent,const SfxItemSet & _rCoreAttrs)214cdf0e10cSrcweir OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
215cdf0e10cSrcweir :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_LDAP), _rCoreAttrs)
216cdf0e10cSrcweir ,m_aFTHeaderText (this, ModuleRes(FT_LDAP_HEADERTEXT))
217cdf0e10cSrcweir ,m_aFTHelpText (this, ModuleRes(FT_LDAP_HELPTEXT))
218cdf0e10cSrcweir ,m_aFTHostServer (this, ModuleRes(FT_AUTOHOSTNAME))
219cdf0e10cSrcweir ,m_aETHostServer (this, ModuleRes(ET_AUTOHOSTNAME))
220cdf0e10cSrcweir ,m_aFTBaseDN (this, ModuleRes(FT_AUTOBASEDN))
221cdf0e10cSrcweir ,m_aETBaseDN (this, ModuleRes(ET_AUTOBASEDN))
222cdf0e10cSrcweir ,m_aFTPortNumber (this, ModuleRes(FT_AUTOPORTNUMBER))
223cdf0e10cSrcweir ,m_aNFPortNumber (this, ModuleRes(NF_AUTOPORTNUMBER))
224cdf0e10cSrcweir ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
225cdf0e10cSrcweir ,m_aCBUseSSL (this, ModuleRes(CB_WIZ_USESSL))
226cdf0e10cSrcweir {
227cdf0e10cSrcweir SetControlFontWeight(&m_aFTHeaderText);
228cdf0e10cSrcweir m_aFTDefaultPortNumber.SetText(String(ModuleRes(STR_LDAP_DEFAULT)));
229cdf0e10cSrcweir m_aETHostServer.SetModifyHdl(getControlModifiedLink());
230cdf0e10cSrcweir m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
231cdf0e10cSrcweir m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
232cdf0e10cSrcweir m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
233cdf0e10cSrcweir SetRoadmapStateValue(sal_False);
234cdf0e10cSrcweir FreeResource();
235cdf0e10cSrcweir }
236cdf0e10cSrcweir
237cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)238cdf0e10cSrcweir sal_Bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir sal_Bool bChangedSomething = sal_False;
241cdf0e10cSrcweir fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN, bChangedSomething);
242cdf0e10cSrcweir fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
243cdf0e10cSrcweir
244cdf0e10cSrcweir if ( m_aETHostServer.GetText() != m_aETHostServer.GetSavedValue() )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
247cdf0e10cSrcweir ::dbaccess::ODsnTypeCollection* pCollection = NULL;
248cdf0e10cSrcweir if (pCollectionItem)
249cdf0e10cSrcweir pCollection = pCollectionItem->getCollection();
250cdf0e10cSrcweir DBG_ASSERT(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
251cdf0e10cSrcweir
252cdf0e10cSrcweir String sUrl = pCollection->getPrefix( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:ldap:")));
253cdf0e10cSrcweir sUrl += m_aETHostServer.GetText();
254cdf0e10cSrcweir _rSet.Put(SfxStringItem(DSID_CONNECTURL, sUrl));
255cdf0e10cSrcweir bChangedSomething = sal_True;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
258cdf0e10cSrcweir // fillString(_rSet,&m_aETHostServer, DSID_CONNECTURL, bChangedSomething);
259cdf0e10cSrcweir fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
260cdf0e10cSrcweir return bChangedSomething;
261cdf0e10cSrcweir }
262cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)263cdf0e10cSrcweir void OLDAPConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
264cdf0e10cSrcweir {
265cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostServer));
266cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
267cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
268cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
269cdf0e10cSrcweir }
270cdf0e10cSrcweir // -----------------------------------------------------------------------
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)271cdf0e10cSrcweir void OLDAPConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
274cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostServer));
275cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTBaseDN));
276cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
277cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
278cdf0e10cSrcweir }
279cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)280cdf0e10cSrcweir void OLDAPConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
281cdf0e10cSrcweir {
282cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
283cdf0e10cSrcweir sal_Bool bValid, bReadonly;
284cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly);
285cdf0e10cSrcweir
286cdf0e10cSrcweir
287cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
288cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
289cdf0e10cSrcweir
290cdf0e10cSrcweir if ( bValid )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir m_aETBaseDN.SetText(pBaseDN->GetValue());
293cdf0e10cSrcweir m_aNFPortNumber.SetValue(pPortNumber->GetValue());
294cdf0e10cSrcweir }
295cdf0e10cSrcweir OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
296cdf0e10cSrcweir callModifiedHdl();
297cdf0e10cSrcweir }
298cdf0e10cSrcweir
299cdf0e10cSrcweir // -----------------------------------------------------------------------
300cdf0e10cSrcweir IMPL_LINK(OLDAPConnectionPageSetup, OnEditModified, Edit*, /*_pEdit*/)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir sal_Bool bRoadmapState = ((m_aETHostServer.GetText().Len() != 0 ) && ( m_aETBaseDN.GetText().Len() != 0 ) && (m_aFTPortNumber.GetText().Len() != 0 ));
303cdf0e10cSrcweir SetRoadmapStateValue(bRoadmapState);
304cdf0e10cSrcweir callModifiedHdl();
305cdf0e10cSrcweir return 0L;
306cdf0e10cSrcweir }
307cdf0e10cSrcweir
308cdf0e10cSrcweir
309cdf0e10cSrcweir // ----------------------------------------------------------------------- //OGenericAdministrationPage*
CreateMySQLIntroTabPage(Window * _pParent,const SfxItemSet & _rAttrSet)310cdf0e10cSrcweir OMySQLIntroPageSetup* OMySQLIntroPageSetup::CreateMySQLIntroTabPage( Window* _pParent, const SfxItemSet& _rAttrSet )
311cdf0e10cSrcweir {
312cdf0e10cSrcweir return ( new OMySQLIntroPageSetup( _pParent, _rAttrSet) );
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
DBG_NAME(OMySQLIntroPageSetup)315cdf0e10cSrcweir DBG_NAME(OMySQLIntroPageSetup)
316cdf0e10cSrcweir
317cdf0e10cSrcweir OMySQLIntroPageSetup::OMySQLIntroPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
318cdf0e10cSrcweir :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_MYSQL_INTRO), _rCoreAttrs)
319cdf0e10cSrcweir ,m_aRB_ODBCDatabase(this, ModuleRes(RB_CONNECTVIAODBC))
320cdf0e10cSrcweir ,m_aRB_JDBCDatabase(this, ModuleRes(RB_CONNECTVIAJDBC))
321cdf0e10cSrcweir ,m_aRB_NATIVEDatabase(this, ModuleRes(RB_CONNECTVIANATIVE))
322cdf0e10cSrcweir ,m_aFT_ConnectionMode(this, ModuleRes(FT_MYSQLCONNECTIONMODE))
323cdf0e10cSrcweir ,m_aFT_Helptext(this, ModuleRes(FT_MYSQL_HELPTEXT))
324cdf0e10cSrcweir ,m_aFT_Headertext(this, ModuleRes(FT_MYSQL_HEADERTEXT))
325cdf0e10cSrcweir {
326cdf0e10cSrcweir DBG_CTOR(OMySQLIntroPageSetup,NULL);
327cdf0e10cSrcweir
328cdf0e10cSrcweir SetControlFontWeight(&m_aFT_Headertext);
329cdf0e10cSrcweir m_aRB_ODBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
330cdf0e10cSrcweir m_aRB_JDBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
331cdf0e10cSrcweir m_aRB_NATIVEDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
332cdf0e10cSrcweir FreeResource();
333cdf0e10cSrcweir }
334cdf0e10cSrcweir
335cdf0e10cSrcweir IMPL_LINK(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton*, /*_pBox*/)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir maClickHdl.Call( this );
338cdf0e10cSrcweir return true;
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
341cdf0e10cSrcweir // -----------------------------------------------------------------------
~OMySQLIntroPageSetup()342cdf0e10cSrcweir OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
343cdf0e10cSrcweir {
344cdf0e10cSrcweir
345cdf0e10cSrcweir DBG_DTOR(OMySQLIntroPageSetup,NULL);
346cdf0e10cSrcweir }
347cdf0e10cSrcweir
348cdf0e10cSrcweir
349cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool)350cdf0e10cSrcweir void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
351cdf0e10cSrcweir {
352cdf0e10cSrcweir // show the "Connect directly" option only if the driver is installed
353cdf0e10cSrcweir DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
354cdf0e10cSrcweir bool bHasMySQLNative = ( pCollectionItem != NULL ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" );
355cdf0e10cSrcweir if ( bHasMySQLNative )
356cdf0e10cSrcweir m_aRB_NATIVEDatabase.Show();
357cdf0e10cSrcweir
358cdf0e10cSrcweir // if any of the options is checked, then there's nothing to do
359cdf0e10cSrcweir if ( m_aRB_ODBCDatabase.IsChecked() || m_aRB_JDBCDatabase.IsChecked() || m_aRB_NATIVEDatabase.IsChecked() )
360cdf0e10cSrcweir return;
361cdf0e10cSrcweir
362cdf0e10cSrcweir // prefer "native" or "JDBC"
363cdf0e10cSrcweir if ( bHasMySQLNative )
364cdf0e10cSrcweir m_aRB_NATIVEDatabase.Check();
365cdf0e10cSrcweir else
366cdf0e10cSrcweir m_aRB_JDBCDatabase.Check();
367cdf0e10cSrcweir }
368cdf0e10cSrcweir
369cdf0e10cSrcweir
370cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > &)371cdf0e10cSrcweir void OMySQLIntroPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
372cdf0e10cSrcweir {
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
375cdf0e10cSrcweir // -----------------------------------------------------------------------
fillWindows(::std::vector<ISaveValueWrapper * > &)376cdf0e10cSrcweir void OMySQLIntroPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
377cdf0e10cSrcweir {
378cdf0e10cSrcweir }
379cdf0e10cSrcweir
380cdf0e10cSrcweir
381cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet &)382cdf0e10cSrcweir sal_Bool OMySQLIntroPageSetup::FillItemSet(SfxItemSet& /*_rSet*/)
383cdf0e10cSrcweir {
384cdf0e10cSrcweir OSL_ENSURE(sal_False,"Who called me?! Please ask oj for more information.");
385cdf0e10cSrcweir return sal_True;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
388cdf0e10cSrcweir
getMySQLMode()389cdf0e10cSrcweir OMySQLIntroPageSetup::ConnectionType OMySQLIntroPageSetup::getMySQLMode()
390cdf0e10cSrcweir {
391cdf0e10cSrcweir if (m_aRB_JDBCDatabase.IsChecked())
392cdf0e10cSrcweir return VIA_JDBC;
393cdf0e10cSrcweir else if (m_aRB_NATIVEDatabase.IsChecked())
394cdf0e10cSrcweir return VIA_NATIVE;
395cdf0e10cSrcweir else
396cdf0e10cSrcweir return VIA_ODBC;
397cdf0e10cSrcweir }
398cdf0e10cSrcweir
399cdf0e10cSrcweir // =======================================================================
400cdf0e10cSrcweir // = MySQLNativeSetupPage
401cdf0e10cSrcweir // =======================================================================
402cdf0e10cSrcweir // -----------------------------------------------------------------------
MySQLNativeSetupPage(Window * _pParent,const SfxItemSet & _rCoreAttrs)403cdf0e10cSrcweir MySQLNativeSetupPage::MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs )
404cdf0e10cSrcweir :OGenericAdministrationPage( _pParent, ModuleRes( PAGE_DBWIZARD_MYSQL_NATIVE ), _rCoreAttrs )
405cdf0e10cSrcweir ,m_aHeader ( this, ModuleRes( FT_SETUP_WIZARD_HEADER ) )
406cdf0e10cSrcweir ,m_aHelpText ( this, ModuleRes( FT_SETUP_WIZARD_HELP ) )
407cdf0e10cSrcweir ,m_aMySQLSettings ( *this, getControlModifiedLink() )
408cdf0e10cSrcweir {
409cdf0e10cSrcweir SetControlFontWeight( &m_aHeader );
410cdf0e10cSrcweir
411cdf0e10cSrcweir LayoutHelper::positionBelow( m_aHelpText, m_aMySQLSettings, UnrelatedControls, 0 );
412cdf0e10cSrcweir m_aMySQLSettings.Show();
413cdf0e10cSrcweir
414cdf0e10cSrcweir SetRoadmapStateValue(sal_False);
415cdf0e10cSrcweir FreeResource();
416cdf0e10cSrcweir }
417cdf0e10cSrcweir
418cdf0e10cSrcweir // -----------------------------------------------------------------------
Create(Window * pParent,const SfxItemSet & _rAttrSet)419cdf0e10cSrcweir OGenericAdministrationPage* MySQLNativeSetupPage::Create( Window* pParent, const SfxItemSet& _rAttrSet )
420cdf0e10cSrcweir {
421cdf0e10cSrcweir return new MySQLNativeSetupPage( pParent, _rAttrSet );
422cdf0e10cSrcweir }
423cdf0e10cSrcweir
424cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)425cdf0e10cSrcweir void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
426cdf0e10cSrcweir {
427cdf0e10cSrcweir m_aMySQLSettings.fillControls( _rControlList );
428cdf0e10cSrcweir }
429cdf0e10cSrcweir
430cdf0e10cSrcweir // -----------------------------------------------------------------------
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)431cdf0e10cSrcweir void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
432cdf0e10cSrcweir {
433cdf0e10cSrcweir _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHelpText ) );
434cdf0e10cSrcweir m_aMySQLSettings.fillWindows( _rControlList );
435cdf0e10cSrcweir }
436cdf0e10cSrcweir
437cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)438cdf0e10cSrcweir sal_Bool MySQLNativeSetupPage::FillItemSet( SfxItemSet& _rSet )
439cdf0e10cSrcweir {
440cdf0e10cSrcweir return m_aMySQLSettings.FillItemSet( _rSet );
441cdf0e10cSrcweir }
442cdf0e10cSrcweir
443cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)444cdf0e10cSrcweir void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir m_aMySQLSettings.implInitControls( _rSet );
447cdf0e10cSrcweir
448cdf0e10cSrcweir OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
449cdf0e10cSrcweir
450cdf0e10cSrcweir OnModified( NULL );
451cdf0e10cSrcweir }
452cdf0e10cSrcweir
453cdf0e10cSrcweir // -----------------------------------------------------------------------
getControlModifiedLink()454cdf0e10cSrcweir Link MySQLNativeSetupPage::getControlModifiedLink()
455cdf0e10cSrcweir {
456cdf0e10cSrcweir return LINK( this, MySQLNativeSetupPage, OnModified );
457cdf0e10cSrcweir }
458cdf0e10cSrcweir
459cdf0e10cSrcweir // -----------------------------------------------------------------------
IMPL_LINK(MySQLNativeSetupPage,OnModified,Edit *,_pEdit)460cdf0e10cSrcweir IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit )
461cdf0e10cSrcweir {
462cdf0e10cSrcweir SetRoadmapStateValue( m_aMySQLSettings.canAdvance() );
463cdf0e10cSrcweir
464cdf0e10cSrcweir return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit );
465cdf0e10cSrcweir }
466cdf0e10cSrcweir
467cdf0e10cSrcweir //========================================================================
468cdf0e10cSrcweir //= OMySQLJDBCConnectionPageSetup
469cdf0e10cSrcweir //========================================================================
OGeneralSpecialJDBCConnectionPageSetup(Window * pParent,sal_uInt16 _nResId,const SfxItemSet & _rCoreAttrs,sal_uInt16 _nPortId,sal_uInt16 _nDefaultPortResId,sal_uInt16 _nHelpTextResId,sal_uInt16 _nHeaderTextResId,sal_uInt16 _nDriverClassId)470cdf0e10cSrcweir OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,sal_uInt16 _nResId, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, sal_uInt16 _nDefaultPortResId, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderTextResId, sal_uInt16 _nDriverClassId)
471cdf0e10cSrcweir :OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs)
472cdf0e10cSrcweir ,m_aFTHelpText (this, ModuleRes(FT_AUTOWIZARDHELPTEXT))
473cdf0e10cSrcweir ,m_aFTDatabasename (this, ModuleRes(FT_AUTODATABASENAME))
474cdf0e10cSrcweir ,m_aETDatabasename (this, ModuleRes(ET_AUTODATABASENAME))
475cdf0e10cSrcweir ,m_aFTHostname (this, ModuleRes(FT_AUTOHOSTNAME))
476cdf0e10cSrcweir ,m_aETHostname (this, ModuleRes(ET_AUTOHOSTNAME))
477cdf0e10cSrcweir ,m_aFTPortNumber (this, ModuleRes(FT_AUTOPORTNUMBER))
478cdf0e10cSrcweir ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
479cdf0e10cSrcweir ,m_aNFPortNumber (this, ModuleRes(NF_AUTOPORTNUMBER))
480cdf0e10cSrcweir ,m_aFTDriverClass (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
481cdf0e10cSrcweir ,m_aETDriverClass (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
482cdf0e10cSrcweir ,m_aPBTestJavaDriver (this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
483cdf0e10cSrcweir ,m_nPortId(_nPortId)
484cdf0e10cSrcweir {
485cdf0e10cSrcweir m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId)));
486cdf0e10cSrcweir
487cdf0e10cSrcweir m_aFTDefaultPortNumber.SetText(String(ModuleRes(_nDefaultPortResId)));
488cdf0e10cSrcweir String sHelpText = String(ModuleRes(_nHelpTextResId));
489cdf0e10cSrcweir m_aFTHelpText.SetText(sHelpText);
490cdf0e10cSrcweir //TODO this code snippet is redundant
491cdf0e10cSrcweir SetHeaderText(FT_AUTOWIZARDHEADER, _nHeaderTextResId);
492cdf0e10cSrcweir
493cdf0e10cSrcweir m_aETDatabasename.SetModifyHdl(getControlModifiedLink());
494cdf0e10cSrcweir m_aETHostname.SetModifyHdl(getControlModifiedLink());
495cdf0e10cSrcweir m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
496cdf0e10cSrcweir
497cdf0e10cSrcweir m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified));
498cdf0e10cSrcweir m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl));
499cdf0e10cSrcweir
500cdf0e10cSrcweir SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
501cdf0e10cSrcweir SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
502cdf0e10cSrcweir ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
503cdf0e10cSrcweir if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
504cdf0e10cSrcweir {
505cdf0e10cSrcweir m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
506cdf0e10cSrcweir }
507cdf0e10cSrcweir
508cdf0e10cSrcweir SetRoadmapStateValue(sal_False);
509cdf0e10cSrcweir FreeResource();
510cdf0e10cSrcweir }
511cdf0e10cSrcweir
512cdf0e10cSrcweir
513cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateMySQLJDBCTabPage(Window * pParent,const SfxItemSet & _rAttrSet)514cdf0e10cSrcweir OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
515cdf0e10cSrcweir {
516cdf0e10cSrcweir return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
517cdf0e10cSrcweir PAGE_DBWIZARD_MYSQL_JDBC,
518cdf0e10cSrcweir _rAttrSet,
519cdf0e10cSrcweir DSID_MYSQL_PORTNUMBER ,
520cdf0e10cSrcweir STR_MYSQL_DEFAULT,
521cdf0e10cSrcweir STR_MYSQLJDBC_HELPTEXT,
522cdf0e10cSrcweir STR_MYSQLJDBC_HEADERTEXT,
523cdf0e10cSrcweir STR_MYSQL_DRIVERCLASSTEXT) );
524cdf0e10cSrcweir }
525cdf0e10cSrcweir
526cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateOracleJDBCTabPage(Window * pParent,const SfxItemSet & _rAttrSet)527cdf0e10cSrcweir OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
528cdf0e10cSrcweir {
529cdf0e10cSrcweir return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
530cdf0e10cSrcweir PAGE_DBWIZARD_ORACLE,
531cdf0e10cSrcweir _rAttrSet,
532cdf0e10cSrcweir DSID_ORACLE_PORTNUMBER,
533cdf0e10cSrcweir STR_ORACLE_DEFAULT,
534cdf0e10cSrcweir STR_ORACLE_HELPTEXT,
535cdf0e10cSrcweir STR_ORACLE_HEADERTEXT,
536cdf0e10cSrcweir STR_ORACLE_DRIVERCLASSTEXT) );
537cdf0e10cSrcweir }
538cdf0e10cSrcweir
539cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)540cdf0e10cSrcweir void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDatabasename));
543cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
544cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostname));
545cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
546cdf0e10cSrcweir }
547cdf0e10cSrcweir // -----------------------------------------------------------------------
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)548cdf0e10cSrcweir void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
549cdf0e10cSrcweir {
550cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
551cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDatabasename));
552cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
553cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
554cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
555cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
556cdf0e10cSrcweir }
557cdf0e10cSrcweir
558cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)559cdf0e10cSrcweir sal_Bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
560cdf0e10cSrcweir {
561cdf0e10cSrcweir sal_Bool bChangedSomething = sal_False;
562cdf0e10cSrcweir fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
563cdf0e10cSrcweir fillString(_rSet,&m_aETHostname,DSID_CONN_HOSTNAME,bChangedSomething);
564cdf0e10cSrcweir fillString(_rSet,&m_aETDatabasename,DSID_DATABASENAME,bChangedSomething);
565cdf0e10cSrcweir fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
566cdf0e10cSrcweir return bChangedSomething;
567cdf0e10cSrcweir }
568cdf0e10cSrcweir
569cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)570cdf0e10cSrcweir void OGeneralSpecialJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
571cdf0e10cSrcweir {
572cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
573cdf0e10cSrcweir sal_Bool bValid, bReadonly;
574cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly);
575cdf0e10cSrcweir
576cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True);
577cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
578cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
579cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
580cdf0e10cSrcweir
581cdf0e10cSrcweir if ( bValid )
582cdf0e10cSrcweir {
583cdf0e10cSrcweir m_aETDatabasename.SetText(pDatabaseName->GetValue());
584cdf0e10cSrcweir m_aETDatabasename.ClearModifyFlag();
585cdf0e10cSrcweir
586cdf0e10cSrcweir m_aETDriverClass.SetText(pDrvItem->GetValue());
587cdf0e10cSrcweir m_aETDriverClass.ClearModifyFlag();
588cdf0e10cSrcweir
589cdf0e10cSrcweir m_aETHostname.SetText(pHostName->GetValue());
590cdf0e10cSrcweir m_aETHostname.ClearModifyFlag();
591cdf0e10cSrcweir
592cdf0e10cSrcweir m_aNFPortNumber.SetValue(pPortNumber->GetValue());
593cdf0e10cSrcweir m_aNFPortNumber.ClearModifyFlag();
594cdf0e10cSrcweir }
595cdf0e10cSrcweir OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
596cdf0e10cSrcweir
597cdf0e10cSrcweir // to get the correct value when saveValue was called by base class
598cdf0e10cSrcweir if ( !m_aETDriverClass.GetText().Len() )
599cdf0e10cSrcweir {
600cdf0e10cSrcweir m_aETDriverClass.SetText(m_sDefaultJdbcDriverName);
601cdf0e10cSrcweir m_aETDriverClass.SetModifyFlag();
602cdf0e10cSrcweir }
603cdf0e10cSrcweir callModifiedHdl();
604cdf0e10cSrcweir
605cdf0e10cSrcweir sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
606cdf0e10cSrcweir SetRoadmapStateValue(bRoadmapState);
607cdf0e10cSrcweir }
608cdf0e10cSrcweir
609cdf0e10cSrcweir // -----------------------------------------------------------------------
610cdf0e10cSrcweir IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
611cdf0e10cSrcweir {
612cdf0e10cSrcweir OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
613cdf0e10cSrcweir
614cdf0e10cSrcweir sal_Bool bSuccess = sal_False;
615cdf0e10cSrcweir try
616cdf0e10cSrcweir {
617cdf0e10cSrcweir if ( m_aETDriverClass.GetText().Len() )
618cdf0e10cSrcweir {
619cdf0e10cSrcweir // TODO chage jvmaccess
620cdf0e10cSrcweir ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
621cdf0e10cSrcweir bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
622cdf0e10cSrcweir }
623cdf0e10cSrcweir }
624cdf0e10cSrcweir catch(::com::sun::star::uno::Exception&)
625cdf0e10cSrcweir {
626cdf0e10cSrcweir }
627cdf0e10cSrcweir
628cdf0e10cSrcweir sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
629cdf0e10cSrcweir OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
630cdf0e10cSrcweir aMsg.Execute();
631cdf0e10cSrcweir return 0L;
632cdf0e10cSrcweir }
633cdf0e10cSrcweir
634cdf0e10cSrcweir // -----------------------------------------------------------------------
IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup,OnEditModified,Edit *,_pEdit)635cdf0e10cSrcweir IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
636cdf0e10cSrcweir {
637cdf0e10cSrcweir if ( _pEdit == &m_aETDriverClass )
638cdf0e10cSrcweir m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
639cdf0e10cSrcweir sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
640cdf0e10cSrcweir SetRoadmapStateValue(bRoadmapState);
641cdf0e10cSrcweir callModifiedHdl();
642cdf0e10cSrcweir return 0L;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir
645cdf0e10cSrcweir // -----------------------------------------------------------------------
CreateJDBCTabPage(Window * pParent,const SfxItemSet & _rAttrSet)646cdf0e10cSrcweir OGenericAdministrationPage* OJDBCConnectionPageSetup::CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
647cdf0e10cSrcweir {
648cdf0e10cSrcweir return ( new OJDBCConnectionPageSetup( pParent, _rAttrSet));
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir
652cdf0e10cSrcweir //========================================================================
653cdf0e10cSrcweir //= OMySQLJDBCConnectionPageSetup
654cdf0e10cSrcweir //========================================================================
OJDBCConnectionPageSetup(Window * pParent,const SfxItemSet & _rCoreAttrs)655cdf0e10cSrcweir OJDBCConnectionPageSetup::OJDBCConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs)
656cdf0e10cSrcweir :OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_JDBC, _rCoreAttrs, STR_JDBC_HELPTEXT, STR_JDBC_HEADERTEXT, STR_COMMONURL)
657cdf0e10cSrcweir ,m_aFTDriverClass (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
658cdf0e10cSrcweir ,m_aETDriverClass (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
659cdf0e10cSrcweir ,m_aPBTestJavaDriver (this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
660cdf0e10cSrcweir {
661cdf0e10cSrcweir m_aETDriverClass.SetModifyHdl(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
662cdf0e10cSrcweir m_aPBTestJavaDriver.SetClickHdl(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
663cdf0e10cSrcweir FreeResource();
664cdf0e10cSrcweir }
665cdf0e10cSrcweir
666cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)667cdf0e10cSrcweir void OJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
668cdf0e10cSrcweir {
669cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
670cdf0e10cSrcweir }
671cdf0e10cSrcweir
672cdf0e10cSrcweir // -----------------------------------------------------------------------
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)673cdf0e10cSrcweir void OJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
674cdf0e10cSrcweir {
675cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
676cdf0e10cSrcweir }
677cdf0e10cSrcweir
678cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)679cdf0e10cSrcweir sal_Bool OJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
682cdf0e10cSrcweir fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
683cdf0e10cSrcweir return bChangedSomething;
684cdf0e10cSrcweir }
685cdf0e10cSrcweir
686cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)687cdf0e10cSrcweir void OJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
688cdf0e10cSrcweir {
689cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
690cdf0e10cSrcweir sal_Bool bValid, bReadonly;
691cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly);
692cdf0e10cSrcweir
693cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
694cdf0e10cSrcweir
695cdf0e10cSrcweir if ( bValid )
696cdf0e10cSrcweir {
697cdf0e10cSrcweir if ( !pDrvItem->GetValue().Len() )
698cdf0e10cSrcweir {
699cdf0e10cSrcweir String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
700cdf0e10cSrcweir if ( sDefaultJdbcDriverName.Len() )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir m_aETDriverClass.SetText(sDefaultJdbcDriverName);
703cdf0e10cSrcweir m_aETDriverClass.SetModifyFlag();
704cdf0e10cSrcweir } // if ( sDefaultJdbcDriverName.Len() )
705cdf0e10cSrcweir } // if ( !pJdbcDrvItem->GetValue().Len() )
706cdf0e10cSrcweir else
707cdf0e10cSrcweir {
708cdf0e10cSrcweir m_aETDriverClass.SetText(pDrvItem->GetValue());
709cdf0e10cSrcweir m_aETDriverClass.ClearModifyFlag();
710cdf0e10cSrcweir }
711cdf0e10cSrcweir }
712cdf0e10cSrcweir sal_Bool bEnable = pDrvItem->GetValue().Len() != 0;
713cdf0e10cSrcweir m_aPBTestJavaDriver.Enable(bEnable);
714cdf0e10cSrcweir OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
715cdf0e10cSrcweir
716cdf0e10cSrcweir SetRoadmapStateValue(checkTestConnection());
717cdf0e10cSrcweir }
718cdf0e10cSrcweir
719cdf0e10cSrcweir
checkTestConnection()720cdf0e10cSrcweir bool OJDBCConnectionPageSetup::checkTestConnection()
721cdf0e10cSrcweir {
722cdf0e10cSrcweir OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
723cdf0e10cSrcweir sal_Bool bEnableTestConnection = !m_aConnectionURL.IsVisible() || (m_aConnectionURL.GetTextNoPrefix().Len() != 0);
724cdf0e10cSrcweir bEnableTestConnection = bEnableTestConnection && (m_aETDriverClass.GetText().Len() != 0);
725cdf0e10cSrcweir return bEnableTestConnection;
726cdf0e10cSrcweir // m_aTestConnection.Enable(bEnableTestConnection);
727cdf0e10cSrcweir }
728cdf0e10cSrcweir
729cdf0e10cSrcweir
730cdf0e10cSrcweir // -----------------------------------------------------------------------
731cdf0e10cSrcweir IMPL_LINK(OJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
732cdf0e10cSrcweir {
733cdf0e10cSrcweir OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
734cdf0e10cSrcweir sal_Bool bSuccess = sal_False;
735cdf0e10cSrcweir try
736cdf0e10cSrcweir {
737cdf0e10cSrcweir if ( m_aETDriverClass.GetText().Len() )
738cdf0e10cSrcweir {
739cdf0e10cSrcweir // TODO chage jvmaccess
740cdf0e10cSrcweir ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
741cdf0e10cSrcweir bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
742cdf0e10cSrcweir }
743cdf0e10cSrcweir }
744cdf0e10cSrcweir catch(::com::sun::star::uno::Exception&)
745cdf0e10cSrcweir {
746cdf0e10cSrcweir }
747cdf0e10cSrcweir
748cdf0e10cSrcweir sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
749cdf0e10cSrcweir OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
750cdf0e10cSrcweir aMsg.Execute();
751cdf0e10cSrcweir return 0L;
752cdf0e10cSrcweir }
753cdf0e10cSrcweir
754cdf0e10cSrcweir // -----------------------------------------------------------------------
IMPL_LINK(OJDBCConnectionPageSetup,OnEditModified,Edit *,_pEdit)755cdf0e10cSrcweir IMPL_LINK(OJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
756cdf0e10cSrcweir {
757cdf0e10cSrcweir if ( _pEdit == &m_aETDriverClass )
758cdf0e10cSrcweir m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
759cdf0e10cSrcweir SetRoadmapStateValue(checkTestConnection());
760cdf0e10cSrcweir // tell the listener we were modified
761cdf0e10cSrcweir callModifiedHdl();
762cdf0e10cSrcweir return 0L;
763cdf0e10cSrcweir }
764cdf0e10cSrcweir
765cdf0e10cSrcweir
CreateSpreadSheetTabPage(Window * pParent,const SfxItemSet & _rAttrSet)766cdf0e10cSrcweir OGenericAdministrationPage* OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
767cdf0e10cSrcweir {
768cdf0e10cSrcweir return ( new OSpreadSheetConnectionPageSetup( pParent, _rAttrSet ) );
769cdf0e10cSrcweir }
770cdf0e10cSrcweir
DBG_NAME(OSpreadSheetConnectionPageSetup)771cdf0e10cSrcweir DBG_NAME(OSpreadSheetConnectionPageSetup)
772cdf0e10cSrcweir
773cdf0e10cSrcweir OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
774cdf0e10cSrcweir :OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_SPREADSHEET, _rCoreAttrs, STR_SPREADSHEET_HELPTEXT, STR_SPREADSHEET_HEADERTEXT, STR_SPREADSHEETPATH)
775cdf0e10cSrcweir , m_aCBPasswordrequired(this, ModuleRes(CB_SPREADSHEETPASSWORDREQUIRED))
776cdf0e10cSrcweir {
777cdf0e10cSrcweir DBG_CTOR(OSpreadSheetConnectionPageSetup,NULL);
778cdf0e10cSrcweir
779cdf0e10cSrcweir m_aCBPasswordrequired.SetToggleHdl(getControlModifiedLink());
780cdf0e10cSrcweir FreeResource();
781cdf0e10cSrcweir }
782cdf0e10cSrcweir
783cdf0e10cSrcweir
784cdf0e10cSrcweir // -----------------------------------------------------------------------
~OSpreadSheetConnectionPageSetup()785cdf0e10cSrcweir OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup()
786cdf0e10cSrcweir {
787cdf0e10cSrcweir
788cdf0e10cSrcweir DBG_DTOR(OSpreadSheetConnectionPageSetup,NULL);
789cdf0e10cSrcweir }
790cdf0e10cSrcweir
791cdf0e10cSrcweir
fillWindows(::std::vector<ISaveValueWrapper * > &)792cdf0e10cSrcweir void OSpreadSheetConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
793cdf0e10cSrcweir {
794cdf0e10cSrcweir }
795cdf0e10cSrcweir
796cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)797cdf0e10cSrcweir void OSpreadSheetConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
798cdf0e10cSrcweir {
799cdf0e10cSrcweir OConnectionTabPageSetup::fillControls(_rControlList);
800cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBPasswordrequired));
801cdf0e10cSrcweir
802cdf0e10cSrcweir }
803cdf0e10cSrcweir
804cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool _bSaveValue)805cdf0e10cSrcweir void OSpreadSheetConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
806cdf0e10cSrcweir {
807cdf0e10cSrcweir OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
808cdf0e10cSrcweir }
809cdf0e10cSrcweir
810cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)811cdf0e10cSrcweir sal_Bool OSpreadSheetConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
812cdf0e10cSrcweir {
813cdf0e10cSrcweir sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
814cdf0e10cSrcweir fillBool(_rSet,&m_aCBPasswordrequired,DSID_PASSWORDREQUIRED,bChangedSomething);
815cdf0e10cSrcweir return bChangedSomething;
816cdf0e10cSrcweir }
817cdf0e10cSrcweir
CreateAuthentificationTabPage(Window * pParent,const SfxItemSet & _rAttrSet)818cdf0e10cSrcweir OGenericAdministrationPage* OAuthentificationPageSetup::CreateAuthentificationTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
819cdf0e10cSrcweir {
820cdf0e10cSrcweir return ( new OAuthentificationPageSetup( pParent, _rAttrSet) );
821cdf0e10cSrcweir }
822cdf0e10cSrcweir
DBG_NAME(OAuthentificationPageSetup)823cdf0e10cSrcweir DBG_NAME(OAuthentificationPageSetup)
824cdf0e10cSrcweir
825cdf0e10cSrcweir OAuthentificationPageSetup::OAuthentificationPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
826cdf0e10cSrcweir :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_AUTHENTIFICATION), _rCoreAttrs )
827cdf0e10cSrcweir , m_aFTHelpText (this, ModuleRes(FT_AUTHENTIFICATIONHELPTEXT))
828cdf0e10cSrcweir , m_aFTHeaderText (this, ModuleRes(FT_AUTHENTIFICATIONHEADERTEXT))
829cdf0e10cSrcweir , m_aFTUserName (this, ModuleRes(FT_GENERALUSERNAME))
830cdf0e10cSrcweir , m_aETUserName (this, ModuleRes(ET_GENERALUSERNAME))
831cdf0e10cSrcweir , m_aCBPasswordRequired (this, ModuleRes(CB_GENERALPASSWORDREQUIRED))
832cdf0e10cSrcweir , m_aPBTestConnection (this, ModuleRes(PB_TESTCONNECTION))
833cdf0e10cSrcweir {
834cdf0e10cSrcweir DBG_CTOR(OAuthentificationPageSetup,NULL);
835cdf0e10cSrcweir
836cdf0e10cSrcweir SetControlFontWeight(&m_aFTHeaderText);
837cdf0e10cSrcweir m_aETUserName.SetModifyHdl(getControlModifiedLink());
838cdf0e10cSrcweir m_aCBPasswordRequired.SetClickHdl(getControlModifiedLink());
839cdf0e10cSrcweir m_aPBTestConnection.SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
840cdf0e10cSrcweir FreeResource();
841cdf0e10cSrcweir
842cdf0e10cSrcweir LayoutHelper::fitSizeRightAligned( m_aPBTestConnection );
843cdf0e10cSrcweir }
844cdf0e10cSrcweir
845cdf0e10cSrcweir
846cdf0e10cSrcweir // -----------------------------------------------------------------------
~OAuthentificationPageSetup()847cdf0e10cSrcweir OAuthentificationPageSetup::~OAuthentificationPageSetup()
848cdf0e10cSrcweir {
849cdf0e10cSrcweir
850cdf0e10cSrcweir DBG_DTOR(OAuthentificationPageSetup,NULL);
851cdf0e10cSrcweir }
852cdf0e10cSrcweir
853cdf0e10cSrcweir
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)854cdf0e10cSrcweir void OAuthentificationPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
855cdf0e10cSrcweir {
856cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
857cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTUserName));
858cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<PushButton>(&m_aPBTestConnection));
859cdf0e10cSrcweir }
860cdf0e10cSrcweir
861cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)862cdf0e10cSrcweir void OAuthentificationPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
863cdf0e10cSrcweir {
864cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETUserName));
865cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBPasswordRequired));
866cdf0e10cSrcweir }
867cdf0e10cSrcweir
868cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet & _rSet,sal_Bool)869cdf0e10cSrcweir void OAuthentificationPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
870cdf0e10cSrcweir {
871cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
872cdf0e10cSrcweir sal_Bool bValid, bReadonly;
873cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly);
874cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
875cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
876cdf0e10cSrcweir
877cdf0e10cSrcweir m_aETUserName.SetText(pUidItem->GetValue());
878cdf0e10cSrcweir m_aCBPasswordRequired.Check(pAllowEmptyPwd->GetValue());
879cdf0e10cSrcweir
880cdf0e10cSrcweir m_aETUserName.ClearModifyFlag();
881cdf0e10cSrcweir }
882cdf0e10cSrcweir
883cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & _rSet)884cdf0e10cSrcweir sal_Bool OAuthentificationPageSetup::FillItemSet( SfxItemSet& _rSet )
885cdf0e10cSrcweir {
886cdf0e10cSrcweir sal_Bool bChangedSomething = sal_False;
887cdf0e10cSrcweir
888cdf0e10cSrcweir if (m_aETUserName.GetText() != m_aETUserName.GetSavedValue())
889cdf0e10cSrcweir {
890cdf0e10cSrcweir _rSet.Put(SfxStringItem(DSID_USER, m_aETUserName.GetText()));
891cdf0e10cSrcweir _rSet.Put(SfxStringItem(DSID_PASSWORD, String()));
892cdf0e10cSrcweir bChangedSomething = sal_True;
893cdf0e10cSrcweir }
894cdf0e10cSrcweir fillBool(_rSet,&m_aCBPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
895cdf0e10cSrcweir return bChangedSomething;
896cdf0e10cSrcweir }
897cdf0e10cSrcweir
898cdf0e10cSrcweir
CreateFinalDBTabPageSetup(Window * pParent,const SfxItemSet & _rAttrSet)899cdf0e10cSrcweir OGenericAdministrationPage* OFinalDBPageSetup::CreateFinalDBTabPageSetup( Window* pParent, const SfxItemSet& _rAttrSet)
900cdf0e10cSrcweir {
901cdf0e10cSrcweir return ( new OFinalDBPageSetup( pParent, _rAttrSet) );
902cdf0e10cSrcweir }
903cdf0e10cSrcweir
DBG_NAME(OFinalDBPageSetup)904cdf0e10cSrcweir DBG_NAME(OFinalDBPageSetup)
905cdf0e10cSrcweir
906cdf0e10cSrcweir OFinalDBPageSetup::OFinalDBPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
907cdf0e10cSrcweir :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_FINAL), _rCoreAttrs )
908cdf0e10cSrcweir , m_aFTFinalHeader (this, ModuleRes(FT_FINALHEADER))
909cdf0e10cSrcweir , m_aFTFinalHelpText (this, ModuleRes(FT_FINALHELPTEXT))
910cdf0e10cSrcweir , m_aRBRegisterDataSource (this, ModuleRes(RB_REGISTERDATASOURCE))
911cdf0e10cSrcweir , m_aRBDontregisterDataSource (this, ModuleRes(RB_DONTREGISTERDATASOURCE))
912cdf0e10cSrcweir , m_aFTAdditionalSettings (this, ModuleRes(FT_ADDITIONALSETTINGS))
913cdf0e10cSrcweir , m_aCBOpenAfterwards (this, ModuleRes(CB_OPENAFTERWARDS))
914cdf0e10cSrcweir , m_aCBStartTableWizard (this, ModuleRes(CB_STARTTABLEWIZARD))
915cdf0e10cSrcweir , m_aFTFinalText (this, ModuleRes(FT_FINALTEXT))
916cdf0e10cSrcweir {
917cdf0e10cSrcweir DBG_CTOR(OFinalDBPageSetup,NULL);
918cdf0e10cSrcweir
919cdf0e10cSrcweir String stext = m_aFTFinalHeader.GetText();
920cdf0e10cSrcweir SetControlFontWeight(&m_aFTFinalHeader);
921cdf0e10cSrcweir m_aCBOpenAfterwards.SetClickHdl(LINK(this, OFinalDBPageSetup, OnOpenSelected));
922cdf0e10cSrcweir m_aCBStartTableWizard.SetClickHdl(getControlModifiedLink());
923cdf0e10cSrcweir m_aRBRegisterDataSource.SetState(sal_True);
924cdf0e10cSrcweir FreeResource();
925cdf0e10cSrcweir
926cdf0e10cSrcweir sal_Int32 nUnrelatedHeight = LogicToPixel( Size( 0, UNRELATED_CONTROLS ), MAP_APPFONT ).Height();
927cdf0e10cSrcweir sal_Int32 nRelatedHeight = LogicToPixel( Size( 0, RELATED_CONTROLS ), MAP_APPFONT ).Height();
928cdf0e10cSrcweir
929cdf0e10cSrcweir ::std::pair<Window*,sal_Int32> pWindows[] = {
930cdf0e10cSrcweir ::std::pair<Window*,sal_Int32>(&m_aFTFinalHelpText,nRelatedHeight)
931cdf0e10cSrcweir ,::std::pair<Window*,sal_Int32>(&m_aRBRegisterDataSource,nRelatedHeight)
932cdf0e10cSrcweir ,::std::pair<Window*,sal_Int32>(&m_aRBDontregisterDataSource,nUnrelatedHeight)
933cdf0e10cSrcweir ,::std::pair<Window*,sal_Int32>(&m_aFTAdditionalSettings,nRelatedHeight)
934cdf0e10cSrcweir ,::std::pair<Window*,sal_Int32>(&m_aCBOpenAfterwards,nRelatedHeight)
935cdf0e10cSrcweir ,::std::pair<Window*,sal_Int32>(&m_aCBStartTableWizard,nUnrelatedHeight)
936cdf0e10cSrcweir ,::std::pair<Window*,sal_Int32>(&m_aFTFinalText,nUnrelatedHeight)
937cdf0e10cSrcweir };
938cdf0e10cSrcweir
939cdf0e10cSrcweir Point aPos(m_aFTFinalHeader.GetPosPixel());
940cdf0e10cSrcweir Size aStart(m_aFTFinalHeader.GetSizePixel());
941cdf0e10cSrcweir aPos.Y() += aStart.Height() + nUnrelatedHeight;
942cdf0e10cSrcweir sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
943cdf0e10cSrcweir for (sal_Int32 i=0; i < nCount; ++i)
944cdf0e10cSrcweir {
945cdf0e10cSrcweir aPos.X() = pWindows[i].first->GetPosPixel().X();
946cdf0e10cSrcweir Size aSize = pWindows[i].first->GetSizePixel();
947cdf0e10cSrcweir FixedText* pText = dynamic_cast<FixedText*>(pWindows[i].first);
948cdf0e10cSrcweir if ( pText )
949cdf0e10cSrcweir aSize = pText->CalcMinimumSize(aSize.Width());
950cdf0e10cSrcweir pWindows[i].first->SetPosSizePixel(aPos,aSize);
951cdf0e10cSrcweir aPos.Y() += aSize.Height() + pWindows[i].second;
952cdf0e10cSrcweir }
953cdf0e10cSrcweir }
954cdf0e10cSrcweir
955cdf0e10cSrcweir
956cdf0e10cSrcweir // -----------------------------------------------------------------------
~OFinalDBPageSetup()957cdf0e10cSrcweir OFinalDBPageSetup::~OFinalDBPageSetup()
958cdf0e10cSrcweir {
959cdf0e10cSrcweir
960cdf0e10cSrcweir DBG_DTOR(OFinalDBPageSetup,NULL);
961cdf0e10cSrcweir }
962cdf0e10cSrcweir
IsDatabaseDocumentToBeRegistered()963cdf0e10cSrcweir sal_Bool OFinalDBPageSetup::IsDatabaseDocumentToBeRegistered()
964cdf0e10cSrcweir {
965cdf0e10cSrcweir return m_aRBRegisterDataSource.IsChecked() && m_aRBRegisterDataSource.IsEnabled();
966cdf0e10cSrcweir }
967cdf0e10cSrcweir
IsDatabaseDocumentToBeOpened()968cdf0e10cSrcweir sal_Bool OFinalDBPageSetup::IsDatabaseDocumentToBeOpened()
969cdf0e10cSrcweir {
970cdf0e10cSrcweir return m_aCBOpenAfterwards.IsChecked() && m_aCBOpenAfterwards.IsEnabled();
971cdf0e10cSrcweir }
972cdf0e10cSrcweir
IsTableWizardToBeStarted()973cdf0e10cSrcweir sal_Bool OFinalDBPageSetup::IsTableWizardToBeStarted()
974cdf0e10cSrcweir {
975cdf0e10cSrcweir return m_aCBStartTableWizard.IsChecked() && m_aCBStartTableWizard.IsEnabled();
976cdf0e10cSrcweir }
977cdf0e10cSrcweir
978cdf0e10cSrcweir
fillWindows(::std::vector<ISaveValueWrapper * > & _rControlList)979cdf0e10cSrcweir void OFinalDBPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
980cdf0e10cSrcweir {
981cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalHeader));
982cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalHelpText));
983cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTAdditionalSettings));
984cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalText));
985cdf0e10cSrcweir }
986cdf0e10cSrcweir
987cdf0e10cSrcweir // -----------------------------------------------------------------------
fillControls(::std::vector<ISaveValueWrapper * > & _rControlList)988cdf0e10cSrcweir void OFinalDBPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
989cdf0e10cSrcweir {
990cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBOpenAfterwards));
991cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBStartTableWizard));
992cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<RadioButton>(&m_aRBRegisterDataSource));
993cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<RadioButton>(&m_aRBDontregisterDataSource));
994cdf0e10cSrcweir }
995cdf0e10cSrcweir
996cdf0e10cSrcweir // -----------------------------------------------------------------------
implInitControls(const SfxItemSet &,sal_Bool)997cdf0e10cSrcweir void OFinalDBPageSetup::implInitControls(const SfxItemSet& /*_rSet*/, sal_Bool /*_bSaveValue*/)
998cdf0e10cSrcweir {
999cdf0e10cSrcweir m_aCBOpenAfterwards.Check();
1000cdf0e10cSrcweir }
1001cdf0e10cSrcweir
enableTableWizardCheckBox(sal_Bool _bSupportsTableCreation)1002cdf0e10cSrcweir void OFinalDBPageSetup::enableTableWizardCheckBox( sal_Bool _bSupportsTableCreation)
1003cdf0e10cSrcweir {
1004cdf0e10cSrcweir m_aCBStartTableWizard.Enable(_bSupportsTableCreation);
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir
1007cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet &)1008cdf0e10cSrcweir sal_Bool OFinalDBPageSetup::FillItemSet( SfxItemSet& /*_rSet*/ )
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir return sal_True;
1011cdf0e10cSrcweir }
1012cdf0e10cSrcweir // -----------------------------------------------------------------------------
IMPL_LINK(OFinalDBPageSetup,OnOpenSelected,CheckBox *,_pBox)1013cdf0e10cSrcweir IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, CheckBox*, _pBox)
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir m_aCBStartTableWizard.Enable( _pBox->IsEnabled() && _pBox->IsChecked() );
1016cdf0e10cSrcweir callModifiedHdl();
1017cdf0e10cSrcweir // outta here
1018cdf0e10cSrcweir return 0L;
1019cdf0e10cSrcweir }
1020cdf0e10cSrcweir //.........................................................................
1021cdf0e10cSrcweir }
1022cdf0e10cSrcweir // namespace dbaui
1023cdf0e10cSrcweir //.........................................................................
1024