Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : :
21 : : #include "detailpages.hxx"
22 : : #include "sqlmessage.hxx"
23 : : #include "dsmeta.hxx"
24 : : #include "advancedsettings.hxx"
25 : : #include "DbAdminImpl.hxx"
26 : : #include "dsitems.hxx"
27 : : #include "dbfindex.hxx"
28 : : #include "localresaccess.hxx"
29 : : #include "dsnItem.hxx"
30 : :
31 : : #include "dbaccess_helpid.hrc"
32 : : #include "dbu_dlg.hrc"
33 : : #include "dbadmin.hrc"
34 : :
35 : : #include <svl/itemset.hxx>
36 : : #include <svl/stritem.hxx>
37 : : #include <svl/eitem.hxx>
38 : : #include <svl/intitem.hxx>
39 : : #include <vcl/msgbox.hxx>
40 : : #include <vcl/mnemonic.hxx>
41 : : #include <svl/cjkoptions.hxx>
42 : : #include <jvmaccess/virtualmachine.hxx>
43 : : #include <connectivity/CommonTools.hxx>
44 : : #include "DriverSettings.hxx"
45 : : #include "dbadmin.hxx"
46 : : #include <comphelper/types.hxx>
47 : : #include "AutoControls.hrc"
48 : :
49 : : //.........................................................................
50 : : namespace dbaui
51 : : {
52 : : //.........................................................................
53 : :
54 : : using namespace ::com::sun::star::uno;
55 : : using namespace ::com::sun::star::sdbc;
56 : : using namespace ::com::sun::star::beans;
57 : : using namespace ::com::sun::star::lang;
58 : : using namespace ::com::sun::star::container;
59 : : using namespace ::dbtools;
60 : :
61 : : //========================================================================
62 : : //= OCommonBehaviourTabPage
63 : : //========================================================================
64 : : DBG_NAME(OCommonBehaviourTabPage)
65 : : //------------------------------------------------------------------------
66 : 0 : OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nResId, const SfxItemSet& _rCoreAttrs,
67 : : sal_uInt32 nControlFlags,bool _bFreeResource)
68 : :
69 : : :OGenericAdministrationPage(pParent, ModuleRes(nResId), _rCoreAttrs)
70 : : ,m_pOptionsLabel(NULL)
71 : : ,m_pOptions(NULL)
72 : : ,m_pDataConvertFixedLine(NULL)
73 : : ,m_pCharsetLabel(NULL)
74 : : ,m_pCharset(NULL)
75 : : ,m_pAutoFixedLine(NULL)
76 : : ,m_pAutoRetrievingEnabled(NULL)
77 : : ,m_pAutoIncrementLabel(NULL)
78 : : ,m_pAutoIncrement(NULL)
79 : : ,m_pAutoRetrievingLabel(NULL)
80 : : ,m_pAutoRetrieving(NULL)
81 [ # # ]: 0 : ,m_nControlFlags(nControlFlags)
82 : : {
83 : : DBG_CTOR(OCommonBehaviourTabPage,NULL);
84 : :
85 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
86 : : {
87 [ # # ][ # # ]: 0 : m_pOptionsLabel = new FixedText(this, ModuleRes(FT_OPTIONS));
[ # # ]
88 [ # # ][ # # ]: 0 : m_pOptions = new Edit(this, ModuleRes(ET_OPTIONS));
[ # # ]
89 [ # # ][ # # ]: 0 : m_pOptions->SetModifyHdl(getControlModifiedLink());
90 : : }
91 : :
92 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
93 : : {
94 [ # # ][ # # ]: 0 : m_pDataConvertFixedLine = new FixedLine(this, ModuleRes(FL_DATACONVERT));
[ # # ]
95 [ # # ][ # # ]: 0 : m_pCharsetLabel = new FixedText(this, ModuleRes(FT_CHARSET));
[ # # ]
96 [ # # ][ # # ]: 0 : m_pCharset = new CharSetListBox(this, ModuleRes(LB_CHARSET));
[ # # ]
97 [ # # ]: 0 : m_pCharset->SetSelectHdl(getControlModifiedLink());
98 : : }
99 : :
100 : : Window* pWindows[] = { m_pAutoRetrievingEnabled, m_pAutoFixedLine,
101 : : m_pAutoIncrementLabel, m_pAutoIncrement,
102 : 0 : m_pAutoRetrievingLabel, m_pAutoRetrieving };
103 : :
104 : 0 : sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
105 [ # # ]: 0 : for (sal_Int32 i=1; i < nCount; ++i)
106 : : {
107 [ # # ]: 0 : if ( pWindows[i] )
108 : : {
109 : 0 : Window* pPrev = pWindows[i-1];
110 [ # # ][ # # ]: 0 : for (sal_Int32 j = i-1; pPrev == NULL && j >= 0 ; --j)
[ # # ]
111 : : {
112 : 0 : pPrev = pWindows[j];
113 : : }
114 [ # # ]: 0 : if ( pPrev )
115 [ # # ]: 0 : pWindows[i]->SetZOrder(pPrev, WINDOW_ZORDER_BEHIND);
116 : : }
117 : : }
118 : :
119 [ # # ]: 0 : if ( _bFreeResource )
120 [ # # ]: 0 : FreeResource();
121 : 0 : }
122 : :
123 : : // -----------------------------------------------------------------------
124 : 0 : OCommonBehaviourTabPage::~OCommonBehaviourTabPage()
125 : : {
126 [ # # ][ # # ]: 0 : DELETEZ(m_pOptionsLabel);
127 [ # # ][ # # ]: 0 : DELETEZ(m_pOptions);
128 : :
129 [ # # ][ # # ]: 0 : DELETEZ(m_pDataConvertFixedLine);
130 [ # # ][ # # ]: 0 : DELETEZ(m_pCharsetLabel);
131 [ # # ][ # # ]: 0 : DELETEZ(m_pCharset);
132 : :
133 [ # # ][ # # ]: 0 : DELETEZ(m_pAutoFixedLine);
134 [ # # ][ # # ]: 0 : DELETEZ(m_pAutoIncrementLabel);
135 [ # # ][ # # ]: 0 : DELETEZ(m_pAutoIncrement);
136 : :
137 [ # # ][ # # ]: 0 : DELETEZ(m_pAutoRetrievingEnabled);
138 [ # # ][ # # ]: 0 : DELETEZ(m_pAutoRetrievingLabel);
139 [ # # ][ # # ]: 0 : DELETEZ(m_pAutoRetrieving);
140 : :
141 : : DBG_DTOR(OCommonBehaviourTabPage,NULL);
142 [ # # ]: 0 : }
143 : :
144 : : // -----------------------------------------------------------------------
145 : 0 : void OCommonBehaviourTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
146 : : {
147 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
148 : : {
149 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pOptionsLabel));
150 : : }
151 : :
152 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
153 : : {
154 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(m_pDataConvertFixedLine));
155 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pCharsetLabel));
156 : : }
157 : 0 : }
158 : : // -----------------------------------------------------------------------
159 : 0 : void OCommonBehaviourTabPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
160 : : {
161 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
162 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pOptions));
163 : :
164 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
165 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<ListBox>(m_pCharset));
166 : 0 : }
167 : :
168 : : // -----------------------------------------------------------------------
169 : 0 : void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
170 : : {
171 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
172 : : sal_Bool bValid, bReadonly;
173 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
174 : :
175 : : // collect the items
176 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pOptionsItem, SfxStringItem, DSID_ADDITIONALOPTIONS, sal_True);
177 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pCharsetItem, SfxStringItem, DSID_CHARSET, sal_True);
178 : :
179 : : // forward the values to the controls
180 [ # # ]: 0 : if (bValid)
181 : : {
182 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
183 : : {
184 [ # # ]: 0 : m_pOptions->SetText(pOptionsItem->GetValue());
185 [ # # ]: 0 : m_pOptions->ClearModifyFlag();
186 : : }
187 : :
188 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
189 : : {
190 [ # # ]: 0 : m_pCharset->SelectEntryByIanaName( pCharsetItem->GetValue() );
191 : : }
192 : : }
193 [ # # ]: 0 : OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
194 : 0 : }
195 : : // -----------------------------------------------------------------------
196 : 0 : sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet)
197 : : {
198 : 0 : sal_Bool bChangedSomething = sal_False;
199 : :
200 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
201 : : {
202 [ # # ]: 0 : fillString(_rSet,m_pOptions,DSID_ADDITIONALOPTIONS,bChangedSomething);
203 : : }
204 : :
205 [ # # ]: 0 : if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
206 : : {
207 [ # # ][ # # ]: 0 : if ( m_pCharset->StoreSelectedCharSet( _rSet, DSID_CHARSET ) )
208 : 0 : bChangedSomething = sal_True;
209 : : }
210 : :
211 : 0 : return bChangedSomething;
212 : : }
213 : :
214 : : //========================================================================
215 : : //= ODbaseDetailsPage
216 : : //========================================================================
217 : : DBG_NAME(ODbaseDetailsPage)
218 : : //------------------------------------------------------------------------
219 : 0 : ODbaseDetailsPage::ODbaseDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
220 : : :OCommonBehaviourTabPage(pParent, PAGE_DBASE, _rCoreAttrs, CBTP_USE_CHARSET ,false)
221 : : ,m_aShowDeleted (this, ModuleRes(CB_SHOWDELETEDROWS))
222 : : ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
223 : : ,m_aFT_Message (this, ModuleRes( FT_SPECIAL_MESSAGE) )
224 [ # # ][ # # ]: 0 : ,m_aIndexes (this, ModuleRes(PB_INDICIES))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
225 : : {
226 : : DBG_CTOR(ODbaseDetailsPage,NULL);
227 : :
228 [ # # ]: 0 : m_aIndexes.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
229 [ # # ]: 0 : m_aShowDeleted.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
230 : :
231 : : // correct the z-order which is mixed-up because the base class constructed some controls before we did
232 [ # # ]: 0 : m_pCharset->SetZOrder(&m_aShowDeleted, WINDOW_ZORDER_BEFOR);
233 : :
234 [ # # ]: 0 : FreeResource();
235 : 0 : }
236 : :
237 : : // -----------------------------------------------------------------------
238 [ # # ][ # # ]: 0 : ODbaseDetailsPage::~ODbaseDetailsPage()
[ # # ][ # # ]
[ # # ]
239 : : {
240 : :
241 : : DBG_DTOR(ODbaseDetailsPage,NULL);
242 [ # # ]: 0 : }
243 : :
244 : : // -----------------------------------------------------------------------
245 : 0 : SfxTabPage* ODriversSettings::CreateDbase( Window* pParent, const SfxItemSet& _rAttrSet )
246 : : {
247 [ # # ]: 0 : return ( new ODbaseDetailsPage( pParent, _rAttrSet ) );
248 : : }
249 : :
250 : : // -----------------------------------------------------------------------
251 : 0 : void ODbaseDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
252 : : {
253 : 0 : OCommonBehaviourTabPage::fillControls(_rControlList);
254 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aShowDeleted));
255 : 0 : }
256 : : // -----------------------------------------------------------------------
257 : 0 : void ODbaseDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
258 : : {
259 : 0 : OCommonBehaviourTabPage::fillWindows(_rControlList);
260 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
261 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFT_Message));
262 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<PushButton>(&m_aIndexes));
263 : 0 : }
264 : : // -----------------------------------------------------------------------
265 : 0 : void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
266 : : {
267 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
268 : : sal_Bool bValid, bReadonly;
269 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
270 : :
271 : : // get the DSN string (needed for the index dialog)
272 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
273 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
274 [ # # ]: 0 : ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
275 [ # # ][ # # ]: 0 : if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len())
[ # # ][ # # ]
276 [ # # ][ # # ]: 0 : m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
[ # # ][ # # ]
277 : :
278 : : // get the other relevant items
279 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pDeletedItem, SfxBoolItem, DSID_SHOWDELETEDROWS, sal_True);
280 : :
281 [ # # ]: 0 : if ( bValid )
282 : : {
283 [ # # ]: 0 : m_aShowDeleted.Check( pDeletedItem->GetValue() );
284 [ # # ][ # # ]: 0 : m_aFT_Message.Show(m_aShowDeleted.IsChecked());
285 : : }
286 : :
287 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
288 : 0 : }
289 : :
290 : : // -----------------------------------------------------------------------
291 : 0 : sal_Bool ODbaseDetailsPage::FillItemSet( SfxItemSet& _rSet )
292 : : {
293 [ # # ]: 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
294 : :
295 [ # # ]: 0 : fillBool(_rSet,&m_aShowDeleted,DSID_SHOWDELETEDROWS,bChangedSomething);
296 : 0 : return bChangedSomething;
297 : : }
298 : :
299 : : //------------------------------------------------------------------------
300 : 0 : IMPL_LINK( ODbaseDetailsPage, OnButtonClicked, Button*, pButton )
301 : : {
302 [ # # ]: 0 : if (&m_aIndexes == pButton)
303 : : {
304 [ # # ][ # # ]: 0 : ODbaseIndexDialog aIndexDialog(this, m_sDsn);
[ # # ]
305 [ # # ][ # # ]: 0 : aIndexDialog.Execute();
306 : : }
307 : : else
308 : : {
309 : 0 : m_aFT_Message.Show(m_aShowDeleted.IsChecked());
310 : : // it was one of the checkboxes -> we count as modified from now on
311 : 0 : callModifiedHdl();
312 : : }
313 : :
314 : 0 : return 0;
315 : : }
316 : :
317 : : //========================================================================
318 : : //= OAdoDetailsPage
319 : : //========================================================================
320 : : DBG_NAME(OAdoDetailsPage)
321 : : // -----------------------------------------------------------------------
322 : 0 : OAdoDetailsPage::OAdoDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
323 : 0 : :OCommonBehaviourTabPage(pParent, PAGE_ADO, _rCoreAttrs, CBTP_USE_CHARSET )
324 : : {
325 : : DBG_CTOR(OAdoDetailsPage,NULL);
326 : :
327 : 0 : }
328 : :
329 : : // -----------------------------------------------------------------------
330 : 0 : OAdoDetailsPage::~OAdoDetailsPage()
331 : : {
332 : :
333 : : DBG_DTOR(OAdoDetailsPage,NULL);
334 [ # # ]: 0 : }
335 : : // -----------------------------------------------------------------------
336 : 0 : SfxTabPage* ODriversSettings::CreateAdo( Window* pParent, const SfxItemSet& _rAttrSet )
337 : : {
338 [ # # ]: 0 : return ( new OAdoDetailsPage( pParent, _rAttrSet ) );
339 : : }
340 : :
341 : : // -----------------------------------------------------------------------
342 : : //========================================================================
343 : : //= OOdbcDetailsPage
344 : : //========================================================================
345 : 0 : OOdbcDetailsPage::OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
346 : : :OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_CHARSET | CBTP_USE_OPTIONS,false)
347 : : ,m_aFL_1 (this, ModuleRes(FL_SEPARATOR1))
348 [ # # ][ # # ]: 0 : ,m_aUseCatalog (this, ModuleRes(CB_USECATALOG))
[ # # ][ # # ]
349 : : {
350 [ # # ]: 0 : m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
351 [ # # ]: 0 : FreeResource();
352 : :
353 : : Window* pWindows[] = { m_pCharsetLabel, m_pCharset
354 : : ,m_pOptionsLabel,m_pOptions,&m_aUseCatalog
355 : 0 : };
356 : :
357 : 0 : sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
358 [ # # ]: 0 : for (sal_Int32 i=1; i < nCount; ++i)
359 [ # # ]: 0 : pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
360 : 0 : }
361 : :
362 : : // -----------------------------------------------------------------------
363 : 0 : SfxTabPage* ODriversSettings::CreateODBC( Window* pParent, const SfxItemSet& _rAttrSet )
364 : : {
365 [ # # ]: 0 : return ( new OOdbcDetailsPage( pParent, _rAttrSet ) );
366 : : }
367 : :
368 : : // -----------------------------------------------------------------------
369 : 0 : sal_Bool OOdbcDetailsPage::FillItemSet( SfxItemSet& _rSet )
370 : : {
371 [ # # ]: 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
372 [ # # ]: 0 : fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
373 : 0 : return bChangedSomething;
374 : : }
375 : : // -----------------------------------------------------------------------
376 : 0 : void OOdbcDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
377 : : {
378 : 0 : OCommonBehaviourTabPage::fillControls(_rControlList);
379 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
380 : 0 : }
381 : : // -----------------------------------------------------------------------
382 : 0 : void OOdbcDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
383 : : {
384 : 0 : OCommonBehaviourTabPage::fillWindows(_rControlList);
385 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
386 : 0 : }
387 : : // -----------------------------------------------------------------------
388 : 0 : void OOdbcDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
389 : : {
390 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
391 : : sal_Bool bValid, bReadonly;
392 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
393 : :
394 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
395 : :
396 [ # # ]: 0 : if ( bValid )
397 [ # # ]: 0 : m_aUseCatalog.Check(pUseCatalogItem->GetValue());
398 : :
399 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
400 : 0 : }
401 : : //========================================================================
402 : : //= OOdbcDetailsPage
403 : : //========================================================================
404 : 0 : OUserDriverDetailsPage::OUserDriverDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
405 : : :OCommonBehaviourTabPage(pParent, PAGE_USERDRIVER, _rCoreAttrs,
406 : : CBTP_USE_CHARSET | CBTP_USE_OPTIONS ,false)
407 : : ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
408 : : ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
409 : : ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
410 : : ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
411 [ # # ][ # # ]: 0 : ,m_aUseCatalog (this, ModuleRes(CB_USECATALOG))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
412 : : {
413 [ # # ]: 0 : m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
414 [ # # ]: 0 : FreeResource();
415 : 0 : }
416 : :
417 : : // -----------------------------------------------------------------------
418 : 0 : SfxTabPage* ODriversSettings::CreateUser( Window* pParent, const SfxItemSet& _rAttrSet )
419 : : {
420 [ # # ]: 0 : return ( new OUserDriverDetailsPage( pParent, _rAttrSet ) );
421 : : }
422 : :
423 : : // -----------------------------------------------------------------------
424 : 0 : sal_Bool OUserDriverDetailsPage::FillItemSet( SfxItemSet& _rSet )
425 : : {
426 [ # # ]: 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
427 : :
428 [ # # ]: 0 : fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_PORTNUMBER,bChangedSomething);
429 [ # # ]: 0 : fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
430 [ # # ]: 0 : fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
431 : :
432 : 0 : return bChangedSomething;
433 : : }
434 : : // -----------------------------------------------------------------------
435 : 0 : void OUserDriverDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
436 : : {
437 : 0 : OCommonBehaviourTabPage::fillControls(_rControlList);
438 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
439 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
440 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
441 : 0 : }
442 : : // -----------------------------------------------------------------------
443 : 0 : void OUserDriverDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
444 : : {
445 : 0 : OCommonBehaviourTabPage::fillWindows(_rControlList);
446 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
447 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
448 : 0 : }
449 : : // -----------------------------------------------------------------------
450 : 0 : void OUserDriverDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
451 : : {
452 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
453 : : sal_Bool bValid, bReadonly;
454 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
455 : :
456 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
457 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
458 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_PORTNUMBER, sal_True);
459 : :
460 [ # # ]: 0 : if ( bValid )
461 : : {
462 [ # # ]: 0 : m_aEDHostname.SetText(pHostName->GetValue());
463 [ # # ]: 0 : m_aEDHostname.ClearModifyFlag();
464 : :
465 [ # # ]: 0 : m_aNFPortNumber.SetValue(pPortNumber->GetValue());
466 [ # # ]: 0 : m_aNFPortNumber.ClearModifyFlag();
467 : :
468 [ # # ]: 0 : m_aUseCatalog.Check(pUseCatalogItem->GetValue());
469 : : }
470 : :
471 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
472 : 0 : }
473 : : //========================================================================
474 : : //= OMySQLODBCDetailsPage
475 : : //========================================================================
476 : 0 : OMySQLODBCDetailsPage::OMySQLODBCDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
477 : 0 : :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_ODBC, _rCoreAttrs, CBTP_USE_CHARSET )
478 : : {
479 : 0 : }
480 : :
481 : : // -----------------------------------------------------------------------
482 : 0 : SfxTabPage* ODriversSettings::CreateMySQLODBC( Window* pParent, const SfxItemSet& _rAttrSet )
483 : : {
484 [ # # ]: 0 : return ( new OMySQLODBCDetailsPage( pParent, _rAttrSet ) );
485 : : }
486 : :
487 : : //========================================================================
488 : : //= OMySQLJDBCDetailsPage
489 : : //========================================================================
490 : 0 : OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,sal_uInt16 _nResId, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId)
491 : : :OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false)
492 : : ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
493 : : ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
494 : : ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
495 : : ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
496 : : ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
497 : : ,m_aFTSocket (this, ModuleRes(FT_SOCKET))
498 : : ,m_aEDSocket (this, ModuleRes(ET_SOCKET))
499 : : ,m_aFTDriverClass (this, ModuleRes(FT_JDBCDRIVERCLASS))
500 : : ,m_aEDDriverClass (this, ModuleRes(ET_JDBCDRIVERCLASS))
501 : : ,m_aTestJavaDriver (this, ModuleRes(PB_TESTDRIVERCLASS))
502 : : ,m_nPortId(_nPortId)
503 [ # # ][ # # ]: 0 : ,m_bUseClass(true)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
504 : : {
505 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
506 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
507 [ # # ]: 0 : ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
508 [ # # ][ # # ]: 0 : if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
[ # # ][ # # ]
509 : : {
510 [ # # ][ # # ]: 0 : m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
[ # # ][ # # ]
511 : : }
512 [ # # ]: 0 : if ( m_sDefaultJdbcDriverName.Len() )
513 : : {
514 [ # # ]: 0 : m_aEDDriverClass.SetModifyHdl(getControlModifiedLink());
515 [ # # ]: 0 : m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified));
516 [ # # ]: 0 : m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
517 : : }
518 : : else
519 : : {
520 : 0 : m_bUseClass = false;
521 [ # # ]: 0 : m_aFTDriverClass.Show(sal_False);
522 [ # # ]: 0 : m_aEDDriverClass.Show(sal_False);
523 [ # # ]: 0 : m_aTestJavaDriver.Show(sal_False);
524 : : }
525 : :
526 [ # # ][ # # ]: 0 : m_aFTSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
[ # # ]
527 [ # # ][ # # ]: 0 : m_aEDSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
[ # # ]
528 : :
529 [ # # ]: 0 : m_aEDHostname.SetModifyHdl(getControlModifiedLink());
530 [ # # ]: 0 : m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
531 [ # # ]: 0 : m_aEDSocket.SetModifyHdl(getControlModifiedLink());
532 : :
533 : : Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname,
534 : : &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
535 : : &m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver,
536 : 0 : m_pCharsetLabel, m_pCharset};
537 : :
538 : 0 : sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
539 [ # # ]: 0 : for (sal_Int32 i=1; i < nCount; ++i)
540 [ # # ]: 0 : pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
541 : :
542 [ # # ]: 0 : FreeResource();
543 : 0 : }
544 : :
545 : : // -----------------------------------------------------------------------
546 : 0 : void OGeneralSpecialJDBCDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
547 : : {
548 : 0 : OCommonBehaviourTabPage::fillControls(_rControlList);
549 [ # # ]: 0 : if ( m_bUseClass )
550 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDDriverClass));
551 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
552 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
553 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket));
554 : 0 : }
555 : : // -----------------------------------------------------------------------
556 : 0 : void OGeneralSpecialJDBCDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
557 : : {
558 : 0 : OCommonBehaviourTabPage::fillWindows(_rControlList);
559 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
560 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
561 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
562 [ # # ]: 0 : if ( m_bUseClass )
563 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
564 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
565 : 0 : }
566 : :
567 : : // -----------------------------------------------------------------------
568 : 0 : sal_Bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet& _rSet )
569 : : {
570 [ # # ]: 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
571 [ # # ]: 0 : if ( m_bUseClass )
572 [ # # ]: 0 : fillString(_rSet,&m_aEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
573 [ # # ]: 0 : fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
574 [ # # ]: 0 : fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething);
575 [ # # ]: 0 : fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
576 : :
577 : 0 : return bChangedSomething;
578 : : }
579 : : // -----------------------------------------------------------------------
580 : 0 : void OGeneralSpecialJDBCDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
581 : : {
582 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
583 : : sal_Bool bValid, bReadonly;
584 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
585 : :
586 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
587 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
588 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
589 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
590 : :
591 [ # # ]: 0 : if ( bValid )
592 : : {
593 [ # # ]: 0 : if ( m_bUseClass )
594 : : {
595 [ # # ]: 0 : m_aEDDriverClass.SetText(pDrvItem->GetValue());
596 [ # # ]: 0 : m_aEDDriverClass.ClearModifyFlag();
597 : : }
598 : :
599 [ # # ]: 0 : m_aEDHostname.SetText(pHostName->GetValue());
600 [ # # ]: 0 : m_aEDHostname.ClearModifyFlag();
601 : :
602 [ # # ]: 0 : m_aNFPortNumber.SetValue(pPortNumber->GetValue());
603 [ # # ]: 0 : m_aNFPortNumber.ClearModifyFlag();
604 : :
605 [ # # ]: 0 : m_aEDSocket.SetText(pSocket->GetValue());
606 [ # # ]: 0 : m_aEDSocket.ClearModifyFlag();
607 : : }
608 : :
609 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
610 : :
611 : : // to get the correcxt value when saveValue was called by base class
612 [ # # ][ # # ]: 0 : if ( m_bUseClass && !m_aEDDriverClass.GetText().Len() )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
613 : : {
614 [ # # ]: 0 : m_aEDDriverClass.SetText(m_sDefaultJdbcDriverName);
615 [ # # ]: 0 : m_aEDDriverClass.SetModifyFlag();
616 : : }
617 : 0 : }
618 : : // -----------------------------------------------------------------------
619 : 0 : IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
620 : : {
621 : : OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
622 : : OSL_ENSURE(m_bUseClass,"Who called me?");
623 : :
624 : 0 : sal_Bool bSuccess = sal_False;
625 : : try
626 : : {
627 [ # # ][ # # ]: 0 : if ( m_aEDDriverClass.GetText().Len() )
[ # # ]
628 : : {
629 : : // TODO chage jvmaccess
630 [ # # ][ # # ]: 0 : ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
631 [ # # ][ # # ]: 0 : bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText());
[ # # ][ # # ]
[ # # ][ # # ]
632 : : }
633 : : }
634 [ # # ]: 0 : catch(Exception&)
635 : : {
636 : : }
637 : :
638 [ # # ]: 0 : const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
639 : 0 : const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
640 [ # # ][ # # ]: 0 : OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String(), WB_OK | WB_DEF_OK, mt );
[ # # ][ # # ]
[ # # ][ # # ]
641 [ # # ]: 0 : aMsg.Execute();
642 [ # # ]: 0 : return 0L;
643 : : }
644 : : // -----------------------------------------------------------------------
645 : 0 : IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnEditModified, Edit*, _pEdit)
646 : : {
647 [ # # ][ # # ]: 0 : if ( m_bUseClass && _pEdit == &m_aEDDriverClass )
648 [ # # ]: 0 : m_aTestJavaDriver.Enable( m_aEDDriverClass.GetText().Len() != 0 );
649 : :
650 : : // tell the listener we were modified
651 : 0 : callModifiedHdl();
652 : 0 : return 0L;
653 : : }
654 : :
655 : : //========================================================================
656 : : //= MySQLNativePage
657 : : //========================================================================
658 : 0 : MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs )
659 : : :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false )
660 : : ,m_aSeparator1 ( this, ModuleRes( FL_SEPARATOR1) )
661 : 0 : ,m_aMySQLSettings ( *this, getControlModifiedLink() )
662 : : ,m_aSeparator2 ( this, ModuleRes(FL_SEPARATOR2))
663 : : ,m_aUserNameLabel ( this, ModuleRes(FT_USERNAME))
664 : : ,m_aUserName ( this, ModuleRes(ET_USERNAME))
665 [ # # ][ # # ]: 0 : ,m_aPasswordRequired ( this, ModuleRes(CB_PASSWORD_REQUIRED))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
666 : : {
667 [ # # ]: 0 : m_aUserName.SetModifyHdl(getControlModifiedLink());
668 : :
669 : : Window* pWindows[] = { &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName,
670 : 0 : &m_aPasswordRequired, m_pCharsetLabel, m_pCharset};
671 : 0 : sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
672 [ # # ]: 0 : for (sal_Int32 i=1; i < nCount; ++i)
673 [ # # ]: 0 : pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
674 : :
675 [ # # ]: 0 : LayoutHelper::positionBelow( m_aSeparator1, m_aMySQLSettings, RelatedControls, 3 );
676 [ # # ]: 0 : m_aMySQLSettings.Show();
677 : :
678 [ # # ]: 0 : FreeResource();
679 : 0 : }
680 : :
681 : : // -----------------------------------------------------------------------
682 : 0 : void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
683 : : {
684 : 0 : OCommonBehaviourTabPage::fillControls( _rControlList );
685 : 0 : m_aMySQLSettings.fillControls( _rControlList );
686 : :
687 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName));
688 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired));
689 : 0 : }
690 : : // -----------------------------------------------------------------------
691 : 0 : void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
692 : : {
693 : 0 : OCommonBehaviourTabPage::fillWindows( _rControlList );
694 : 0 : m_aMySQLSettings.fillWindows( _rControlList);
695 : :
696 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1));
697 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2));
698 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel));
699 : 0 : }
700 : :
701 : : // -----------------------------------------------------------------------
702 : 0 : sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet )
703 : : {
704 [ # # ]: 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet );
705 : :
706 [ # # ]: 0 : bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet );
707 : :
708 [ # # ][ # # ]: 0 : if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() )
[ # # ][ # # ]
709 : : {
710 [ # # ][ # # ]: 0 : _rSet.Put( SfxStringItem( DSID_USER, m_aUserName.GetText() ) );
[ # # ][ # # ]
[ # # ]
711 [ # # ][ # # ]: 0 : _rSet.Put( SfxStringItem( DSID_PASSWORD, String()));
[ # # ][ # # ]
[ # # ]
712 : 0 : bChangedSomething = sal_True;
713 : : }
714 [ # # ]: 0 : fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
715 : :
716 : 0 : return bChangedSomething;
717 : : }
718 : : // -----------------------------------------------------------------------
719 : 0 : void MySQLNativePage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
720 : : {
721 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
722 : : sal_Bool bValid, bReadonly;
723 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
724 : :
725 [ # # ]: 0 : m_aMySQLSettings.implInitControls( _rSet );
726 : :
727 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
728 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
729 : :
730 [ # # ]: 0 : if ( bValid )
731 : : {
732 [ # # ]: 0 : m_aUserName.SetText(pUidItem->GetValue());
733 [ # # ]: 0 : m_aUserName.ClearModifyFlag();
734 [ # # ]: 0 : m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue());
735 : : }
736 : :
737 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
738 : 0 : }
739 : :
740 : : // -----------------------------------------------------------------------
741 : 0 : SfxTabPage* ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
742 : : {
743 [ # # ]: 0 : return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) );
744 : : }
745 : : // -----------------------------------------------------------------------
746 : 0 : SfxTabPage* ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet )
747 : : {
748 [ # # ]: 0 : return ( new MySQLNativePage( pParent, _rAttrSet ) );
749 : : }
750 : :
751 : : // -----------------------------------------------------------------------
752 : 0 : SfxTabPage* ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
753 : : {
754 [ # # ]: 0 : return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) );
755 : : }
756 : :
757 : : //========================================================================
758 : : //= OLDAPDetailsPage
759 : : //========================================================================
760 : 0 : OLDAPDetailsPage::OLDAPDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
761 : : :OCommonBehaviourTabPage(pParent, PAGE_LDAP, _rCoreAttrs,0,false)
762 : : ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
763 : : ,m_aBaseDN (this, ModuleRes(FT_BASEDN))
764 : : ,m_aETBaseDN (this, ModuleRes(ET_BASEDN))
765 : : ,m_aCBUseSSL (this, ModuleRes(CB_USESSL))
766 : : ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
767 : : ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
768 : : ,m_aFTRowCount (this, ModuleRes(FT_LDAPROWCOUNT))
769 [ # # ][ # # ]: 0 : ,m_aNFRowCount (this, ModuleRes(NF_LDAPROWCOUNT))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
770 : : {
771 [ # # ]: 0 : m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
772 [ # # ]: 0 : m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
773 [ # # ]: 0 : m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
774 [ # # ]: 0 : m_aNFRowCount.SetModifyHdl(getControlModifiedLink());
775 : :
776 [ # # ]: 0 : m_aNFRowCount.SetUseThousandSep(sal_False);
777 : 0 : m_iNormalPort = 389;
778 : 0 : m_iSSLPort = 636;
779 [ # # ]: 0 : m_aCBUseSSL.SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick));
780 [ # # ]: 0 : FreeResource();
781 : 0 : }
782 : :
783 : : // -----------------------------------------------------------------------
784 : 0 : SfxTabPage* ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet )
785 : : {
786 [ # # ]: 0 : return ( new OLDAPDetailsPage( pParent, _rAttrSet ) );
787 : : }
788 : :
789 : : // -----------------------------------------------------------------------
790 : 0 : sal_Bool OLDAPDetailsPage::FillItemSet( SfxItemSet& _rSet )
791 : : {
792 [ # # ]: 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
793 : :
794 [ # # ]: 0 : fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN,bChangedSomething);
795 [ # # ]: 0 : fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
796 [ # # ]: 0 : fillInt32(_rSet,&m_aNFRowCount,DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
797 [ # # ]: 0 : fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
798 : 0 : return bChangedSomething;
799 : : }
800 : : //------------------------------------------------------------------------
801 : 0 : IMPL_LINK( OLDAPDetailsPage, OnCheckBoxClick, CheckBox*, pCheckBox )
802 : : {
803 : 0 : callModifiedHdl();
804 [ # # ]: 0 : if ( pCheckBox == &m_aCBUseSSL)
805 : : {
806 [ # # ]: 0 : if ( m_aCBUseSSL.IsChecked() )
807 : : {
808 : 0 : m_iNormalPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
809 : 0 : m_aNFPortNumber.SetValue(m_iSSLPort);
810 : : }
811 : : else
812 : : {
813 : 0 : m_iSSLPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
814 : 0 : m_aNFPortNumber.SetValue(m_iNormalPort);
815 : : }
816 : : }
817 : 0 : return 0;
818 : : }
819 : :
820 : : // -----------------------------------------------------------------------
821 : 0 : void OLDAPDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
822 : : {
823 : 0 : OCommonBehaviourTabPage::fillControls(_rControlList);
824 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
825 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
826 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
827 [ # # ][ # # ]: 0 : _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFRowCount));
828 : 0 : }
829 : : // -----------------------------------------------------------------------
830 : 0 : void OLDAPDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
831 : : {
832 : 0 : OCommonBehaviourTabPage::fillWindows(_rControlList);
833 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aBaseDN));
834 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
835 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTRowCount));
836 [ # # ][ # # ]: 0 : _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
837 : 0 : }
838 : : // -----------------------------------------------------------------------
839 : 0 : void OLDAPDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
840 : : {
841 : : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
842 : : sal_Bool bValid, bReadonly;
843 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
844 : :
845 : :
846 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
847 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pUseSSL, SfxBoolItem, DSID_CONN_LDAP_USESSL, sal_True);
848 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
849 [ # # ][ # # ]: 0 : SFX_ITEMSET_GET(_rSet, pRowCount, SfxInt32Item, DSID_CONN_LDAP_ROWCOUNT, sal_True);
850 : :
851 [ # # ]: 0 : if ( bValid )
852 : : {
853 [ # # ]: 0 : m_aETBaseDN.SetText(pBaseDN->GetValue());
854 [ # # ]: 0 : m_aNFPortNumber.SetValue(pPortNumber->GetValue());
855 [ # # ]: 0 : m_aNFRowCount.SetValue(pRowCount->GetValue());
856 [ # # ]: 0 : m_aCBUseSSL.Check(pUseSSL->GetValue());
857 : : }
858 : :
859 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
860 : 0 : }
861 : :
862 : :
863 : : //========================================================================
864 : : //= OTextDetailsPage
865 : : //========================================================================
866 : : DBG_NAME(OTextDetailsPage)
867 : : //------------------------------------------------------------------------
868 : 0 : OTextDetailsPage::OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
869 [ # # ][ # # ]: 0 : :OCommonBehaviourTabPage(pParent, PAGE_TEXT, _rCoreAttrs, 0, false )
[ # # ]
870 : : {
871 : : DBG_CTOR(OTextDetailsPage,NULL);
872 : :
873 [ # # ][ # # ]: 0 : m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
874 [ # # ]: 0 : FreeResource();
875 : 0 : }
876 : :
877 : : // -----------------------------------------------------------------------
878 [ # # ][ # # ]: 0 : OTextDetailsPage::~OTextDetailsPage()
[ # # ]
879 : : {
880 [ # # ][ # # ]: 0 : DELETEZ(m_pTextConnectionHelper);
881 : :
882 : : DBG_DTOR(OTextDetailsPage,NULL);
883 [ # # ]: 0 : }
884 : :
885 : : // -----------------------------------------------------------------------
886 : 0 : SfxTabPage* ODriversSettings::CreateText( Window* pParent, const SfxItemSet& _rAttrSet )
887 : : {
888 [ # # ]: 0 : return ( new OTextDetailsPage( pParent, _rAttrSet ) );
889 : : }
890 : : // -----------------------------------------------------------------------
891 : 0 : void OTextDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
892 : : {
893 : 0 : OCommonBehaviourTabPage::fillControls(_rControlList);
894 : 0 : m_pTextConnectionHelper->fillControls(_rControlList);
895 : :
896 : 0 : }
897 : : // -----------------------------------------------------------------------
898 : 0 : void OTextDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
899 : : {
900 : 0 : OCommonBehaviourTabPage::fillWindows(_rControlList);
901 : 0 : m_pTextConnectionHelper->fillWindows(_rControlList);
902 : :
903 : 0 : }
904 : : // -----------------------------------------------------------------------
905 : 0 : void OTextDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
906 : : {
907 : : // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
908 : : sal_Bool bValid, bReadonly;
909 [ # # ]: 0 : getFlags(_rSet, bValid, bReadonly);
910 : :
911 [ # # ]: 0 : m_pTextConnectionHelper->implInitControls(_rSet, bValid);
912 [ # # ]: 0 : OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
913 : 0 : }
914 : :
915 : : // -----------------------------------------------------------------------
916 : 0 : sal_Bool OTextDetailsPage::FillItemSet( SfxItemSet& rSet )
917 : : {
918 : 0 : sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(rSet);
919 : 0 : bChangedSomething = m_pTextConnectionHelper->FillItemSet(rSet, bChangedSomething);
920 : 0 : return bChangedSomething;
921 : : }
922 : :
923 : : // -----------------------------------------------------------------------
924 : 0 : sal_Bool OTextDetailsPage::prepareLeave()
925 : : {
926 : 0 : return m_pTextConnectionHelper->prepareLeave();
927 : : }
928 : :
929 : : //------------------------------------------------------------------------
930 : 0 : SfxTabPage* ODriversSettings::CreateGeneratedValuesPage( Window* _pParent, const SfxItemSet& _rAttrSet )
931 : : {
932 [ # # ]: 0 : return new GeneratedValuesPage( _pParent, _rAttrSet );
933 : : }
934 : :
935 : : //------------------------------------------------------------------------
936 : 0 : SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet )
937 : : {
938 [ # # ]: 0 : ::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
939 [ # # ]: 0 : DataSourceMetaData aMetaData( eType );
940 [ # # ][ # # ]: 0 : return new SpecialSettingsPage( _pParent, _rAttrSet, aMetaData );
[ # # ]
941 : : }
942 : : //.........................................................................
943 : : } // namespace dbaui
944 : : //.........................................................................
945 : :
946 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|