1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef DBAUI_DBSETUPCONNECTIONPAGES_HXX 29 #define DBAUI_DBSETUPCONNECTIONPAGES_HXX 30 31 #ifndef DBAUI_CONNECTIONPAGESETUP_HXX 32 #include "ConnectionPageSetup.hxx" 33 #endif 34 35 #include "adminpages.hxx" 36 #include "admincontrols.hxx" 37 #include "curledit.hxx" 38 #include "TextConnectionHelper.hxx" 39 40 #include <svtools/roadmapwizard.hxx> 41 #include <ucbhelper/content.hxx> 42 #include <vcl/field.hxx> 43 44 45 //......................................................................... 46 namespace dbaui 47 48 { 49 //......................................................................... 50 51 class IDatabaseSettingsDialog; 52 // static OGenericAdministrationPage* CreateDbaseTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 53 54 55 //======================================================================== 56 //= OSpreadSheetConnectionPageSetup 57 //======================================================================== 58 class OSpreadSheetConnectionPageSetup : public OConnectionTabPageSetup 59 { 60 public: 61 virtual sal_Bool FillItemSet ( SfxItemSet& _rCoreAttrs ); 62 static OGenericAdministrationPage* CreateSpreadSheetTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 63 OSpreadSheetConnectionPageSetup(Window* pParent, const SfxItemSet& _rCoreAttrs); 64 65 protected: 66 CheckBox m_aCBPasswordrequired; 67 virtual ~OSpreadSheetConnectionPageSetup(); 68 69 protected: 70 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 71 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 72 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 73 74 }; 75 76 //======================================================================== 77 //= OTextConnectionPage 78 //======================================================================== 79 class OTextConnectionPageSetup : public OConnectionTabPageSetup 80 { 81 public: 82 virtual sal_Bool FillItemSet ( SfxItemSet& _rCoreAttrs ); 83 static OGenericAdministrationPage* CreateTextTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 84 OTextConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs ); 85 OTextConnectionHelper* m_pTextConnectionHelper; 86 private: 87 88 protected: 89 virtual ~OTextConnectionPageSetup(); 90 virtual sal_Bool prepareLeave(); 91 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 92 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 93 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 94 bool checkTestConnection(); 95 96 private: 97 DECL_LINK(ImplGetExtensionHdl, OTextConnectionHelper*); 98 }; 99 100 //======================================================================== 101 //= OLDAPConnectionPageSetup 102 //======================================================================== 103 class OLDAPConnectionPageSetup : public OGenericAdministrationPage 104 { 105 public: 106 virtual sal_Bool FillItemSet ( SfxItemSet& _rCoreAttrs ); 107 static OGenericAdministrationPage* CreateLDAPTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 108 OLDAPConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs ); 109 virtual Link getControlModifiedLink() { return LINK(this, OLDAPConnectionPageSetup, OnEditModified); } 110 111 protected: 112 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 113 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 114 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 115 DECL_LINK(OnEditModified,Edit*); 116 117 private: 118 FixedText m_aFTHeaderText; 119 FixedText m_aFTHelpText; 120 FixedText m_aFTHostServer; 121 Edit m_aETHostServer; 122 FixedText m_aFTBaseDN; 123 Edit m_aETBaseDN; 124 FixedText m_aFTPortNumber; 125 NumericField m_aNFPortNumber; 126 FixedText m_aFTDefaultPortNumber; 127 CheckBox m_aCBUseSSL; 128 }; 129 130 //======================================================================== 131 //= MySQLNativeSetupPage 132 //======================================================================== 133 class MySQLNativeSetupPage : public OGenericAdministrationPage 134 { 135 private: 136 FixedText m_aHeader; 137 FixedText m_aHelpText; 138 MySQLNativeSettings m_aMySQLSettings; 139 140 public: 141 MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs ); 142 143 static OGenericAdministrationPage* Create( Window* pParent, const SfxItemSet& _rAttrSet ); 144 145 protected: 146 virtual void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ); 147 virtual void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList ); 148 149 virtual sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs ); 150 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 151 152 virtual Link getControlModifiedLink(); 153 154 private: 155 DECL_LINK( OnModified, Edit* ); 156 }; 157 158 //======================================================================== 159 //= OGeneralSpecialJDBCConnectionPageSetup 160 //======================================================================== 161 class OGeneralSpecialJDBCConnectionPageSetup : public OGenericAdministrationPage 162 { 163 public: 164 OGeneralSpecialJDBCConnectionPageSetup( Window* pParent 165 , sal_uInt16 _nResId 166 , const SfxItemSet& _rCoreAttrs 167 , sal_uInt16 _nPortId 168 , sal_uInt16 _nDefaultPortResId 169 , sal_uInt16 _nHelpTextResId 170 , sal_uInt16 _nHeaderTextResId 171 , sal_uInt16 _nDriverClassId ); 172 static OGenericAdministrationPage* CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 173 static OGenericAdministrationPage* CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 174 175 protected: 176 virtual sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs ); 177 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 178 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 179 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 180 virtual Link getControlModifiedLink() { return LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified); } 181 182 DECL_LINK(OnTestJavaClickHdl,PushButton*); 183 DECL_LINK(OnEditModified,Edit*); 184 FixedText m_aFTHelpText; 185 FixedText m_aFTDatabasename; 186 Edit m_aETDatabasename; 187 FixedText m_aFTHostname; 188 Edit m_aETHostname; 189 FixedText m_aFTPortNumber; 190 FixedText m_aFTDefaultPortNumber; 191 NumericField m_aNFPortNumber; 192 193 194 FixedText m_aFTDriverClass; 195 Edit m_aETDriverClass; 196 PushButton m_aPBTestJavaDriver; 197 198 String m_sDefaultJdbcDriverName; 199 sal_uInt16 m_nPortId; 200 }; 201 202 203 //======================================================================== 204 //= OJDBCConnectionPageSetup 205 //======================================================================== 206 class OJDBCConnectionPageSetup : public OConnectionTabPageSetup 207 { 208 public: 209 OJDBCConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs ); 210 static OGenericAdministrationPage* CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 211 212 protected: 213 virtual bool checkTestConnection(); 214 215 virtual sal_Bool FillItemSet( SfxItemSet& _rCoreAttrs ); 216 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 217 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 218 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 219 220 DECL_LINK(OnTestJavaClickHdl,PushButton*); 221 DECL_LINK(OnEditModified,Edit*); 222 FixedText m_aFTDriverClass; 223 Edit m_aETDriverClass; 224 PushButton m_aPBTestJavaDriver; 225 }; 226 227 228 229 //======================================================================== 230 //= OJDBCConnectionPageSetup 231 //======================================================================== 232 class OMySQLIntroPageSetup : public OGenericAdministrationPage 233 { 234 public: 235 enum ConnectionType 236 { 237 VIA_ODBC, 238 VIA_JDBC, 239 VIA_NATIVE 240 }; 241 242 OMySQLIntroPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs); 243 244 static OMySQLIntroPageSetup* CreateMySQLIntroTabPage( Window* _pParent, const SfxItemSet& _rAttrSet ); 245 ConnectionType getMySQLMode(); 246 Link maClickHdl; 247 void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } 248 const Link& GetClickHdl() const { return maClickHdl; } 249 DECL_LINK(ImplClickHdl, OMySQLIntroPageSetup*); 250 251 252 253 254 protected: 255 virtual sal_Bool FillItemSet(SfxItemSet& _rSet); 256 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 257 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 258 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 259 virtual ~OMySQLIntroPageSetup(); 260 261 private: 262 RadioButton m_aRB_ODBCDatabase; 263 RadioButton m_aRB_JDBCDatabase; 264 RadioButton m_aRB_NATIVEDatabase; 265 FixedText m_aFT_ConnectionMode; 266 FixedText m_aFT_Helptext; 267 FixedText m_aFT_Headertext; 268 269 DECL_LINK(OnSetupModeSelected, RadioButton*); 270 271 }; 272 273 274 275 276 //======================================================================== 277 //= OAuthentificationPageSetup 278 //======================================================================== 279 class OAuthentificationPageSetup : public OGenericAdministrationPage 280 { 281 public: 282 virtual sal_Bool FillItemSet ( SfxItemSet& _rCoreAttrs ); 283 static OGenericAdministrationPage* CreateAuthentificationTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); 284 OAuthentificationPageSetup(Window* pParent, const SfxItemSet& _rCoreAttrs); 285 286 protected: 287 FixedText m_aFTHelpText; 288 FixedText m_aFTHeaderText; 289 FixedText m_aFTUserName; 290 Edit m_aETUserName; 291 CheckBox m_aCBPasswordRequired; 292 PushButton m_aPBTestConnection; 293 virtual ~OAuthentificationPageSetup(); 294 295 protected: 296 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 297 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 298 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 299 }; 300 301 302 303 //======================================================================== 304 //= OFinalDBPageSetup 305 //======================================================================== 306 class OFinalDBPageSetup : public OGenericAdministrationPage 307 { 308 public: 309 virtual sal_Bool FillItemSet ( SfxItemSet& _rCoreAttrs ); 310 static OGenericAdministrationPage* CreateFinalDBTabPageSetup( Window* pParent, const SfxItemSet& _rAttrSet); 311 312 FixedText m_aFTFinalHeader; 313 FixedText m_aFTFinalHelpText; 314 RadioButton m_aRBRegisterDataSource; 315 RadioButton m_aRBDontregisterDataSource; 316 FixedText m_aFTAdditionalSettings; 317 CheckBox m_aCBOpenAfterwards; 318 CheckBox m_aCBStartTableWizard; 319 FixedText m_aFTFinalText; 320 321 OFinalDBPageSetup(Window* pParent, const SfxItemSet& _rCoreAttrs); 322 sal_Bool IsDatabaseDocumentToBeRegistered(); 323 sal_Bool IsDatabaseDocumentToBeOpened(); 324 sal_Bool IsTableWizardToBeStarted(); 325 void enableTableWizardCheckBox( sal_Bool _bSupportsTableCreation); 326 327 /// may be used in SetXXXHdl calls to controls, is a link to <method>OnControlModified</method> 328 Link getControlModifiedLink() { return LINK(this, OGenericAdministrationPage, OnControlModified); } 329 330 DECL_LINK(OnOpenSelected, CheckBox*); 331 protected: 332 virtual ~OFinalDBPageSetup(); 333 334 protected: 335 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 336 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 337 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 338 }; 339 340 //......................................................................... 341 } // namespace dbaui 342 //......................................................................... 343 344 #endif 345