1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
#include "detailpages.hxx"
#include "sqlmessage.hxx"
#include "dsmeta.hxx"
#include "advancedsettings.hxx"
#include "DbAdminImpl.hxx"
#include "dsitems.hxx"
#include "dbfindex.hxx"
#include "localresaccess.hxx"
#include "dsnItem.hxx"
#include "dbaccess_helpid.hrc"
#include "dbu_dlg.hrc"
#include "dbadmin.hrc"
#ifndef _SFXITEMSET_HXX
#include <svl/itemset.hxx>
#endif
#ifndef _SFXSTRITEM_HXX
#include <svl/stritem.hxx>
#endif
#ifndef _SFXENUMITEM_HXX
#include <svl/eitem.hxx>
#endif
#ifndef _SFXINTITEM_HXX
#include <svl/intitem.hxx>
#endif
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
#ifndef _SV_MNEMONIC_HXX
#include <vcl/mnemonic.hxx>
#endif
#ifndef _SVTOOLS_CJKOPTIONS_HXX
#include <svl/cjkoptions.hxx>
#endif
#include <jvmaccess/virtualmachine.hxx>
#ifndef DBAUI_ADABASPAGE_HRC
#include "AdabasPage.hrc"
#endif
#ifndef _DBAUI_ADASTAT_HXX_
#include "AdabasStat.hxx"
#endif
#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include <connectivity/CommonTools.hxx>
#endif
#ifndef DBAUI_DRIVERSETTINGS_HXX
#include "DriverSettings.hxx"
#endif
#ifndef _DBAUI_DBADMIN_HXX_
#include "dbadmin.hxx"
#endif
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
#include "AutoControls.hrc"
//.........................................................................
namespace dbaui
{
//.........................................................................
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::dbtools;
//========================================================================
//= OCommonBehaviourTabPage
//========================================================================
DBG_NAME(OCommonBehaviourTabPage)
//------------------------------------------------------------------------
OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nResId, const SfxItemSet& _rCoreAttrs,
sal_uInt32 nControlFlags,bool _bFreeResource)
:OGenericAdministrationPage(pParent, ModuleRes(nResId), _rCoreAttrs)
,m_pOptionsLabel(NULL)
,m_pOptions(NULL)
,m_pDataConvertFixedLine(NULL)
,m_pCharsetLabel(NULL)
,m_pCharset(NULL)
,m_pAutoFixedLine(NULL)
,m_pAutoRetrievingEnabled(NULL)
,m_pAutoIncrementLabel(NULL)
,m_pAutoIncrement(NULL)
,m_pAutoRetrievingLabel(NULL)
,m_pAutoRetrieving(NULL)
,m_nControlFlags(nControlFlags)
{
DBG_CTOR(OCommonBehaviourTabPage,NULL);
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
{
m_pOptionsLabel = new FixedText(this, ModuleRes(FT_OPTIONS));
m_pOptions = new Edit(this, ModuleRes(ET_OPTIONS));
m_pOptions->SetModifyHdl(getControlModifiedLink());
}
if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
{
m_pDataConvertFixedLine = new FixedLine(this, ModuleRes(FL_DATACONVERT));
m_pCharsetLabel = new FixedText(this, ModuleRes(FT_CHARSET));
m_pCharset = new CharSetListBox(this, ModuleRes(LB_CHARSET));
m_pCharset->SetSelectHdl(getControlModifiedLink());
}
Window* pWindows[] = { m_pAutoRetrievingEnabled, m_pAutoFixedLine,
m_pAutoIncrementLabel, m_pAutoIncrement,
m_pAutoRetrievingLabel, m_pAutoRetrieving };
sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
for (sal_Int32 i=1; i < nCount; ++i)
{
if ( pWindows[i] )
{
Window* pPrev = pWindows[i-1];
for (sal_Int32 j = i-1; pPrev == NULL && j >= 0 ; --j)
{
pPrev = pWindows[j];
}
if ( pPrev )
pWindows[i]->SetZOrder(pPrev, WINDOW_ZORDER_BEHIND);
}
}
if ( _bFreeResource )
FreeResource();
}
// -----------------------------------------------------------------------
OCommonBehaviourTabPage::~OCommonBehaviourTabPage()
{
DELETEZ(m_pOptionsLabel);
DELETEZ(m_pOptions);
DELETEZ(m_pDataConvertFixedLine);
DELETEZ(m_pCharsetLabel);
DELETEZ(m_pCharset);
DELETEZ(m_pAutoFixedLine);
DELETEZ(m_pAutoIncrementLabel);
DELETEZ(m_pAutoIncrement);
DELETEZ(m_pAutoRetrievingEnabled);
DELETEZ(m_pAutoRetrievingLabel);
DELETEZ(m_pAutoRetrieving);
DBG_DTOR(OCommonBehaviourTabPage,NULL);
}
// -----------------------------------------------------------------------
void OCommonBehaviourTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
{
_rControlList.push_back(new ODisableWrapper<FixedText>(m_pOptionsLabel));
}
if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
{
_rControlList.push_back(new ODisableWrapper<FixedLine>(m_pDataConvertFixedLine));
_rControlList.push_back(new ODisableWrapper<FixedText>(m_pCharsetLabel));
}
}
// -----------------------------------------------------------------------
void OCommonBehaviourTabPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
_rControlList.push_back(new OSaveValueWrapper<Edit>(m_pOptions));
if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
_rControlList.push_back(new OSaveValueWrapper<ListBox>(m_pCharset));
}
// -----------------------------------------------------------------------
void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
// collect the items
SFX_ITEMSET_GET(_rSet, pOptionsItem, SfxStringItem, DSID_ADDITIONALOPTIONS, sal_True);
SFX_ITEMSET_GET(_rSet, pCharsetItem, SfxStringItem, DSID_CHARSET, sal_True);
// forward the values to the controls
if (bValid)
{
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
{
m_pOptions->SetText(pOptionsItem->GetValue());
m_pOptions->ClearModifyFlag();
}
if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
{
m_pCharset->SelectEntryByIanaName( pCharsetItem->GetValue() );
}
}
OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
}
// -----------------------------------------------------------------------
sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet)
{
sal_Bool bChangedSomething = sal_False;
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
{
fillString(_rSet,m_pOptions,DSID_ADDITIONALOPTIONS,bChangedSomething);
}
if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
{
if ( m_pCharset->StoreSelectedCharSet( _rSet, DSID_CHARSET ) )
bChangedSomething = sal_True;
}
return bChangedSomething;
}
//========================================================================
//= ODbaseDetailsPage
//========================================================================
DBG_NAME(ODbaseDetailsPage)
//------------------------------------------------------------------------
ODbaseDetailsPage::ODbaseDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_DBASE, _rCoreAttrs, CBTP_USE_CHARSET ,false)
,m_aShowDeleted (this, ModuleRes(CB_SHOWDELETEDROWS))
,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
,m_aFT_Message (this, ModuleRes( FT_SPECIAL_MESSAGE) )
,m_aIndexes (this, ModuleRes(PB_INDICIES))
{
DBG_CTOR(ODbaseDetailsPage,NULL);
m_aIndexes.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
m_aShowDeleted.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
// correct the z-order which is mixed-up because the base class constructed some controls before we did
m_pCharset->SetZOrder(&m_aShowDeleted, WINDOW_ZORDER_BEFOR);
FreeResource();
}
// -----------------------------------------------------------------------
ODbaseDetailsPage::~ODbaseDetailsPage()
{
DBG_DTOR(ODbaseDetailsPage,NULL);
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateDbase( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new ODbaseDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
void ODbaseDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aShowDeleted));
}
// -----------------------------------------------------------------------
void ODbaseDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFT_Message));
_rControlList.push_back(new ODisableWrapper<PushButton>(&m_aIndexes));
}
// -----------------------------------------------------------------------
void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
// get the DSN string (needed for the index dialog)
SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(_rSet, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len())
m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
// get the other relevant items
SFX_ITEMSET_GET(_rSet, pDeletedItem, SfxBoolItem, DSID_SHOWDELETEDROWS, sal_True);
if ( bValid )
{
m_aShowDeleted.Check( pDeletedItem->GetValue() );
m_aFT_Message.Show(m_aShowDeleted.IsChecked());
}
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
// -----------------------------------------------------------------------
sal_Bool ODbaseDetailsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
fillBool(_rSet,&m_aShowDeleted,DSID_SHOWDELETEDROWS,bChangedSomething);
return bChangedSomething;
}
//------------------------------------------------------------------------
IMPL_LINK( ODbaseDetailsPage, OnButtonClicked, Button*, pButton )
{
if (&m_aIndexes == pButton)
{
ODbaseIndexDialog aIndexDialog(this, m_sDsn);
aIndexDialog.Execute();
}
else
{
m_aFT_Message.Show(m_aShowDeleted.IsChecked());
// it was one of the checkboxes -> we count as modified from now on
callModifiedHdl();
}
return 0;
}
//========================================================================
//= OAdoDetailsPage
//========================================================================
DBG_NAME(OAdoDetailsPage)
// -----------------------------------------------------------------------
OAdoDetailsPage::OAdoDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_ADO, _rCoreAttrs, CBTP_USE_CHARSET )
{
DBG_CTOR(OAdoDetailsPage,NULL);
}
// -----------------------------------------------------------------------
OAdoDetailsPage::~OAdoDetailsPage()
{
DBG_DTOR(OAdoDetailsPage,NULL);
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateAdo( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OAdoDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
//========================================================================
//= OOdbcDetailsPage
//========================================================================
OOdbcDetailsPage::OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_CHARSET | CBTP_USE_OPTIONS,false)
,m_aFL_1 (this, ModuleRes(FL_SEPARATOR1))
,m_aUseCatalog (this, ModuleRes(CB_USECATALOG))
{
m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
FreeResource();
Window* pWindows[] = { m_pCharsetLabel, m_pCharset
,m_pOptionsLabel,m_pOptions,&m_aUseCatalog
};
sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
for (sal_Int32 i=1; i < nCount; ++i)
pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateODBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OOdbcDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
sal_Bool OOdbcDetailsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
return bChangedSomething;
}
// -----------------------------------------------------------------------
void OOdbcDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
}
// -----------------------------------------------------------------------
void OOdbcDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
}
// -----------------------------------------------------------------------
void OOdbcDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
if ( bValid )
m_aUseCatalog.Check(pUseCatalogItem->GetValue());
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
//========================================================================
//= OOdbcDetailsPage
//========================================================================
OUserDriverDetailsPage::OUserDriverDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_USERDRIVER, _rCoreAttrs,
CBTP_USE_CHARSET | CBTP_USE_OPTIONS ,false)
,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
,m_aUseCatalog (this, ModuleRes(CB_USECATALOG))
{
m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
FreeResource();
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateUser( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OUserDriverDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
sal_Bool OUserDriverDetailsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_PORTNUMBER,bChangedSomething);
fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
return bChangedSomething;
}
// -----------------------------------------------------------------------
void OUserDriverDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
}
// -----------------------------------------------------------------------
void OUserDriverDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
}
// -----------------------------------------------------------------------
void OUserDriverDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_PORTNUMBER, sal_True);
if ( bValid )
{
m_aEDHostname.SetText(pHostName->GetValue());
m_aEDHostname.ClearModifyFlag();
m_aNFPortNumber.SetValue(pPortNumber->GetValue());
m_aNFPortNumber.ClearModifyFlag();
m_aUseCatalog.Check(pUseCatalogItem->GetValue());
}
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
//========================================================================
//= OMySQLODBCDetailsPage
//========================================================================
OMySQLODBCDetailsPage::OMySQLODBCDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_MYSQL_ODBC, _rCoreAttrs, CBTP_USE_CHARSET )
{
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLODBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OMySQLODBCDetailsPage( pParent, _rAttrSet ) );
}
//========================================================================
//= OMySQLJDBCDetailsPage
//========================================================================
OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,sal_uInt16 _nResId, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId)
:OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false)
,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
,m_aFTSocket (this, ModuleRes(FT_SOCKET))
,m_aEDSocket (this, ModuleRes(ET_SOCKET))
,m_aFTDriverClass (this, ModuleRes(FT_JDBCDRIVERCLASS))
,m_aEDDriverClass (this, ModuleRes(ET_JDBCDRIVERCLASS))
,m_aTestJavaDriver (this, ModuleRes(PB_TESTDRIVERCLASS))
,m_nPortId(_nPortId)
,m_bUseClass(true)
{
SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
{
m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
}
if ( m_sDefaultJdbcDriverName.Len() )
{
m_aEDDriverClass.SetModifyHdl(getControlModifiedLink());
m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified));
m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
}
else
{
m_bUseClass = false;
m_aFTDriverClass.Show(sal_False);
m_aEDDriverClass.Show(sal_False);
m_aTestJavaDriver.Show(sal_False);
}
m_aFTSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
m_aEDSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
m_aEDHostname.SetModifyHdl(getControlModifiedLink());
m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
m_aEDSocket.SetModifyHdl(getControlModifiedLink());
Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname,
&m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
&m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver,
m_pCharsetLabel, m_pCharset};
sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
for (sal_Int32 i=1; i < nCount; ++i)
pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
FreeResource();
}
// -----------------------------------------------------------------------
void OGeneralSpecialJDBCDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
if ( m_bUseClass )
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDDriverClass));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket));
}
// -----------------------------------------------------------------------
void OGeneralSpecialJDBCDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
if ( m_bUseClass )
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
}
// -----------------------------------------------------------------------
sal_Bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
if ( m_bUseClass )
fillString(_rSet,&m_aEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething);
fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
return bChangedSomething;
}
// -----------------------------------------------------------------------
void OGeneralSpecialJDBCDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
if ( bValid )
{
if ( m_bUseClass )
{
m_aEDDriverClass.SetText(pDrvItem->GetValue());
m_aEDDriverClass.ClearModifyFlag();
}
m_aEDHostname.SetText(pHostName->GetValue());
m_aEDHostname.ClearModifyFlag();
m_aNFPortNumber.SetValue(pPortNumber->GetValue());
m_aNFPortNumber.ClearModifyFlag();
m_aEDSocket.SetText(pSocket->GetValue());
m_aEDSocket.ClearModifyFlag();
}
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
// to get the correcxt value when saveValue was called by base class
if ( m_bUseClass && !m_aEDDriverClass.GetText().Len() )
{
m_aEDDriverClass.SetText(m_sDefaultJdbcDriverName);
m_aEDDriverClass.SetModifyFlag();
}
}
// -----------------------------------------------------------------------
IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
OSL_ENSURE(m_bUseClass,"Who called me?");
sal_Bool bSuccess = sal_False;
try
{
if ( m_aEDDriverClass.GetText().Len() )
{
// TODO chage jvmaccess
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText());
}
}
catch(Exception&)
{
}
sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
aMsg.Execute();
return 0L;
}
// -----------------------------------------------------------------------
IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnEditModified, Edit*, _pEdit)
{
if ( m_bUseClass && _pEdit == &m_aEDDriverClass )
m_aTestJavaDriver.Enable( m_aEDDriverClass.GetText().Len() != 0 );
// tell the listener we were modified
callModifiedHdl();
return 0L;
}
//========================================================================
//= MySQLNativePage
//========================================================================
MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false )
,m_aSeparator1 ( this, ModuleRes( FL_SEPARATOR1) )
,m_aMySQLSettings ( *this, getControlModifiedLink() )
,m_aSeparator2 ( this, ModuleRes(FL_SEPARATOR2))
,m_aUserNameLabel ( this, ModuleRes(FT_USERNAME))
,m_aUserName ( this, ModuleRes(ET_USERNAME))
,m_aPasswordRequired ( this, ModuleRes(CB_PASSWORD_REQUIRED))
{
m_aUserName.SetModifyHdl(getControlModifiedLink());
Window* pWindows[] = { &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName,
&m_aPasswordRequired, m_pCharsetLabel, m_pCharset};
sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
for (sal_Int32 i=1; i < nCount; ++i)
pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
LayoutHelper::positionBelow( m_aSeparator1, m_aMySQLSettings, RelatedControls, 3 );
m_aMySQLSettings.Show();
FreeResource();
}
// -----------------------------------------------------------------------
void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls( _rControlList );
m_aMySQLSettings.fillControls( _rControlList );
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName));
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired));
}
// -----------------------------------------------------------------------
void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows( _rControlList );
m_aMySQLSettings.fillWindows( _rControlList);
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1));
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel));
}
// -----------------------------------------------------------------------
sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet );
bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet );
if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() )
{
_rSet.Put( SfxStringItem( DSID_USER, m_aUserName.GetText() ) );
_rSet.Put( SfxStringItem( DSID_PASSWORD, String()));
bChangedSomething = sal_True;
}
fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
return bChangedSomething;
}
// -----------------------------------------------------------------------
void MySQLNativePage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
m_aMySQLSettings.implInitControls( _rSet );
SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
if ( bValid )
{
m_aUserName.SetText(pUidItem->GetValue());
m_aUserName.ClearModifyFlag();
m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue());
}
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) );
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new MySQLNativePage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) );
}
//========================================================================
//= OAdabasDetailsPage
//========================================================================
OAdabasDetailsPage::OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_ADABAS, _rCoreAttrs, CBTP_USE_CHARSET ,false)
,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
,m_FT_CACHE_SIZE( this, ModuleRes( FT_CACHE_SIZE ) )
,m_NF_CACHE_SIZE( this, ModuleRes( NF_CACHE_SIZE ) )
,m_FT_DATA_INCREMENT( this, ModuleRes( FT_DATA_INCREMENT ) )
,m_NF_DATA_INCREMENT( this, ModuleRes( NF_DATA_INCREMENT ) )
,m_aFL_2( this, ModuleRes( FL_SEPARATOR2 ) )
,m_FT_CTRLUSERNAME( this, ModuleRes( FT_CTRLUSERNAME ) )
,m_ET_CTRLUSERNAME( this, ModuleRes( ET_CTRLUSERNAME ) )
,m_FT_CTRLPASSWORD( this, ModuleRes( FT_CTRLPASSWORD ) )
,m_ET_CTRLPASSWORD( this, ModuleRes( ET_CTRLPASSWORD ) )
,m_CB_SHUTDB( this, ModuleRes( CB_SHUTDB ) )
,m_PB_STAT( this, ModuleRes( PB_STAT ) )
{
m_aEDHostname.SetModifyHdl(getControlModifiedLink());
FreeResource();
m_PB_STAT.SetClickHdl( LINK(this,OAdabasDetailsPage,PBClickHdl));
m_CB_SHUTDB.SetClickHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
m_NF_CACHE_SIZE.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
m_NF_DATA_INCREMENT.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
m_ET_CTRLUSERNAME.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
m_ET_CTRLPASSWORD.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
m_ET_CTRLUSERNAME.SetLoseFocusHdl( LINK(this,OAdabasDetailsPage,LoseFocusHdl));
m_ET_CTRLPASSWORD.SetLoseFocusHdl( LINK(this,OAdabasDetailsPage,LoseFocusHdl));
m_NF_DATA_INCREMENT.SetMin(20);
m_NF_DATA_INCREMENT.SetMax(LONG_MAX);
m_NF_DATA_INCREMENT.SetValue(20);
m_NF_DATA_INCREMENT.SetDecimalDigits(0);
m_NF_CACHE_SIZE.SetMin(4);
m_NF_CACHE_SIZE.SetMax(LONG_MAX);
m_NF_CACHE_SIZE.SetValue(4);
m_NF_CACHE_SIZE.SetDecimalDigits(0);
Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname
,&m_FT_CACHE_SIZE,&m_NF_CACHE_SIZE
,&m_FT_DATA_INCREMENT,&m_NF_DATA_INCREMENT
,&m_FT_CTRLUSERNAME,&m_ET_CTRLUSERNAME
,&m_FT_CTRLPASSWORD,&m_ET_CTRLPASSWORD
,&m_CB_SHUTDB
,m_pCharsetLabel, m_pCharset,&m_PB_STAT};
sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
for (sal_Int32 i=1; i < nCount; ++i)
pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateAdabas( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OAdabasDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
void OAdabasDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_CACHE_SIZE));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_DATA_INCREMENT));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLUSERNAME));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLPASSWORD));
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_CB_SHUTDB));
}
// -----------------------------------------------------------------------
void OAdabasDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CACHE_SIZE));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_DATA_INCREMENT));
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_2));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLUSERNAME));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLPASSWORD));
_rControlList.push_back(new ODisableWrapper<PushButton>(&m_PB_STAT));
}
// -----------------------------------------------------------------------
void OAdabasDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
SFX_ITEMSET_GET(_rSet, pCtrlUserItem, SfxStringItem, DSID_CONN_CTRLUSER, sal_True);
SFX_ITEMSET_GET(_rSet, pCtrlPwdItem, SfxStringItem, DSID_CONN_CTRLPWD, sal_True);
SFX_ITEMSET_GET(_rSet, pShutItem, SfxBoolItem, DSID_CONN_SHUTSERVICE, sal_True);
SFX_ITEMSET_GET(_rSet, pIncItem, SfxInt32Item, DSID_CONN_DATAINC, sal_True);
SFX_ITEMSET_GET(_rSet, pCacheItem, SfxInt32Item, DSID_CONN_CACHESIZE, sal_True);
if ( bValid )
{
m_aEDHostname.SetText(pHostName->GetValue());
m_aEDHostname.ClearModifyFlag();
m_CB_SHUTDB.Check( pShutItem->GetValue() );
m_NF_DATA_INCREMENT.SetValue( pIncItem->GetValue() );
m_NF_CACHE_SIZE.SetValue( pCacheItem->GetValue() );
m_ET_CTRLUSERNAME.SetText(pCtrlUserItem->GetValue());
m_ET_CTRLPASSWORD.SetText(pCtrlPwdItem->GetValue());
m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
}
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
// -----------------------------------------------------------------------
sal_Bool OAdabasDetailsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
fillBool(_rSet,&m_CB_SHUTDB,DSID_CONN_SHUTSERVICE,bChangedSomething);
fillInt32(_rSet,&m_NF_DATA_INCREMENT,DSID_CONN_DATAINC,bChangedSomething );
fillInt32(_rSet,&m_NF_CACHE_SIZE,DSID_CONN_CACHESIZE,bChangedSomething );
fillString(_rSet,&m_ET_CTRLUSERNAME,DSID_CONN_CTRLUSER,bChangedSomething );
fillString(_rSet,&m_ET_CTRLPASSWORD,DSID_CONN_CTRLPWD,bChangedSomething );
return bChangedSomething;
}
//------------------------------------------------------------------------
IMPL_LINK( OAdabasDetailsPage, AttributesChangedHdl, void *, EMPTYARG )
{
m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
bAttrsChanged = sal_True;
callModifiedHdl();
return 0;
}
//------------------------------------------------------------------------
IMPL_LINK( OAdabasDetailsPage, LoseFocusHdl, Edit *, /*pEdit*/ )
{
m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
return 0;
}
//------------------------------------------------------------------------
IMPL_LINK( OAdabasDetailsPage, PBClickHdl, Button *, /*pButton*/ )
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
if ( m_pAdminDialog )
{
m_pAdminDialog->saveDatasource();
try
{
Reference< XConnection > xConnection = m_pAdminDialog->createConnection().first;
if ( xConnection.is() )
{
OAdabasStatistics aDlg(this,m_sUser,xConnection,m_pAdminDialog->getORB());
aDlg.Execute();
::comphelper::disposeComponent(xConnection);
}
}
catch(Exception&)
{
}
}
return 0;
}
//========================================================================
//= OLDAPDetailsPage
//========================================================================
OLDAPDetailsPage::OLDAPDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_LDAP, _rCoreAttrs,0,false)
,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
,m_aBaseDN (this, ModuleRes(FT_BASEDN))
,m_aETBaseDN (this, ModuleRes(ET_BASEDN))
,m_aCBUseSSL (this, ModuleRes(CB_USESSL))
,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
,m_aFTRowCount (this, ModuleRes(FT_LDAPROWCOUNT))
,m_aNFRowCount (this, ModuleRes(NF_LDAPROWCOUNT))
{
m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
m_aNFRowCount.SetModifyHdl(getControlModifiedLink());
m_aNFRowCount.SetUseThousandSep(sal_False);
m_iNormalPort = 389;
m_iSSLPort = 636;
m_aCBUseSSL.SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick));
FreeResource();
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OLDAPDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
sal_Bool OLDAPDetailsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN,bChangedSomething);
fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
fillInt32(_rSet,&m_aNFRowCount,DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
return bChangedSomething;
}
//------------------------------------------------------------------------
IMPL_LINK( OLDAPDetailsPage, OnCheckBoxClick, CheckBox*, pCheckBox )
{
callModifiedHdl();
if ( pCheckBox == &m_aCBUseSSL)
{
if ( m_aCBUseSSL.IsChecked() )
{
m_iNormalPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
m_aNFPortNumber.SetValue(m_iSSLPort);
}
else
{
m_iSSLPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
m_aNFPortNumber.SetValue(m_iNormalPort);
}
}
return 0;
}
// -----------------------------------------------------------------------
void OLDAPDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFRowCount));
}
// -----------------------------------------------------------------------
void OLDAPDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aBaseDN));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTRowCount));
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
}
// -----------------------------------------------------------------------
void OLDAPDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
SFX_ITEMSET_GET(_rSet, pUseSSL, SfxBoolItem, DSID_CONN_LDAP_USESSL, sal_True);
SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
SFX_ITEMSET_GET(_rSet, pRowCount, SfxInt32Item, DSID_CONN_LDAP_ROWCOUNT, sal_True);
if ( bValid )
{
m_aETBaseDN.SetText(pBaseDN->GetValue());
m_aNFPortNumber.SetValue(pPortNumber->GetValue());
m_aNFRowCount.SetValue(pRowCount->GetValue());
m_aCBUseSSL.Check(pUseSSL->GetValue());
}
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
//========================================================================
//= OTextDetailsPage
//========================================================================
DBG_NAME(OTextDetailsPage)
//------------------------------------------------------------------------
OTextDetailsPage::OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_TEXT, _rCoreAttrs, 0, false )
{
DBG_CTOR(OTextDetailsPage,NULL);
m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
FreeResource();
}
// -----------------------------------------------------------------------
OTextDetailsPage::~OTextDetailsPage()
{
DELETEZ(m_pTextConnectionHelper);
DBG_DTOR(OTextDetailsPage,NULL);
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateText( Window* pParent, const SfxItemSet& _rAttrSet )
{
return ( new OTextDetailsPage( pParent, _rAttrSet ) );
}
// -----------------------------------------------------------------------
void OTextDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillControls(_rControlList);
m_pTextConnectionHelper->fillControls(_rControlList);
}
// -----------------------------------------------------------------------
void OTextDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
OCommonBehaviourTabPage::fillWindows(_rControlList);
m_pTextConnectionHelper->fillWindows(_rControlList);
}
// -----------------------------------------------------------------------
void OTextDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
m_pTextConnectionHelper->implInitControls(_rSet, bValid);
OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
}
// -----------------------------------------------------------------------
sal_Bool OTextDetailsPage::FillItemSet( SfxItemSet& rSet )
{
sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(rSet);
bChangedSomething = m_pTextConnectionHelper->FillItemSet(rSet, bChangedSomething);
return bChangedSomething;
}
// -----------------------------------------------------------------------
sal_Bool OTextDetailsPage::prepareLeave()
{
return m_pTextConnectionHelper->prepareLeave();
}
//------------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateGeneratedValuesPage( Window* _pParent, const SfxItemSet& _rAttrSet )
{
return new GeneratedValuesPage( _pParent, _rAttrSet );
}
//------------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet )
{
::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
DataSourceMetaData aMetaData( eType );
return new SpecialSettingsPage( _pParent, _rAttrSet, aMetaData );
}
//.........................................................................
} // namespace dbaui
//.........................................................................
|