diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-09-14 11:18:01 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-09-14 11:18:01 +0000 |
commit | a6abfa16cd66addbda3a5ea3defd5d465a75a9a0 (patch) | |
tree | 3935894ee9a06336b4afba73fefc8cf99701831c /dbaccess/source/ui/dlg | |
parent | e221a8925fbdd5c681a2e186213529344222c88a (diff) |
CWS-TOOLING: integrate CWS dba32g
2009-09-09 07:53:55 +0200 oj r275964 : replace strlen with rtl_str_getLength
2009-09-07 20:59:10 +0200 fs r275913 : disable the CopyTableWizard test until issue 104869 is fixed
2009-09-07 12:17:31 +0200 oj r275885 : #i104810# remove de as lang
2009-09-05 22:26:21 +0200 fs r275857 : protect StateChanged against re-entrance
2009-09-05 22:25:52 +0200 fs r275856 : don't attempt to classify the parent of a form as control
2009-09-05 22:25:29 +0200 fs r275855 : protect against re-entrance
2009-09-05 00:11:40 +0200 fs r275835 : #i10000#
2009-09-04 23:25:50 +0200 fs r275834 : #i10000#
2009-09-04 23:23:47 +0200 fs r275833 : #i10000#
2009-09-04 21:49:37 +0200 fs r275830 : #i10000# correct wrong conflict resolution
2009-09-04 20:59:51 +0200 fs r275829 : CWS-TOOLING: rebase CWS dba32g to trunk@275801 (milestone: DEV300:m57)
2009-09-04 11:08:32 +0200 oj r275791 : #i104780# new version 1.2.0
2009-09-03 22:29:21 +0200 fs r275775 : OSL_TRACE doesn't need \n anymore
2009-09-03 08:33:21 +0200 fs r275743 : CWS-TOOLING: rebase CWS dba32g to trunk@275331 (milestone: DEV300:m56)
2009-09-02 13:48:12 +0200 fs r275708 : removed useless include
2009-09-02 13:45:43 +0200 fs r275707 : more since tags, which are used across offapi/udkapi
2009-09-02 13:23:04 +0200 fs r275705 : should *not* have the dtor, copy ctor, and assignment operator compiler-generated, else we run into trouble as soon as the compiler creates different versions of our singleton member's static data in different libraries
2009-09-02 12:32:45 +0200 fs r275704 : AutoIncrementIsPrimaryKey is a driver setting, not a data source setting
2009-09-02 11:42:49 +0200 fs r275701 : URL meta data are meta data which are valid for all connections of this type, not per-data-source properties. Settings them as data source properties is a hack.
2009-09-02 08:43:34 +0200 fs r275696 : 3.x.x is not a valid 'since' tag
2009-09-01 16:05:24 +0200 fs r275665 : #i104686# don't treat controls bound to read-only columns as required
2009-09-01 13:10:22 +0200 fs r275657 : #i104574# use PageUp/Down to scroll through the complete page
2009-09-01 07:04:48 +0200 oj r275641 : #i104104# correct line ends
2009-08-31 15:52:34 +0200 fs r275612 : #i104410#
2009-08-31 12:29:05 +0200 fs r275596 : #i104364#
2009-08-31 12:28:56 +0200 fs r275595 : #i104364#
2009-08-31 11:43:09 +0200 fs r275593 : #i104649# JavaDriverClassPath is also a known JDBC-bridge setting
2009-08-31 11:41:37 +0200 fs r275592 : #i104649#
2009-08-28 21:48:27 +0200 fs r275552 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI
2009-08-28 21:48:17 +0200 fs r275551 : #i96862# do not show the 'Create a new database' option when a) no embedded/dBase driver is installed or b) the configuration requests to hide the option
2009-08-28 21:47:19 +0200 fs r275550 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI
2009-08-28 21:46:41 +0200 fs r275549 : #i96862# renamed and extended the configuration data which controls availability of certain DBA-related UI
2009-08-28 15:10:19 +0200 fs r275535 : #i96862# if no embedded driver is installed, use dBase for creating new DBs. If no dBase driver is installed, too, do not offer the 'Create new database' option
2009-08-28 14:03:04 +0200 fs r275532 : #i104454# allow multiple fields to display the same column
2009-08-28 13:14:00 +0200 fs r275528 : #i104584# driver meta data do not belong into a data source's settings
2009-08-28 13:09:57 +0200 fs r275527 : properly chech the MySQL type buttons (else next/back in the wizard leads to state with two buttons checked)
2009-08-28 13:09:17 +0200 fs r275526 : #i104584# driver meta data do not belong into a data source's settings
2009-08-28 13:07:18 +0200 fs r275525 : BooleanComparisonMode is a property, or a feature - but not a driver meta data
2009-08-28 11:00:31 +0200 fs r275521 : #i104580#
2009-08-28 10:40:05 +0200 fs r275519 : #i104577# correct assertion: If the template node type is ANY, then any value type is allowed
2009-08-28 10:09:30 +0200 fs r275518 : #i104575# implement Named Pipe UI
2009-08-28 10:09:07 +0200 fs r275517 : pass the trigger-event to IWindowOperator::operateOn / work with VclWindowEvents, not VclSimpleEvents
2009-08-27 14:27:36 +0200 fs r275484 : ImplPosTabPage: respect mbEmptyViewMargin for WINDOWALIGN_LEFT
2009-08-27 13:43:56 +0200 fs r275480 : merging latest changes from CWS dba32f herein
2009-08-27 13:23:07 +0200 fs r275475 : #i103882#
2009-08-27 11:56:55 +0200 fs r275466 : #i104544# SetState: Do not call Update at the window which we just set text for. It should (sic\!) not be needed, but causes trouble
2009-08-27 11:55:34 +0200 fs r275465 : #i104544#
do not allow re-entrance for impl_ensureControl_nothrow
Actually, this is part of the fix only. I also removed the code which triggered this re-entrance (from
the grid control implementation), but to ensure it won't happen, again, I added some safety herein.
2009-08-27 10:14:11 +0200 fs r275459 : preparations for supporting a 'NamedPipe' parameter for the MySQL Connector/OOo
2009-08-27 10:13:21 +0200 fs r275458 : preparations for supporting a 'NamedPipe' setting for the MySQL Connector/OOo
2009-08-27 10:11:14 +0200 fs r275456 : outsourced the MySQLNative settings into a dedicated class, to not duplicate all the code in two tab page implementations
2009-08-26 14:18:13 +0200 fs r275422 : #i10000#
2009-08-26 13:26:36 +0200 fs r275419 : ignore output paths
2009-08-26 13:23:38 +0200 fs r275417 : support the LocalSocket property for the MySQL native driver
2009-08-26 13:17:05 +0200 fs r275416 : some re-factoring, to outsource the tab page for setting up the MySQLNative connection, into a dedicated class (needed later)
2009-08-26 13:15:15 +0200 fs r275415 : support a NoThousandSep property for NumericFormatters - I'm tired of correcting this at runtime, instead of controlling it in the resource
2009-08-26 11:45:08 +0200 fs r275410 : oops, 'flat' shouldn't have got lost
2009-08-26 09:38:57 +0200 fs r275398 : #i102631# when saving the document fails, ensure that the interaction handler really can handle/display the error
2009-08-26 09:37:05 +0200 fs r275397 : #i102631# don't let non-IO/RuntimeExceptions escape from DatabaseDocument::store*, wrap them into an IOException
2009-08-26 09:35:39 +0200 fs r275395 : let the default interaction handler implement XInteractionHandler2
2009-08-25 13:51:34 +0200 fs r275352 : #i102631# createTempFile: pass URL through FileHelper.getOOoCompatibleFileURL
2009-08-25 13:49:23 +0200 fs r275351 : #i102631# createTempFileURL: immediately delete the file implicitly created by createTempFile, we really only need the URL
2009-08-24 14:49:07 +0200 fs r275318 : #i10000#
2009-08-24 14:36:03 +0200 fs r275315 : properly terminate message with 0 character
2009-08-24 14:35:45 +0200 fs r275314 : trace method concepts in non-pro, if special flag is enabled
2009-08-24 14:24:17 +0200 fs r275312 : #i98973# filter some more events for grid control columns
2009-08-24 14:15:23 +0200 fs r275311 : #i98973# implement XComboBox for combo box cells
2009-08-24 13:39:24 +0200 fs r275308 : #i98973# do not display the 'actionPerformed' event for grid combo box columns
2009-08-24 12:52:03 +0200 fs r275303 : #i98973# implement XCheckBox and XButton for check box cells
2009-08-24 11:56:05 +0200 oj r275300 : #i104447# wrong default for orientation
2009-08-24 10:51:21 +0200 fs r275296 : in the script selector dialog, interpret a double click onto a function as OK
2009-08-24 10:50:56 +0200 fs r275295 : localize some to-be-displayed names, consolidate some code regarding form/control naming
2009-08-21 14:28:05 +0200 fs r275255 : #i98973# implement KeyListeners
2009-08-21 14:27:20 +0200 fs r275254 : #i98973# move the conversion VCL[Mouse|Key]Event->Awt[Mouse|Key]Event from vclxwindow.cxx to VCLUnoHelper
2009-08-21 14:08:50 +0200 fs r275248 : #i98973# implement Mouse- and MouseMotion-broadcasting
2009-08-21 13:31:08 +0200 fs r275244 : #i98973# implement text and change listeners at text cells
2009-08-21 12:47:38 +0200 fs r275234 : #i104399# some refactoring:
If the MySQL Connector/OOo is installed, it registers for the sdbc:mysqlc: protocol (now known as DST_MYSQL_NATIVE_DIRECT).
However, we do not want to display this in the UI, instead we display "MySQL" only, which collects DST_MYSQL_ODBC, DST_MYSQL_JDBC, and DST_MYSQL_NATIVE.
2009-08-21 12:45:18 +0200 fs r275232 : #i104399# also register for the sdbc:mysql:mysqlc protocol, decide at runtime (depending on the availability of sdbc:mysqlc:), whether it is really accepted. This prevents that the C/OOo extension needs to register *our* implementation name for the sdbc:mysql:mysqlc: protocol, which would be somewhat weird
2009-08-20 16:18:48 +0200 fs r275190 : merging the latest changes from CWS dba32f (which this CWS was created from)
2009-08-19 20:19:59 +0200 fs r275160 : add some spacing between the radios
2009-08-19 14:50:15 +0200 fs r275150 : #i98973# slightly refactoring the grid cell implementations, to prepare for proper events being fired. Implement focus events for the moment, more to come.
2009-08-19 10:53:38 +0200 fs r275142 : #i99936# initialize newly created models
2009-08-18 23:03:48 +0200 fs r275132 : merging latest changes from CWS dba32f
2009-08-18 15:14:08 +0200 fs r275110 : #i102819# SetColumnPos: SCROLL_CLIP is deadly here
Diffstat (limited to 'dbaccess/source/ui/dlg')
21 files changed, 972 insertions, 292 deletions
diff --git a/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc b/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc index 6a72f9fe4295..fe3590e5ba66 100644 --- a/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc +++ b/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc @@ -163,7 +163,7 @@ { \ Pos = MAP_APPFONT ( START_X , AUTO_Y + 2) ; \ Size = MAP_APPFONT ( EDIT_X - START_X - UNRELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ; \ - Text[ en-US ] = "Name of the database"; \ + Text[ en-US ] = "Database name"; \ }; \ \ Edit ET_AUTODATABASENAME \ @@ -183,7 +183,7 @@ { \ Pos = MAP_APPFONT (START_X , AUTO_Y + 2 ) ; \ Size = MAP_APPFONT ( EDIT_X - START_X - UNRELATED_CONTROLS , FIXEDTEXT_HEIGHT ); \ - Text [ en-US ] = "Server ~URL" ; \ + Text [ en-US ] = "Server" ; \ }; \ \ Edit ET_AUTOHOSTNAME \ @@ -229,10 +229,11 @@ NumericField NF_AUTOPORTNUMBER \ { \ HelpId = AUTO_HID ; \ - Pos = MAP_APPFONT (EDIT_X, AUTO_Y ) ; \ + Pos = MAP_APPFONT (EDIT_X, AUTO_Y ) ; \ Size = MAP_APPFONT ( 22 , EDIT_HEIGHT ) ; \ TabStop = TRUE ; \ Border = TRUE ; \ + NoThousandSep = TRUE; \ }; \ \ FixedText FT_AUTOPORTNUMBERDEFAULT \ @@ -455,11 +456,6 @@ // -------------------------------------------------------------------------------------------------- -#define AUTO_HELP_NAMECONTROLGROUP(AUTO_LINECOUNT, AUTO_HID ) \ - AUTO_WIZARDHELPTEXT(AUTO_LINECOUNT ) \ - AUTO_NAMECONTROLGROUP(INIT_Y + AUTO_LINECOUNT * FIXEDTEXT_HEIGHT + 2, AUTO_HID) \ - - // -------------------------------------------------------------------------------------------------- #define AUTO_JDBCDRIVERCLASSGROUP(AUTO_Y, AUTO_HID) \ @@ -497,7 +493,7 @@ { \ Pos = MAP_APPFONT (START_X , AUTO_Y +2) ; \ Size = MAP_APPFONT ( EDIT_X - START_X - UNRELATED_CONTROLS , FIXEDTEXT_HEIGHT ) ; \ - Text = "Socket" ; \ + Text [ en-US ] = "Socket" ; \ }; \ \ Edit ET_SOCKET \ @@ -509,15 +505,15 @@ }; -#define AUTOHELP_JDBCCONTROLGROUP(AUTO_HID) \ - AUTO_HELP_NAMECONTROLGROUP(6, AUTO_HID ) \ +#define AUTOHELP_JDBCCONTROLGROUP( AUTO_HID ) \ + AUTO_WIZARDHELPTEXT( 6 ) \ + AUTO_NAMECONTROLGROUP( INIT_Y + 6 * FIXEDTEXT_HEIGHT + 2, AUTO_HID ) \ AUTO_HOSTCONTROLGROUP(96, AUTO_HID + 1) \ AUTO_PORTCONTROLGROUP(113, AUTO_HID + 2 ) \ - AUTO_SOCKETCONTROLGROUP(129) \ + AUTO_SOCKETCONTROLGROUP(129) \ AUTO_JDBCDRIVERCLASSGROUP(146, AUTO_HID + 3) - // -------------------------------------------------------------------------------------------------- #endif diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index cf472eae45f4..2e155dfb4572 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -108,7 +108,6 @@ #include <ucbhelper/commandenvironment.hxx> #include "finteraction.hxx" #include <connectivity/CommonTools.hxx> -#include <connectivity/DriversConfig.hxx> #include "dbaccess_helpid.hrc" #include <svtools/pathoptions.hxx> #include <svtools/roadmapwizard.hxx> @@ -240,19 +239,11 @@ DBG_NAME(OTextConnectionPageSetup) m_aETBaseDN.SetModifyHdl(getControlModifiedLink()); m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); m_aCBUseSSL.SetToggleHdl(getControlModifiedLink()); - // #98982# OJ - m_aNFPortNumber.SetUseThousandSep(sal_False); SetRoadmapStateValue(sal_False); FreeResource(); } // ----------------------------------------------------------------------- - /* OGenericAdministrationPage* ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet ) - { - return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) ); - }*/ - - // ----------------------------------------------------------------------- sal_Bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet& _rSet ) { sal_Bool bChangedSomething = sal_False; @@ -344,9 +335,9 @@ DBG_NAME(OMySQLIntroPageSetup) DBG_CTOR(OMySQLIntroPageSetup,NULL); SetControlFontWeight(&m_aFT_Headertext); + m_aRB_ODBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected)); m_aRB_JDBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected)); m_aRB_NATIVEDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected)); - m_aRB_JDBCDatabase.SetState(sal_True); FreeResource(); } @@ -367,17 +358,21 @@ DBG_NAME(OMySQLIntroPageSetup) // ----------------------------------------------------------------------- void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/) { + // show the "Connect directly" option only if the driver is installed DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION)); - if (pCollectionItem) - { - ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection(); - if ( pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"))).Len() ) - { - m_aRB_NATIVEDatabase.Show(); - m_aRB_JDBCDatabase.SetState(sal_False); - m_aRB_NATIVEDatabase.SetState(sal_True); - } - } + bool bHasMySQLNative = ( pCollectionItem != NULL ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" ); + if ( bHasMySQLNative ) + m_aRB_NATIVEDatabase.Show(); + + // if any of the options is checked, then there's nothing to do + if ( m_aRB_ODBCDatabase.IsChecked() || m_aRB_JDBCDatabase.IsChecked() || m_aRB_NATIVEDatabase.IsChecked() ) + return; + + // prefer "native" or "JDBC" + if ( bHasMySQLNative ) + m_aRB_NATIVEDatabase.Check(); + else + m_aRB_JDBCDatabase.Check(); } @@ -410,54 +405,79 @@ DBG_NAME(OMySQLIntroPageSetup) return VIA_ODBC; } + // ======================================================================= + // = MySQLNativeSetupPage + // ======================================================================= + // ----------------------------------------------------------------------- + MySQLNativeSetupPage::MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs ) + :OGenericAdministrationPage( _pParent, ModuleRes( PAGE_DBWIZARD_MYSQL_NATIVE ), _rCoreAttrs ) + ,m_aHeader ( this, ModuleRes( FT_SETUP_WIZARD_HEADER ) ) + ,m_aHelpText ( this, ModuleRes( FT_SETUP_WIZARD_HELP ) ) + ,m_aMySQLSettings ( *this, getControlModifiedLink() ) + { + SetControlFontWeight( &m_aHeader ); + + LayoutHelper::positionBelow( m_aHelpText, m_aMySQLSettings, UnrelatedControls, 0 ); + m_aMySQLSettings.Show(); + + SetRoadmapStateValue(sal_False); + FreeResource(); + } // ----------------------------------------------------------------------- - OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ) + OGenericAdministrationPage* MySQLNativeSetupPage::Create( Window* pParent, const SfxItemSet& _rAttrSet ) { - return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent, - PAGE_DBWIZARD_MYSQL_JDBC, - _rAttrSet, - DSID_MYSQL_PORTNUMBER , - STR_MYSQL_DEFAULT, - STR_MYSQLJDBC_HELPTEXT, - STR_MYSQLJDBC_HEADERTEXT, - STR_MYSQL_DRIVERCLASSTEXT) ); + return new MySQLNativeSetupPage( pParent, _rAttrSet ); } // ----------------------------------------------------------------------- - OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLNATIVETabPage( Window* pParent, const SfxItemSet& _rAttrSet ) + void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ) { - return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent, - PAGE_DBWIZARD_MYSQL_NATIVE, - _rAttrSet, - DSID_MYSQL_PORTNUMBER , - STR_MYSQL_DEFAULT, - STR_MYSQLJDBC_HELPTEXT, - STR_MYSQLJDBC_HEADERTEXT, - 0) ); + m_aMySQLSettings.fillControls( _rControlList ); } + // ----------------------------------------------------------------------- + void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList ) + { + _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHelpText ) ); + m_aMySQLSettings.fillWindows( _rControlList ); + } // ----------------------------------------------------------------------- - OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ) + sal_Bool MySQLNativeSetupPage::FillItemSet( SfxItemSet& _rSet ) { - return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent, - PAGE_DBWIZARD_ORACLE, - _rAttrSet, - DSID_ORACLE_PORTNUMBER, - STR_ORACLE_DEFAULT, - STR_ORACLE_HELPTEXT, - STR_ORACLE_HEADERTEXT, - STR_ORACLE_DRIVERCLASSTEXT) ); + return m_aMySQLSettings.FillItemSet( _rSet ); + } + + // ----------------------------------------------------------------------- + void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue ) + { + m_aMySQLSettings.implInitControls( _rSet ); + + OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue ); + + OnModified( NULL ); + } + + // ----------------------------------------------------------------------- + Link MySQLNativeSetupPage::getControlModifiedLink() + { + return LINK( this, MySQLNativeSetupPage, OnModified ); } + // ----------------------------------------------------------------------- + IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit ) + { + SetRoadmapStateValue( m_aMySQLSettings.canAdvance() ); + + return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit ); + } //======================================================================== //= OMySQLJDBCConnectionPageSetup //======================================================================== OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId) :OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs) - ,m_pFTHeaderText (NULL) ,m_aFTHelpText (this, ModuleRes(FT_AUTOWIZARDHELPTEXT)) ,m_aFTDatabasename (this, ModuleRes(FT_AUTODATABASENAME)) ,m_aETDatabasename (this, ModuleRes(ET_AUTODATABASENAME)) @@ -466,26 +486,12 @@ DBG_NAME(OMySQLIntroPageSetup) ,m_aFTPortNumber (this, ModuleRes(FT_AUTOPORTNUMBER)) ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT)) ,m_aNFPortNumber (this, ModuleRes(NF_AUTOPORTNUMBER)) - ,m_aFTSocket (this, ModuleRes(FT_SOCKET)) - ,m_aETSocket (this, ModuleRes(ET_SOCKET)) ,m_aFTDriverClass (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS)) ,m_aETDriverClass (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS)) ,m_aPBTestJavaDriver (this, ModuleRes(PB_AUTOTESTDRIVERCLASS)) ,m_nPortId(_nPortId) - ,m_bUseClass(true) { - if ( _nDriverClassId ) - m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId))); - else - { - m_bUseClass = false; - m_aFTDriverClass.Show(FALSE); - m_aPBTestJavaDriver.Show(FALSE); - m_aETDriverClass.Show(FALSE); - } - - m_aFTSocket.Show(_nResId == PAGE_DBWIZARD_MYSQL_NATIVE && !m_bUseClass); - m_aETSocket.Show(_nResId == PAGE_DBWIZARD_MYSQL_NATIVE && !m_bUseClass); + m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId))); m_aFTDefaultPortNumber.SetText(String(ModuleRes(_nDefaultPortResId))); String sHelpText = String(ModuleRes(_nHelpTextResId)); @@ -496,38 +502,56 @@ DBG_NAME(OMySQLIntroPageSetup) m_aETDatabasename.SetModifyHdl(getControlModifiedLink()); m_aETHostname.SetModifyHdl(getControlModifiedLink()); m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); - m_aETSocket.SetModifyHdl(getControlModifiedLink()); - if ( m_bUseClass ) - { - m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified)); - m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl)); - } + m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified)); + m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl)); - m_aNFPortNumber.SetUseThousandSep(sal_False); - if ( m_bUseClass ) + 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() ) { - 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()); - } + m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue()); } + SetRoadmapStateValue(sal_False); FreeResource(); } // ----------------------------------------------------------------------- + OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ) + { + return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent, + PAGE_DBWIZARD_MYSQL_JDBC, + _rAttrSet, + DSID_MYSQL_PORTNUMBER , + STR_MYSQL_DEFAULT, + STR_MYSQLJDBC_HELPTEXT, + STR_MYSQLJDBC_HEADERTEXT, + STR_MYSQL_DRIVERCLASSTEXT) ); + } + + // ----------------------------------------------------------------------- + OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ) + { + return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent, + PAGE_DBWIZARD_ORACLE, + _rAttrSet, + DSID_ORACLE_PORTNUMBER, + STR_ORACLE_DEFAULT, + STR_ORACLE_HELPTEXT, + STR_ORACLE_HEADERTEXT, + STR_ORACLE_DRIVERCLASSTEXT) ); + } + + // ----------------------------------------------------------------------- void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) { _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDatabasename)); _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass)); _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostname)); _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber)); - _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETSocket)); } // ----------------------------------------------------------------------- void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) @@ -537,21 +561,17 @@ DBG_NAME(OMySQLIntroPageSetup) _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname)); _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber)); _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber)); - _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket)); - if ( m_bUseClass ) - _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass)); + _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass)); } // ----------------------------------------------------------------------- sal_Bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet ) { sal_Bool bChangedSomething = sal_False; - if ( m_bUseClass ) - fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething); + fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething); fillString(_rSet,&m_aETHostname,DSID_CONN_HOSTNAME,bChangedSomething); fillString(_rSet,&m_aETDatabasename,DSID_DATABASENAME,bChangedSomething); fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething ); - fillString(_rSet,&m_aETSocket,DSID_CONN_SOCKET,bChangedSomething); return bChangedSomething; } @@ -562,42 +582,36 @@ DBG_NAME(OMySQLIntroPageSetup) sal_Bool bValid, bReadonly; getFlags(_rSet, bValid, bReadonly); - const SfxStringItem *pDrvItem = NULL; - if ( m_bUseClass ) - pDrvItem = (const SfxStringItem*) (_rSet).GetItem( DSID_JDBCDRIVERCLASS, sal_True, TYPE(SfxStringItem) ); - + SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True); + 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_aETDriverClass.SetText(pDrvItem->GetValue()); - m_aETDriverClass.ClearModifyFlag(); - } + m_aETDatabasename.SetText(pDatabaseName->GetValue()); + m_aETDatabasename.ClearModifyFlag(); + + m_aETDriverClass.SetText(pDrvItem->GetValue()); + m_aETDriverClass.ClearModifyFlag(); m_aETHostname.SetText(pHostName->GetValue()); m_aETHostname.ClearModifyFlag(); m_aNFPortNumber.SetValue(pPortNumber->GetValue()); m_aNFPortNumber.ClearModifyFlag(); - - m_aETSocket.SetText(pSocket->GetValue()); - m_aETSocket.ClearModifyFlag(); } OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); // to get the correct value when saveValue was called by base class - if ( m_bUseClass && !m_aETDriverClass.GetText().Len() ) + if ( !m_aETDriverClass.GetText().Len() ) { m_aETDriverClass.SetText(m_sDefaultJdbcDriverName); m_aETDriverClass.SetModifyFlag(); } callModifiedHdl(); - sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( !m_bUseClass || m_aETDriverClass.GetText().Len() != 0 )); + sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 )); SetRoadmapStateValue(bRoadmapState); } @@ -605,7 +619,6 @@ DBG_NAME(OMySQLIntroPageSetup) IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/) { OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); - OSL_ENSURE(m_bUseClass,"Who called this one?"); sal_Bool bSuccess = sal_False; try @@ -630,15 +643,14 @@ DBG_NAME(OMySQLIntroPageSetup) // ----------------------------------------------------------------------- IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit) { - if ( m_bUseClass && _pEdit == &m_aETDriverClass ) + if ( _pEdit == &m_aETDriverClass ) m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 ); - sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( !m_bUseClass || m_aETDriverClass.GetText().Len() != 0 )); + sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 )); SetRoadmapStateValue(bRoadmapState); callModifiedHdl(); return 0L; } - // ----------------------------------------------------------------------- OGenericAdministrationPage* OJDBCConnectionPageSetup::CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ) { diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index 0bbd3cbf729c..4e7152ac023f 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -35,24 +35,14 @@ #include "ConnectionPageSetup.hxx" #endif -#ifndef _DBAUI_ADMINPAGES_HXX_ #include "adminpages.hxx" -#endif -#ifndef _UCBHELPER_CONTENT_HXX -#include <ucbhelper/content.hxx> -#endif -#ifndef _DBAUI_CURLEDIT_HXX_ +#include "admincontrols.hxx" #include "curledit.hxx" -#endif -#ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX +#include "TextConnectionHelper.hxx" + #include <svtools/roadmapwizard.hxx> -#endif -#ifndef _SV_FIELD_HXX +#include <ucbhelper/content.hxx> #include <vcl/field.hxx> -#endif -#ifndef DBAUI_TEXTCONNECTIONHELPER_HXX -#include "TextConnectionHelper.hxx" -#endif //......................................................................... @@ -140,6 +130,33 @@ namespace dbaui CheckBox m_aCBUseSSL; }; + //======================================================================== + //= MySQLNativeSetupPage + //======================================================================== + class MySQLNativeSetupPage : public OGenericAdministrationPage + { + private: + FixedText m_aHeader; + FixedText m_aHelpText; + MySQLNativeSettings m_aMySQLSettings; + + public: + MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs ); + + static OGenericAdministrationPage* Create( Window* pParent, const SfxItemSet& _rAttrSet ); + + protected: + virtual void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ); + virtual void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList ); + + virtual BOOL FillItemSet( SfxItemSet& _rCoreAttrs ); + virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); + + virtual Link getControlModifiedLink(); + + private: + DECL_LINK( OnModified, Edit* ); + }; //======================================================================== //= OGeneralSpecialJDBCConnectionPageSetup @@ -156,22 +173,17 @@ namespace dbaui , USHORT _nHeaderTextResId , USHORT _nDriverClassId ); static OGenericAdministrationPage* CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); - static OGenericAdministrationPage* CreateMySQLNATIVETabPage( Window* pParent, const SfxItemSet& _rAttrSet ); static OGenericAdministrationPage* CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet ); - virtual Link getControlModifiedLink() { return LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified); } - protected: - - virtual BOOL FillItemSet( SfxItemSet& _rCoreAttrs ); virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); + virtual Link getControlModifiedLink() { return LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified); } DECL_LINK(OnTestJavaClickHdl,PushButton*); DECL_LINK(OnEditModified,Edit*); - FixedText* m_pFTHeaderText; FixedText m_aFTHelpText; FixedText m_aFTDatabasename; Edit m_aETDatabasename; @@ -180,8 +192,6 @@ namespace dbaui FixedText m_aFTPortNumber; FixedText m_aFTDefaultPortNumber; NumericField m_aNFPortNumber; - FixedText m_aFTSocket; - Edit m_aETSocket; FixedText m_aFTDriverClass; @@ -190,7 +200,6 @@ namespace dbaui String m_sDefaultJdbcDriverName; USHORT m_nPortId; - bool m_bUseClass; }; diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 4390cc6b8dc4..28a9b83fca35 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -240,6 +240,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_INDEXAPPENDIX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AddIndexAppendix")))); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_DOSLINEENDS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferDosLikeLineEnds" ) ) ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CONN_SOCKET, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalSocket" ) ) ) ); + m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_NAMED_PIPE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NamedPipe" ) ) ) ); // special settings for adabas m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CONN_SHUTSERVICE, ::rtl::OUString::createFromAscii("ShutdownDatabase"))); diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx index 4c66109d50e2..cf5d2edd65fc 100644 --- a/dbaccess/source/ui/dlg/DriverSettings.cxx +++ b/dbaccess/source/ui/dlg/DriverSettings.cxx @@ -36,11 +36,18 @@ #include "datasourceui.hxx" #include <connectivity/DriversConfig.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/NamedValue.hpp> + +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::beans::NamedValue; + using namespace dbaui; void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory, ::std::vector< sal_Int32>& _out_rDetailsIds ) { // for a number of settings, we do not need to use hard-coded here, but can ask a // central DataSourceUI instance. + // TODO: isn't DataSourceUI obsolete, now that this is in the configuration? DataSourceMetaData aMeta(_sURLPrefix); DataSourceUI aDSUI( aMeta ); const USHORT nGenericKnownSettings[] = @@ -67,9 +74,23 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR if ( aDSUI.hasSetting( *pGenericKnowSetting ) ) _out_rDetailsIds.push_back( *pGenericKnowSetting ); - // the rest is hard-coded. On the long run, all of this should be done via DataSourceUI::hasSetting + // the rest is configuration-based ::connectivity::DriversConfig aDriverConfig(_xFactory); const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix); +#if OSL_DEBUG_LEVEL > 0 + { + Sequence< NamedValue > aNamedValues; + aProperties >>= aNamedValues; + for ( const NamedValue* loop = aNamedValues.getConstArray(); + loop != aNamedValues.getConstArray() + aNamedValues.getLength(); + ++loop + ) + { + int dummy = 0; + (void)dummy; + } + } +#endif typedef ::std::pair<USHORT, ::rtl::OUString> TProperties; TProperties aProps[] = { TProperties(DSID_SHOWDELETEDROWS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted"))) ,TProperties(DSID_CHARSET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet"))) @@ -87,6 +108,7 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR ,TProperties(DSID_CONN_CTRLPWD,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword"))) ,TProperties(DSID_USECATALOG,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog"))) ,TProperties(DSID_CONN_SOCKET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalSocket"))) + ,TProperties(DSID_NAMED_PIPE,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedPipe"))) ,TProperties(DSID_JDBCDRIVERCLASS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))) ,TProperties(DSID_CONN_LDAP_BASEDN,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN"))) ,TProperties(DSID_CONN_LDAP_ROWCOUNT,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount"))) @@ -94,6 +116,8 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR ,TProperties(DSID_IGNORECURRENCY,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency"))) ,TProperties(0,::rtl::OUString()) }; + // TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper. + // We should not duplicate it here. for ( TProperties* pProps = aProps; pProps->first; ++pProps ) { if ( aProperties.has(pProps->second) ) diff --git a/dbaccess/source/ui/dlg/admincontrols.cxx b/dbaccess/source/ui/dlg/admincontrols.cxx new file mode 100755 index 000000000000..8af119b127b0 --- /dev/null +++ b/dbaccess/source/ui/dlg/admincontrols.cxx @@ -0,0 +1,310 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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 "admincontrols.hxx" +#include "admincontrols.hrc" +#include "dbu_dlg.hrc" +#include "dsitems.hxx" +#include "moduledbu.hxx" + +#include <svtools/eitem.hxx> +#include <svtools/stritem.hxx> +#include <svtools/intitem.hxx> + +//........................................................................ +namespace dbaui +{ +//........................................................................ + + //==================================================================== + //= TextResetOperatorEventFilter + //==================================================================== + class TextResetOperatorEventFilter : public ::svt::IWindowEventFilter + { + public: + TextResetOperatorEventFilter() + { + } + + // IWindowEventFilter + virtual bool payAttentionTo( const VclWindowEvent& _rEvent ) const + { + return ( _rEvent.GetId() == VCLEVENT_WINDOW_ENABLED ) + || ( _rEvent.GetId() == VCLEVENT_WINDOW_DISABLED ) + || ( _rEvent.GetId() == VCLEVENT_EDIT_MODIFY ); + } + }; + + //==================================================================== + //= TextResetOperator + //==================================================================== + class TextResetOperator :public ::svt::IWindowOperator + { + public: + TextResetOperator( const String& _rDisabledText ) + :m_sDisabledText( _rDisabledText ) + { + } + + // IWindowOperator + virtual void operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const; + + private: + const String m_sDisabledText; + String m_sUserText; + BOOL m_bLastKnownEnabledState; + }; + + //-------------------------------------------------------------------- + void TextResetOperator::operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const + { + OSL_ENSURE( _rTrigger.GetWindow() == &_rOperateOn, "TextResetOperator::operateOn: you're misusing this implementation!" ); + + switch ( _rTrigger.GetId() ) + { + case 0: + // initial call + const_cast< TextResetOperator* >( this )->m_sUserText = _rTrigger.GetWindow()->GetText(); + break; + + case VCLEVENT_EDIT_MODIFY: + if ( _rTrigger.GetWindow()->IsEnabled() ) + const_cast< TextResetOperator* >( this )->m_sUserText = _rTrigger.GetWindow()->GetText(); + break; + + case VCLEVENT_WINDOW_ENABLED: + _rOperateOn.SetText( m_sUserText ); + break; + + case VCLEVENT_WINDOW_DISABLED: + _rOperateOn.SetText( m_sDisabledText ); + break; + + default: + OSL_ENSURE( false, "TextResetOperator::operateOn: unexpected event ID!" ); + // all those IDs should have been filtered out by payAttentionTo + break; + } + } + + //==================================================================== + //= TextResetOperatorController + //==================================================================== + class TextResetOperatorController_Base + { + protected: + TextResetOperatorController_Base( const String& _rDisabledText ) + :m_pEventFilter( new TextResetOperatorEventFilter ) + ,m_pOperator( new TextResetOperator( _rDisabledText ) ) + { + } + + inline ::svt::PWindowEventFilter getEventFilter() const { return m_pEventFilter; } + inline ::svt::PWindowOperator getOperator() const { return m_pOperator; } + + private: + ::svt::PWindowEventFilter m_pEventFilter; + ::svt::PWindowOperator m_pOperator; + }; + + class TextResetOperatorController :public TextResetOperatorController_Base + ,public ::svt::DialogController + { + public: + TextResetOperatorController( Window& _rObservee, const String& _rDisabledText ) + :TextResetOperatorController_Base( _rDisabledText ) + ,::svt::DialogController( _rObservee, getEventFilter(), getOperator() ) + { + addDependentWindow( _rObservee ); + } + }; + + //==================================================================== + //= MySQLNativeSettings + //==================================================================== + //-------------------------------------------------------------------- + MySQLNativeSettings::MySQLNativeSettings( Window& _rParent, const Link& _rControlModificationLink ) + :Control( &_rParent, ModuleRes( RID_MYSQL_NATIVE_SETTINGS ).SetAutoRelease( FALSE ) ) + ,m_aDatabaseNameLabel ( this, ModuleRes( FT_MYSQL_DATABASE_NAME ) ) + ,m_aDatabaseName ( this, ModuleRes( ED_MYSQL_DATABASE_NAME ) ) + ,m_aHostPortRadio ( this, ModuleRes( RB_MYSQL_HOST_PORT ) ) + ,m_aSocketRadio ( this, ModuleRes( RB_MYSQL_SOCKET ) ) + ,m_aNamedPipeRadio ( this, ModuleRes( RB_MYSQL_NAMED_PIPE ) ) + ,m_aHostNameLabel ( this, ModuleRes( FT_COMMON_HOST_NAME ) ) + ,m_aHostName ( this, ModuleRes( ED_COMMON_HOST_NAME ) ) + ,m_aPortLabel ( this, ModuleRes( FT_COMMON_PORT ) ) + ,m_aPort ( this, ModuleRes( NF_COMMON_PORT ) ) + ,m_aDefaultPort ( this, ModuleRes( FT_COMMON_PORT_DEFAULT ) ) + ,m_aSocket ( this, ModuleRes( ED_MYSQL_SOCKET ) ) + ,m_aNamedPipe ( this, ModuleRes( ED_MYSQL_NAMED_PIPE ) ) + { + FreeResource(); + + m_aDatabaseName.SetModifyHdl( _rControlModificationLink ); + m_aHostName.SetModifyHdl( _rControlModificationLink ); + m_aPort.SetModifyHdl( _rControlModificationLink ); + m_aNamedPipe.SetModifyHdl( _rControlModificationLink ); + m_aSocketRadio.SetToggleHdl( _rControlModificationLink ); + m_aNamedPipeRadio.SetToggleHdl( _rControlModificationLink ); + + m_aControlDependencies.enableOnRadioCheck( m_aHostPortRadio, m_aHostNameLabel, m_aHostName, m_aPortLabel, m_aPort, m_aDefaultPort ); + m_aControlDependencies.enableOnRadioCheck( m_aSocketRadio, m_aSocket ); + m_aControlDependencies.enableOnRadioCheck( m_aNamedPipeRadio, m_aNamedPipe ); + + m_aControlDependencies.addController( ::svt::PDialogController( + new TextResetOperatorController( m_aHostName, String::CreateFromAscii( "localhost" ) ) + ) ); + + // sockets are available on Unix systems only, named pipes only on Windows +#ifdef UNX + m_aNamedPipeRadio.Hide(); + m_aNamedPipe.Hide(); +#else + m_aSocketRadio.Hide(); + m_aSocket.Hide(); +#endif + } + + //-------------------------------------------------------------------- + MySQLNativeSettings::~MySQLNativeSettings() + { + } + + //-------------------------------------------------------------------- + void MySQLNativeSettings::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ) + { + _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aDatabaseName ) ); + _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aHostName ) ); + _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aPort ) ); + _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aSocket ) ); + _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aNamedPipe ) ); + } + + //-------------------------------------------------------------------- + void MySQLNativeSettings::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList ) + { + _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aDatabaseNameLabel ) ); + _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHostNameLabel ) ); + _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aPortLabel ) ); + _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aDefaultPort ) ); + _rControlList.push_back( new ODisableWrapper< RadioButton >( &m_aSocketRadio ) ); + _rControlList.push_back( new ODisableWrapper< RadioButton >( &m_aNamedPipeRadio ) ); + } + + //-------------------------------------------------------------------- + BOOL MySQLNativeSettings::FillItemSet( SfxItemSet& _rSet ) + { + sal_Bool bChangedSomething = sal_False; + + OGenericAdministrationPage::fillString( _rSet, &m_aHostName, DSID_CONN_HOSTNAME, bChangedSomething ); + OGenericAdministrationPage::fillString( _rSet, &m_aDatabaseName, DSID_DATABASENAME, bChangedSomething ); + OGenericAdministrationPage::fillInt32 ( _rSet, &m_aPort, DSID_MYSQL_PORTNUMBER, bChangedSomething ); +#ifdef UNX + OGenericAdministrationPage::fillString( _rSet, &m_aSocket, DSID_CONN_SOCKET, bChangedSomething ); +#else + OGenericAdministrationPage::fillString( _rSet, &m_aNamedPipe, DSID_NAMED_PIPE, bChangedSomething ); +#endif + + return bChangedSomething; + } + + //-------------------------------------------------------------------- + void MySQLNativeSettings::implInitControls(const SfxItemSet& _rSet ) + { + SFX_ITEMSET_GET( _rSet, pInvalid, SfxBoolItem, DSID_INVALID_SELECTION, sal_True ); + bool bValid = !pInvalid || !pInvalid->GetValue(); + if ( !bValid ) + return; + + SFX_ITEMSET_GET( _rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True ); + SFX_ITEMSET_GET( _rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True ); + SFX_ITEMSET_GET( _rSet, pPortNumber, SfxInt32Item, DSID_MYSQL_PORTNUMBER, sal_True ); + SFX_ITEMSET_GET( _rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True ); + SFX_ITEMSET_GET( _rSet, pNamedPipe, SfxStringItem, DSID_NAMED_PIPE, sal_True ); + + m_aDatabaseName.SetText( pDatabaseName->GetValue() ); + m_aDatabaseName.ClearModifyFlag(); + + m_aHostName.SetText( pHostName->GetValue() ); + m_aHostName.ClearModifyFlag(); + + m_aPort.SetValue( pPortNumber->GetValue() ); + m_aPort.ClearModifyFlag(); + + m_aSocket.SetText( pSocket->GetValue() ); + m_aSocket.ClearModifyFlag(); + + m_aNamedPipe.SetText( pNamedPipe->GetValue() ); + m_aNamedPipe.ClearModifyFlag(); + + // if a socket (on Unix) or a pipe name (on Windows) is given, this is preferred over + // the port +#ifdef UNX + RadioButton& rSocketPipeRadio = m_aSocketRadio; + const SfxStringItem* pSocketPipeItem = pSocket; +#else + RadioButton& rSocketPipeRadio = m_aNamedPipeRadio; + const SfxStringItem* pSocketPipeItem = pNamedPipe; +#endif + String sSocketPipe( pSocketPipeItem->GetValue() ); + if ( sSocketPipe.Len() > 0 ) + rSocketPipeRadio.Check(); + else + m_aHostPortRadio.Check(); + } + + //-------------------------------------------------------------------- + bool MySQLNativeSettings::canAdvance() const + { + if ( m_aDatabaseName.GetText().Len() == 0 ) + return false; + + if ( m_aHostPortRadio.IsChecked() + && ( ( m_aHostName.GetText().Len() == 0 ) + || ( m_aPort.GetText().Len() == 0 ) + ) + ) + return false; + +#ifdef UNX + if ( ( m_aSocketRadio.IsChecked() ) + && ( m_aSocket.GetText().Len() == 0 ) + ) +#else + if ( ( m_aNamedPipeRadio.IsChecked() ) + && ( m_aNamedPipe.GetText().Len() == 0 ) + ) +#endif + return false; + + return true; + } + +//........................................................................ +} // namespace dbaui +//........................................................................ diff --git a/dbaccess/source/ui/dlg/admincontrols.hrc b/dbaccess/source/ui/dlg/admincontrols.hrc new file mode 100755 index 000000000000..fea66a9e1e42 --- /dev/null +++ b/dbaccess/source/ui/dlg/admincontrols.hrc @@ -0,0 +1,48 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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. +************************************************************************/ +
+#ifndef ADMINCONTROLS_HRC
+#define ADMINCONTROLS_HRC
+
+#define FT_MYSQL_DATABASE_NAME 1 +#define FT_COMMON_HOST_NAME 2 +#define FT_COMMON_PORT_DEFAULT 3 +#define FT_COMMON_PORT 4 + + +#define RB_MYSQL_HOST_PORT 1 +#define RB_MYSQL_SOCKET 2 +#define RB_MYSQL_NAMED_PIPE 3 + + +#define ED_MYSQL_DATABASE_NAME 1 +#define ED_MYSQL_SOCKET 2 +#define ED_COMMON_HOST_NAME 3 +#define ED_MYSQL_NAMED_PIPE 4 + + +#define NF_COMMON_PORT 1 + +#endif // ADMINCONTROLS_HRC diff --git a/dbaccess/source/ui/dlg/admincontrols.hxx b/dbaccess/source/ui/dlg/admincontrols.hxx new file mode 100755 index 000000000000..c59afbf4c308 --- /dev/null +++ b/dbaccess/source/ui/dlg/admincontrols.hxx @@ -0,0 +1,81 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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. +************************************************************************/ +
+#ifndef DBACCESS_ADMINCONTROLS_HXX +#define DBACCESS_ADMINCONTROLS_HXX + +#include "adminpages.hxx" + +#include <vcl/edit.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> + +#include <svtools/dialogcontrolling.hxx> + +//........................................................................ +namespace dbaui +{ +//........................................................................ + + //==================================================================== + //= MySQLNativeSettings + //==================================================================== + class MySQLNativeSettings : public Control + { + private: + FixedText m_aDatabaseNameLabel; + Edit m_aDatabaseName; + RadioButton m_aHostPortRadio; + RadioButton m_aSocketRadio; + RadioButton m_aNamedPipeRadio; + FixedText m_aHostNameLabel; + Edit m_aHostName; + FixedText m_aPortLabel; + NumericField m_aPort; + FixedText m_aDefaultPort; + Edit m_aSocket; + Edit m_aNamedPipe; + + ::svt::ControlDependencyManager + m_aControlDependencies; + + public: + MySQLNativeSettings( Window& _rParent, const Link& _rControlModificationLink ); + ~MySQLNativeSettings(); + + void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ); + void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList ); + + BOOL FillItemSet( SfxItemSet& _rCoreAttrs ); + void implInitControls( const SfxItemSet& _rSet ); + + bool canAdvance() const; + }; + +//........................................................................ +} // namespace dbaui +//........................................................................ + +#endif // DBACCESS_ADMINCONTROLS_HXX diff --git a/dbaccess/source/ui/dlg/admincontrols.src b/dbaccess/source/ui/dlg/admincontrols.src new file mode 100755 index 000000000000..ac0cff8d5508 --- /dev/null +++ b/dbaccess/source/ui/dlg/admincontrols.src @@ -0,0 +1,130 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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. +************************************************************************/ +
+#include "AutoControls.hrc" +#include "dbu_dlg.hrc" +#include "admincontrols.hrc" + +#define LINE_HEIGHT ( EDIT_HEIGHT + RELATED_CONTROLS ) +#define SETTINGS_CONTROL_WIDTH ( WIZARD_PAGE_X - 2 * START_X ) +#define COLUMN_WIDTH_1 80 +#define COLUMN_WIDTH_2 ( SETTINGS_CONTROL_WIDTH - COLUMN_WIDTH_1 ) + +Control RID_MYSQL_NATIVE_SETTINGS +{ + DialogControl = TRUE; + Size = MAP_APPFONT( SETTINGS_CONTROL_WIDTH, 5 * LINE_HEIGHT ); + Hide = FALSE; + + FixedText FT_MYSQL_DATABASE_NAME + { + Pos = MAP_APPFONT ( 0, 2 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_1 - UNRELATED_CONTROLS, FIXEDTEXT_HEIGHT ); + Text[ en-US ] = "~Database name"; + }; + + Edit ED_MYSQL_DATABASE_NAME + { + Pos = MAP_APPFONT ( COLUMN_WIDTH_1, 0 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT ); + Border = TRUE; + }; + + RadioButton RB_MYSQL_HOST_PORT + { + Pos = MAP_APPFONT ( 0, LINE_HEIGHT ); + Size = MAP_APPFONT ( COLUMN_WIDTH_1, FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "Se~rver / Port" ; + Group = TRUE; + }; + +#define OPTION_GROUP_START ( LINE_HEIGHT + FIXEDTEXT_HEIGHT + RELATED_CONTROLS ) + + FixedText FT_COMMON_HOST_NAME + { + Pos = MAP_APPFONT ( INDENT_BELOW_RADIO, OPTION_GROUP_START + 2 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS - INDENT_BELOW_RADIO, FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "~Server" ; + }; + + Edit ED_COMMON_HOST_NAME + { + Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START ); + Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT ); + Border = TRUE; + }; + + FixedText FT_COMMON_PORT + { + Pos = MAP_APPFONT ( INDENT_BELOW_RADIO, OPTION_GROUP_START + LINE_HEIGHT + 2 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS - INDENT_BELOW_RADIO, FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "~Port" ; + Group = TRUE; + }; + + NumericField NF_COMMON_PORT + { + Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START + LINE_HEIGHT ); + Size = MAP_APPFONT ( 25, EDIT_HEIGHT ); + Border = TRUE; + NoThousandSep = TRUE; + Value = 3306; + }; + + FixedText FT_COMMON_PORT_DEFAULT + { + Pos = MAP_APPFONT ( COLUMN_WIDTH_1 + 25 + RELATED_CONTROLS, OPTION_GROUP_START + LINE_HEIGHT + 2 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_2 - 25 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT ); + Text[ en-US ] = "Default: 3306"; + }; + + RadioButton RB_MYSQL_SOCKET + { + Pos = MAP_APPFONT ( 0, OPTION_GROUP_START + 2 * LINE_HEIGHT + 2 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "So~cket"; + }; + + Edit ED_MYSQL_SOCKET + { + Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START + 2 * LINE_HEIGHT ); + Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT ); + Border = TRUE ; + }; + + RadioButton RB_MYSQL_NAMED_PIPE + { + Pos = MAP_APPFONT ( 0, OPTION_GROUP_START + 2 * LINE_HEIGHT + 2 ); + Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Named p~ipe"; + }; + + Edit ED_MYSQL_NAMED_PIPE + { + Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START + 2 * LINE_HEIGHT ); + Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT ); + Border = TRUE ; + }; +}; diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index 5b4d38dee215..c67d34311147 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -339,16 +339,22 @@ namespace dbaui } - Point OGenericAdministrationPage::MovePoint(Point _aPixelBasePoint, sal_Int32 _XShift, sal_Int32 _YShift) + //========================================================================= + //= LayoutHelper + //========================================================================= + //------------------------------------------------------------------------- + void LayoutHelper::positionBelow( const Control& _rReference, Control& _rControl, const ControlRelation _eRelation, + const long _nIndentAppFont ) { - Point rLogicPoint = PixelToLogic( _aPixelBasePoint, MAP_APPFONT ); - sal_uInt32 XPos = rLogicPoint.X() + _XShift; - sal_uInt32 YPos = rLogicPoint.Y() + _YShift; - Point aNewPixelPoint = LogicToPixel(Point(XPos, YPos), MAP_APPFONT); - return aNewPixelPoint; - } + Point aReference = _rReference.GetPosPixel(); + aReference.Y() += _rReference.GetSizePixel().Height(); + const Window* pConverter = _rControl.GetParent(); + Size aOffset = pConverter->LogicToPixel( Size( _nIndentAppFont, ( _eRelation == RelatedControls ? 3 : 6 ) ), MAP_APPFONT ); + Point aControlPos( aReference.X() + aOffset.Width(), aReference.Y() + aOffset.Height() ); + _rControl.SetPosPixel( aControlPos ); + } //......................................................................... } // namespace dbaui diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx index d59ae3af8052..a32298a448d8 100644 --- a/dbaccess/source/ui/dlg/adminpages.hxx +++ b/dbaccess/source/ui/dlg/adminpages.hxx @@ -215,6 +215,7 @@ namespace dbaui */ virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) = 0; + public: /** fills the Boolean value into the item set when the value changed. @param _rSet The item set where to put the new value into. @@ -227,7 +228,7 @@ namespace dbaui @param _bRevertValue set to <TRUE/> if the display value should be reverted before putting it into the set */ - void fillBool( SfxItemSet& _rSet, CheckBox* _pCheckBox, USHORT _nID, sal_Bool& _bChangedSomething, bool _bRevertValue = false); + static void fillBool( SfxItemSet& _rSet, CheckBox* _pCheckBox, USHORT _nID, sal_Bool& _bChangedSomething, bool _bRevertValue = false); /** fills the int value into the item set when the value changed. @param _rSet @@ -239,7 +240,7 @@ namespace dbaui @param _bChangedSomething <TRUE/> if something changed otherwise <FALSE/> */ - void fillInt32(SfxItemSet& _rSet,NumericField* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething); + static void fillInt32(SfxItemSet& _rSet,NumericField* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething); /** fills the String value into the item set when the value changed. @param _rSet @@ -251,16 +252,13 @@ namespace dbaui @param _bChangedSomething <TRUE/> if something changed otherwise <FALSE/> */ - void fillString(SfxItemSet& _rSet,Edit* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething); + static void fillString(SfxItemSet& _rSet,Edit* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething); + protected: // used to set the right Pane header of a wizard to bold void SetControlFontWeight(Window* _pWindow, FontWeight _eWeight = WEIGHT_BOLD); void SetHeaderText( USHORT _nFTResId, USHORT _StringResId); - Point MovePoint(Point _aPixelBasePoint, sal_Int32 _XShift, sal_Int32 _YShift); - - - protected: /** This link be used for controls where the tabpage does not need to take any special action when the control is modified. The implementation just calls callModifiedHdl. */ @@ -271,6 +269,28 @@ namespace dbaui virtual Link getControlModifiedLink() { return LINK(this, OGenericAdministrationPage, OnControlModified); } }; + //========================================================================= + //= ControlRelation + //========================================================================= + enum ControlRelation + { + RelatedControls, UnrelatedControls + }; + + //========================================================================= + //= LayoutHelper + //========================================================================= + class LayoutHelper + { + public: + static void positionBelow( + const Control& _rReference, + Control& _rControl, + const ControlRelation _eRelation, + const long _nIndentAppFont + ); + }; + //......................................................................... } // namespace dbaui //......................................................................... diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 4eefb05b7f89..7aa91ef8ce2c 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -450,6 +450,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, sal_False); *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, String()); *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True); // must be the same as in ModelImpl.cxx + *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String()); // create the pool static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = @@ -510,6 +511,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0}, {0,0}, {0,0}, /* for Escape DateTime*/ + {0,0}, {0,0} }; diff --git a/dbaccess/source/ui/dlg/dbadmin.src b/dbaccess/source/ui/dlg/dbadmin.src index 23143193a355..38e1db322a30 100644 --- a/dbaccess/source/ui/dlg/dbadmin.src +++ b/dbaccess/source/ui/dlg/dbadmin.src @@ -46,6 +46,7 @@ #ifndef DBAUI_ADABASPAGE_HRC #include "AdabasPage.hrc" #endif +#include "admincontrols.hrc" //------------------------------------------------------------------------- @@ -72,7 +73,7 @@ #define AUTO_HOST_AND_PORT(AUTO_Y) \ FixedText FT_HOSTNAME \ { \ - Pos = MAP_APPFONT ( 6 , AUTO_Y ) ; \ + Pos = MAP_APPFONT ( 6 , AUTO_Y + 2 ) ; \ Size = MAP_APPFONT ( EDIT_X - 7 , FIXEDTEXT_HEIGHT ) ; \ Text[ en-US ] = "~Host name"; \ }; \ @@ -81,13 +82,13 @@ TabStop = TRUE ; \ Border = TRUE ; \ HelpId = HID_DSADMIN_HOSTNAME; \ - Pos = MAP_APPFONT ( EDIT_X , AUTO_Y - 1 ) ; \ + Pos = MAP_APPFONT ( EDIT_X , AUTO_Y ) ; \ Size = MAP_APPFONT ( 97 , EDIT_HEIGHT ) ; \ }; \ \ FixedText FT_PORTNUMBER \ { \ - Pos = MAP_APPFONT ( 6 , AUTO_Y + UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT ) ; \ + Pos = MAP_APPFONT ( 6 , AUTO_Y + UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT + 2 ) ; \ Size = MAP_APPFONT ( EDIT_X - 7 , FIXEDTEXT_HEIGHT ) ; \ Text[ en-US ] = "~Port number"; \ }; \ @@ -96,7 +97,8 @@ TabStop = TRUE ; \ Border = TRUE ; \ HelpId = HID_DSADMIN_PORTNUMBER; \ - Pos = MAP_APPFONT ( EDIT_X , AUTO_Y +UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT -1 ) ; \ + NoThousandSep = TRUE; \ + Pos = MAP_APPFONT ( EDIT_X , AUTO_Y +UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT ) ; \ Size = MAP_APPFONT ( 97 , EDIT_HEIGHT ) ; \ }; //------------------------------------------------------------------------- @@ -158,7 +160,7 @@ ModalDialog DLG_DATABASE_TYPE_CHANGE TabPage PAGE_GENERAL { SVLook = TRUE ; - Size = MAP_APPFONT ( PAGE_X , PAGE_Y ) ; + Size = MAP_APPFONT ( WIZARD_PAGE_X , WIZARD_PAGE_Y ) ; Hide = TRUE; HelpId = HID_DSADMIN_PAGE_GENERAL; @@ -571,37 +573,34 @@ TabPage PAGE_MYSQL_NATIVE Hide = TRUE; AUTO_FIXEDLINE_CONNSETTINGS( UNRELATED_CONTROLS ) - AUTO_NAMECONTROLGROUP( UNRELATED_CONTROLS + RELATED_CONTROLS + FIXEDTEXT_HEIGHT, HID_PAGE_DBWIZARD_JDBC_ET_MYSQLDBNAME ) - AUTO_HOST_AND_PORT( UNRELATED_CONTROLS + 2*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + EDIT_HEIGHT ) - AUTO_SOCKETCONTROLGROUP(3*UNRELATED_CONTROLS + 2*RELATED_CONTROLS + 3*FIXEDTEXT_HEIGHT + EDIT_HEIGHT ) FixedLine FL_SEPARATOR2 { - Pos = MAP_APPFONT ( 3 , 4*UNRELATED_CONTROLS + 2*RELATED_CONTROLS + 3*FIXEDTEXT_HEIGHT + 2*EDIT_HEIGHT ) ; + Pos = MAP_APPFONT ( 3 , 4*UNRELATED_CONTROLS + 3*RELATED_CONTROLS + 3*FIXEDTEXT_HEIGHT + 3*EDIT_HEIGHT ) ; Size = MAP_APPFONT ( PAGE_X - 6, FIXEDTEXT_HEIGHT ) ; Text[ en-US ] = "User authentication"; }; FixedText FT_USERNAME { - Pos = MAP_APPFONT ( 6 , 4*UNRELATED_CONTROLS + 3*RELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT + 2*EDIT_HEIGHT ) ; + Pos = MAP_APPFONT ( 6 , 4*UNRELATED_CONTROLS + 4*RELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT + 3*EDIT_HEIGHT ) ; Size = MAP_APPFONT ( EDIT_X - 6 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT ) ; Text [ en-US ] = "~User name" ; }; Edit ET_USERNAME { Border = TRUE ; - Pos = MAP_APPFONT ( EDIT_X, 4*UNRELATED_CONTROLS + 3*RELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT + 2*EDIT_HEIGHT - 1 ) ; + Pos = MAP_APPFONT ( EDIT_X, 4*UNRELATED_CONTROLS + 4*RELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT + 3*EDIT_HEIGHT - 1 ) ; Size = MAP_APPFONT ( 105 , EDIT_HEIGHT ) ; TabStop = TRUE ; }; CheckBox CB_PASSWORD_REQUIRED { - Pos = MAP_APPFONT ( EDIT_X, 4*UNRELATED_CONTROLS + 4*RELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT + 3*EDIT_HEIGHT ) ; + Pos = MAP_APPFONT ( EDIT_X, 4*UNRELATED_CONTROLS + 5*RELATED_CONTROLS + 4*FIXEDTEXT_HEIGHT + 4*EDIT_HEIGHT ) ; Size = MAP_APPFONT ( 105, CHECKBOX_HEIGHT ) ; Text [ en-US ] = "Password required"; }; - AUTO_CHARSET( 5*UNRELATED_CONTROLS + 4*RELATED_CONTROLS + 5*FIXEDTEXT_HEIGHT + 3*EDIT_HEIGHT, PAGE_X ) + AUTO_CHARSET( 5*UNRELATED_CONTROLS + 5*RELATED_CONTROLS + 5*FIXEDTEXT_HEIGHT + 4*EDIT_HEIGHT, PAGE_X ) }; TabPage PAGE_ORACLE_JDBC @@ -694,6 +693,7 @@ TabPage PAGE_LDAP TabStop = TRUE ; Border = TRUE ; HelpId = HID_DSADMIN_LDAP_PORTNUMBER; + NoThousandSep = TRUE; Pos = MAP_APPFONT ( EDIT_X , 3*UNRELATED_CONTROLS + RELATED_CONTROLS + 2*FIXEDTEXT_HEIGHT-1 + CHECKBOX_HEIGHT) ; Size = MAP_APPFONT ( 105 , EDIT_HEIGHT ) ; @@ -709,6 +709,7 @@ TabPage PAGE_LDAP TabStop = TRUE ; Border = TRUE ; HelpId = HID_DSADMIN_LDAP_ROWCOUNT; + NoThousandSep = TRUE; Pos = MAP_APPFONT ( EDIT_X , 4*UNRELATED_CONTROLS + RELATED_CONTROLS + 3*FIXEDTEXT_HEIGHT -1 + CHECKBOX_HEIGHT) ; Size = MAP_APPFONT ( 105 , EDIT_HEIGHT ) ; @@ -763,6 +764,7 @@ TabPage PAGE_USERDRIVER { TabStop = TRUE ; Border = TRUE ; + NoThousandSep = TRUE; Pos = MAP_APPFONT ( EDIT_X , 2*UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT -1 ) ; Size = MAP_APPFONT ( 105 , EDIT_HEIGHT ) ; diff --git a/dbaccess/source/ui/dlg/dbadminsetup.hrc b/dbaccess/source/ui/dlg/dbadminsetup.hrc index c3e295eeefff..d05c2ee51553 100644 --- a/dbaccess/source/ui/dlg/dbadminsetup.hrc +++ b/dbaccess/source/ui/dlg/dbadminsetup.hrc @@ -46,25 +46,25 @@ #define STR_DBASE_HELPTEXT 28 #define STR_MSACCESS_HELPTEXT 29 #define STR_TEXT_HELPTEXT 30 -//#define STR_LDAP_HELPTEXT 31 + // FREE #define STR_ADO_HELPTEXT 32 #define STR_JDBC_HELPTEXT 33 #define STR_ODBC_HELPTEXT 34 #define STR_MYSQLJDBC_HELPTEXT 35 #define STR_SPREADSHEET_HELPTEXT 36 -//#define STR_AUTHENTIFICATION_HELPTEXT 37 + // FREE #define STR_FINAL_HELPTEXT 38 #define STR_ADABAS_HELPTEXT 39 #define STR_ORACLE_HELPTEXT 40 - #define STR_DBASE_HEADERTEXT 41 #define STR_MSACCESS_HEADERTEXT 42 #define STR_TEXT_HEADERTEXT 43 -//#define STR_LDAP_HEADERTEXT 44 + // FREE #define STR_ADO_HEADERTEXT 45 #define STR_JDBC_HEADERTEXT 46 #define STR_ODBC_HEADERTEXT 47 -#define STR_MYSQLJDBC_HEADERTEXT 49 +#define STR_MYSQLJDBC_HEADERTEXT 48 + // FREE #define STR_SPREADSHEET_HEADERTEXT 50 #define STR_FINAL_HEADERTEXT 52 #define STR_ADABAS_HEADERTEXT 53 @@ -100,6 +100,7 @@ #define STR_ORACLE_DRIVERCLASSTEXT 84 #define STR_MYSQL_DRIVERCLASSTEXT 85 #define STR_LDAP_DEFAULT 86 +#define STR_PAGETITLE_MYSQL_NATIVE 87 #define FT_PORTNUMBERDEFAULT 1 @@ -116,6 +117,8 @@ #define FT_FINALTEXT 12 #define FT_FINALHELPTEXT 13 #define FT_ADDITIONALSETTINGS 14 +#define FT_SETUP_WIZARD_HEADER 15 +#define FT_SETUP_WIZARD_HELP 16 #define ET_GENERALUSERNAME 1 diff --git a/dbaccess/source/ui/dlg/dbadminsetup.src b/dbaccess/source/ui/dlg/dbadminsetup.src index b3931000fd7d..6f6020d966e9 100644 --- a/dbaccess/source/ui/dlg/dbadminsetup.src +++ b/dbaccess/source/ui/dlg/dbadminsetup.src @@ -78,7 +78,6 @@ ModalDialog DLG_DATABASE_WIZARD }; - String STR_PAGETITLE_TEXT { Text[ en-US ] = "Set up a connection to text files" ; @@ -135,6 +134,11 @@ ModalDialog DLG_DATABASE_WIZARD Text[ en-US ] = "Set up user authentication" ; }; + String STR_PAGETITLE_MYSQL_NATIVE + { + Text [ en-US ] = "Set up MySQL server data"; + }; + String STR_PAGETITLE_FINAL { Text[ en-US ] = "Save and proceed" ; @@ -198,7 +202,7 @@ TabPage PAGE_DBWIZARD_MYSQL_INTRO { Pos = MAP_APPFONT (START_X + 6 , 115 ) ; Size = MAP_APPFONT ( 205 , 9 ) ; - Text[ en-US ] = "Connect native" ; + Text[ en-US ] = "Connect directly" ; Hide = TRUE ; }; @@ -340,11 +344,6 @@ TabPage PAGE_DBWIZARD_FINAL }; }; - - - - - TabPage PAGE_DBWIZARD_MYSQL_JDBC { SVLook = TRUE ; @@ -358,16 +357,19 @@ TabPage PAGE_DBWIZARD_MYSQL_JDBC Text[ en-US ] = "Set up connection to a MySQL database using JDBC" ; }; - String STR_MYSQLJDBC_HELPTEXT{ + String STR_MYSQLJDBC_HELPTEXT + { Text[ en-US ] = "Please enter the required information to connect to a MySQL database using JDBC. Note that a JDBC driver class must be installed on your system and registered with %PRODUCTNAME.\nPlease contact your system administrator if you are unsure about the following settings."; }; - String STR_MYSQL_DRIVERCLASSTEXT{ + String STR_MYSQL_DRIVERCLASSTEXT + { Text [ en-US ] = "MySQL JDBC d~river class:"; }; - String STR_MYSQL_DEFAULT{ + String STR_MYSQL_DEFAULT + { Text[ en-US ] = "Default: 3306"; }; @@ -377,25 +379,25 @@ TabPage PAGE_DBWIZARD_MYSQL_JDBC TabPage PAGE_DBWIZARD_MYSQL_NATIVE { SVLook = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; + Pos = MAP_APPFONT ( 0, 0 ) ; Size = MAP_APPFONT ( WIZARD_PAGE_X , WIZARD_PAGE_Y ) ; Hide = TRUE ; - - String STR_MYSQLJDBC_HEADERTEXT + FixedText FT_SETUP_WIZARD_HEADER { + Pos = MAP_APPFONT ( START_X , 8 ) ; + Size = MAP_APPFONT ( WIZARD_PAGE_X - START_X - 12 , 2 * FIXEDTEXT_HEIGHT ) ; Text[ en-US ] = "Set up connection to a MySQL database" ; + WordBreak = TRUE; }; - String STR_MYSQLJDBC_HELPTEXT{ - Text[ en-US ] = "Please enter the required information to connect to a MySQL database."; - }; - - String STR_MYSQL_DEFAULT{ - Text[ en-US ] = "Default: 3306"; + FixedText FT_SETUP_WIZARD_HELP + { + Pos = MAP_APPFONT ( START_X , INIT_Y ) ; + Size = MAP_APPFONT ( WIZARD_PAGE_X - START_X - 12 , 3 * FIXEDTEXT_HEIGHT ) ; + Text [ en-US ] = "Please enter the required information to connect to a MySQL database."; + WordBreak = TRUE; }; - - AUTOHELP_JDBCCONTROLGROUP(HID_PAGE_DBWIZARD_JDBC_ET_MYSQLDBNAME) }; diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 9147ef69e9ad..bab1dcca3694 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -102,6 +102,7 @@ #ifndef _FILEDLGHELPER_HXX #include <sfx2/filedlghelper.hxx> #endif +#include <cppuhelper/exc_hlp.hxx> /** === begin UNO includes === **/ #ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ @@ -162,8 +163,8 @@ #include <com/sun/star/document/MacroExecMode.hpp> #endif #include <com/sun/star/ucb/IOErrorCode.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include <com/sun/star/task/XInteractionHandler2.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> /** === end UNO includes === **/ @@ -264,6 +265,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent , m_sRM_ADABASText(ModuleRes(STR_PAGETITLE_ADABAS)) , m_sRM_ADOText(ModuleRes(STR_PAGETITLE_ADO)) , m_sRM_JDBCText(ModuleRes(STR_PAGETITLE_JDBC)) + , m_sRM_MySQLNativePageTitle(ModuleRes(STR_PAGETITLE_MYSQL_NATIVE)) , m_pGeneralPage( NULL ) , m_pMySQLIntroPage(NULL) , m_pCollection( NULL ) @@ -387,7 +389,7 @@ String ODbTypeWizDialogSetup::getStateDisplayName( WizardState _nState ) const sRoadmapItem = m_sRM_JDBCText; break; case PAGE_DBSETUPWIZARD_MYSQL_NATIVE: - sRoadmapItem = m_sRM_JDBCText; + sRoadmapItem = m_sRM_MySQLNativePageTitle; break; case PAGE_DBSETUPWIZARD_MYSQL_ODBC: sRoadmapItem = m_sRM_ODBCText; @@ -454,14 +456,11 @@ void DataSourceInfoConverter::convert(const ::dbaccess::ODsnTypeCollection* _pCo ::comphelper::NamedValueCollection aDS(aInfo); ::connectivity::DriversConfig aDriverConfig(m_xFactory); - const ::comphelper::NamedValueCollection& aOldMetaData = aDriverConfig.getMetaData(_sOldURLPrefix); - const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix); - const ::comphelper::NamedValueCollection& aNewMetaData = aDriverConfig.getMetaData(_sNewURLPrefix); + const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix); const ::comphelper::NamedValueCollection& aNewProperties = aDriverConfig.getProperties(_sNewURLPrefix); - - lcl_removeUnused(aOldMetaData,aNewMetaData,aDS); lcl_removeUnused(aOldProperties,aNewProperties,aDS); + aDS >>= aInfo; _xDatasource->setPropertyValue(PROPERTY_INFO,uno::makeAny(aInfo)); } @@ -472,7 +471,12 @@ void ODbTypeWizDialogSetup::activateDatabasePath() { case OGeneralPage::eCreateNew: { - activatePath( static_cast<PathId>(m_pCollection->getIndexOf(m_pCollection->getEmbeddedDatabase()) + 1), sal_True); + sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pCollection->getEmbeddedDatabase() ); + if ( nCreateNewDBIndex == -1 ) + nCreateNewDBIndex = m_pCollection->getIndexOf( ::rtl::OUString::createFromAscii( "sdbc:dbase:" ) ); + OSL_ENSURE( nCreateNewDBIndex != -1, "ODbTypeWizDialogSetup::activateDatabasePath: the GeneralPage should have prevented this!" ); + activatePath( static_cast< PathId >( nCreateNewDBIndex + 1 ), sal_True ); + enableState(PAGE_DBSETUPWIZARD_FINAL, sal_True ); enableButtons( WZB_FINISH, sal_True); } @@ -675,7 +679,7 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState) break; case PAGE_DBSETUPWIZARD_MYSQL_NATIVE: m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"))))); - pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLNATIVETabPage( this, *m_pOutSet); + pPage = MySQLNativeSetupPage::Create( this, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_ORACLE: @@ -847,9 +851,23 @@ void ODbTypeWizDialogSetup::enableConfirmSettings( bool _bEnable ) } //------------------------------------------------------------------------- +namespace +{ + bool lcl_handle( const Reference< XInteractionHandler2 >& _rxHandler, const Any& _rRequest ) + { + OInteractionRequest* pRequest = new OInteractionRequest( _rRequest ); + Reference < XInteractionRequest > xRequest( pRequest ); + OInteractionAbort* pAbort = new OInteractionAbort; + pRequest->addContinuation( pAbort ); + + return _rxHandler->handleInteractionRequest( xRequest ); + } +} + +//------------------------------------------------------------------------- sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { - Reference< XInteractionHandler > xHandler( getORB()->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); + Reference< XInteractionHandler2 > xHandler( getORB()->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); try { if (callSaveAsDialog() == sal_True) @@ -876,17 +894,25 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() return sal_True; } } - catch (Exception& e) + catch ( const Exception& e ) { - InteractiveIOException aRequest; - aRequest.Code = IOErrorCode_GENERAL; - OInteractionRequest * pRequest = new OInteractionRequest (makeAny (aRequest)); - Reference < XInteractionRequest > xRequest(pRequest ); - OInteractionAbort* pAbort = new OInteractionAbort; - pRequest ->addContinuation (pAbort ); + Any aError = ::cppu::getCaughtException(); if ( xHandler.is() ) - xHandler->handle( xRequest ); - (void)e; // make compiler happy + { + if ( !lcl_handle( xHandler, aError ) ) + { + InteractiveIOException aRequest; + aRequest.Classification = InteractionClassification_ERROR; + if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) ) + // assume savint the document faile + aRequest.Code = IOErrorCode_CANT_WRITE; + else + aRequest.Code = IOErrorCode_GENERAL; + aRequest.Message = e.Message; + aRequest.Context = e.Context; + lcl_handle( xHandler, makeAny( aRequest ) ); + } + } } return sal_False; } diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx index c264e760a2f7..69b91b2456a9 100644 --- a/dbaccess/source/ui/dlg/detailpages.cxx +++ b/dbaccess/source/ui/dlg/detailpages.cxx @@ -571,9 +571,6 @@ namespace dbaui m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); m_aEDSocket.SetModifyHdl(getControlModifiedLink()); - // #98982# OJ - m_aNFPortNumber.SetUseThousandSep(sal_False); - Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname, &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket, &m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver, @@ -701,62 +698,42 @@ namespace dbaui MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs ) :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false ) ,m_aSeparator1 ( this, ModuleRes( FL_SEPARATOR1) ) - ,m_aDatabaseNameLabel ( this, ModuleRes( FT_AUTODATABASENAME ) ) - ,m_aDatabaseName ( this, ModuleRes( ET_AUTODATABASENAME ) ) - ,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_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_aDatabaseName.SetModifyHdl(getControlModifiedLink()); - m_aEDHostname.SetModifyHdl(getControlModifiedLink()); - m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); - m_aEDSocket.SetModifyHdl(getControlModifiedLink()); m_aUserName.SetModifyHdl(getControlModifiedLink()); - // #98982# OJ - m_aNFPortNumber.SetUseThousandSep(sal_False); - - Window* pWindows[] = { &m_aDatabaseNameLabel, &m_aDatabaseName, &m_aFTHostname, &m_aEDHostname, - &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket, - &m_aSeparator2, &m_aUserNameLabel, &m_aUserName, &m_aPasswordRequired, - m_pCharsetLabel, m_pCharset}; - + 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); + OCommonBehaviourTabPage::fillControls( _rControlList ); + m_aMySQLSettings.fillControls( _rControlList ); - _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aDatabaseName)); - _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname)); - _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber)); - _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket)); _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); + OCommonBehaviourTabPage::fillWindows( _rControlList ); + m_aMySQLSettings.fillWindows( _rControlList); _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1)); - _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aDatabaseNameLabel)); - _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname)); - _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber)); - _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket)); _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2)); _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel)); } @@ -764,12 +741,9 @@ namespace dbaui // ----------------------------------------------------------------------- sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet ) { - sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); + sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet ); - fillString(_rSet,&m_aDatabaseName,DSID_DATABASENAME,bChangedSomething); - fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething); - fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething); - fillInt32(_rSet,&m_aNFPortNumber,DSID_MYSQL_PORTNUMBER,bChangedSomething ); + bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet ); if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() ) { @@ -788,27 +762,13 @@ namespace dbaui sal_Bool bValid, bReadonly; getFlags(_rSet, bValid, bReadonly); - SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True); - SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True); - SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_MYSQL_PORTNUMBER, sal_True); - SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True); + 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_aDatabaseName.SetText( pDatabaseName->GetValue() ); - m_aDatabaseName.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(); - m_aUserName.SetText(pUidItem->GetValue()); m_aUserName.ClearModifyFlag(); m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue()); @@ -1023,8 +983,6 @@ namespace dbaui m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); m_aNFRowCount.SetModifyHdl(getControlModifiedLink()); - // #98982# OJ - m_aNFPortNumber.SetUseThousandSep(sal_False); m_aNFRowCount.SetUseThousandSep(sal_False); m_iNormalPort = 389; m_iSSLPort = 636; diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx index 7eeefd90e9c0..0938a280c630 100644 --- a/dbaccess/source/ui/dlg/detailpages.hxx +++ b/dbaccess/source/ui/dlg/detailpages.hxx @@ -58,6 +58,7 @@ #ifndef DBAUI_TEXTCONNECTIONHELPER_HXX #include "TextConnectionHelper.hxx" #endif +#include "admincontrols.hxx" #include <svtools/dialogcontrolling.hxx> @@ -261,14 +262,7 @@ namespace dbaui private: FixedLine m_aSeparator1; - FixedText m_aDatabaseNameLabel; - Edit m_aDatabaseName; - FixedText m_aFTHostname; - Edit m_aEDHostname; - FixedText m_aPortNumber; - NumericField m_aNFPortNumber; - FixedText m_aFTSocket; - Edit m_aEDSocket; + MySQLNativeSettings m_aMySQLSettings; FixedLine m_aSeparator2; FixedText m_aUserNameLabel; diff --git a/dbaccess/source/ui/dlg/dsitems.hxx b/dbaccess/source/ui/dlg/dsitems.hxx index 75316232684b..a0d95aca810b 100644 --- a/dbaccess/source/ui/dlg/dsitems.hxx +++ b/dbaccess/source/ui/dlg/dsitems.hxx @@ -91,6 +91,7 @@ #define DSID_IGNORECURRENCY 55 #define DSID_CONN_SOCKET 56 #define DSID_ESCAPE_DATETIME 57 +#define DSID_NAMED_PIPE 58 // don't forget to adjust DSID_LAST_ITEM_ID below! @@ -98,7 +99,7 @@ //= item range. Adjust this if you introduce new items above #define DSID_FIRST_ITEM_ID DSID_NAME -#define DSID_LAST_ITEM_ID DSID_ESCAPE_DATETIME +#define DSID_LAST_ITEM_ID DSID_NAMED_PIPE #endif // _DBAUI_DATASOURCEITEMS_HXX_ diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 66b36bd1a3f8..4ee69888124a 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -45,7 +45,6 @@ #include "localresaccess.hxx" #include <vcl/msgbox.hxx> #include <svtools/stritem.hxx> -#include <connectivity/DriversConfig.hxx> #include <vcl/waitobj.hxx> #include <com/sun/star/sdbc/XDriverAccess.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -53,6 +52,9 @@ #include <com/sun/star/container/XNameAccess.hpp> #include "DriverSettings.hxx" #include "UITools.hxx" +#include <comphelper/processfactory.hxx> +#include <unotools/confignode.hxx> + //......................................................................... namespace dbaui { @@ -100,16 +102,51 @@ namespace dbaui DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rItems.GetItem(DSID_TYPECOLLECTION)); if (pCollectionItem) m_pCollection = pCollectionItem->getCollection(); - DBG_ASSERT(m_pCollection, "OGeneralPage::OGeneralPage : really need a DSN type collection !"); + // If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option + sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pCollection->getEmbeddedDatabase() ); + if ( nCreateNewDBIndex == -1 ) + nCreateNewDBIndex = m_pCollection->getIndexOf( ::rtl::OUString::createFromAscii( "sdbc:dbase:" ) ); + bool bHideCreateNew = ( nCreateNewDBIndex == -1 ); + + // also, if our application policies tell us to hide the option, do it + ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithServiceFactory( + ::comphelper::getProcessServiceFactory(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/Policies/Features/Base" ) ) + ) ); + sal_Bool bAllowCreateLocalDatabase( sal_True ); + OSL_VERIFY( aConfig.getNodeValue( "CreateLocalDatabase" ) >>= bAllowCreateLocalDatabase ); + if ( !bAllowCreateLocalDatabase ) + bHideCreateNew = true; + + if ( bHideCreateNew ) + { + m_aRB_CreateDatabase.Hide(); + Window* pWindowsToMove[] = { + &m_aRB_OpenDocument, &m_aRB_GetExistingDatabase, &m_aFT_DocListLabel, m_pLB_DocumentList.get(), + &m_aPB_OpenDocument, &m_aDatasourceTypeLabel, m_pDatasourceType.get(), &m_aFTDataSourceAppendix, + &m_aTypePostLabel + }; + const long nOffset = m_aRB_OpenDocument.GetPosPixel().Y() - m_aRB_CreateDatabase.GetPosPixel().Y(); + for ( size_t i=0; i < sizeof( pWindowsToMove ) / sizeof( pWindowsToMove[0] ); ++i ) + { + Point aPos( pWindowsToMove[i]->GetPosPixel() ); + aPos.Y() -= nOffset; + pWindowsToMove[i]->SetPosPixel( aPos ); + } + } + + if ( bHideCreateNew ) + m_aRB_GetExistingDatabase.Check(); + else + m_aRB_CreateDatabase.Check(); + // do some knittings m_pDatasourceType->SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected)); m_aRB_CreateDatabase.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected)); m_aRB_GetExistingDatabase.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected)); m_aRB_OpenDocument.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected)); - m_aRB_CreateDatabase.Check(); - m_pLB_DocumentList->SetSelectHdl( LINK( this, OGeneralPage, OnDocumentSelected ) ); m_aPB_OpenDocument.SetClickHdl( LINK( this, OGeneralPage, OnOpenDocument ) ); } @@ -275,7 +312,7 @@ namespace dbaui SetControlFontWeight(&m_aFTHeaderText); SetText(String()); - m_pDatasourceType->SetPosPixel( MovePoint( m_aRB_GetExistingDatabase.GetPosPixel(), INDENT_BELOW_RADIO, 14 ) ); + LayoutHelper::positionBelow( m_aRB_GetExistingDatabase, *m_pDatasourceType, RelatedControls, INDENT_BELOW_RADIO ); if ( !bValid || bReadonly ) { @@ -384,16 +421,32 @@ namespace dbaui bool OGeneralPage::approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName ) { const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(_sURLPrefix); - if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_JDBC ) ) - _inout_rDisplayName = m_sMySQLEntry; - - else if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_ODBC ) ) - _inout_rDisplayName = String(); - else if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_NATIVE ) ) - _inout_rDisplayName = String(); + if ( m_DBWizardMode ) + { + switch ( eType ) + { + case ::dbaccess::DST_MYSQL_JDBC: + _inout_rDisplayName = m_sMySQLEntry; + break; + case ::dbaccess::DST_MYSQL_ODBC: + case ::dbaccess::DST_MYSQL_NATIVE: + // don't display those, the decision whether the user connects via JDBC/ODBC/C-OOo is made on another + // page + _inout_rDisplayName = String(); + break; + case ::dbaccess::DST_MYSQL_NATIVE_DIRECT: + // do not display the Connector/OOo driver itself, it is always wrapped via the MySQL-Driver, if + // this driver is installed + if ( m_pCollection->hasDriver( "sdbc:mysql:mysqlc:" ) ) + _inout_rDisplayName = String(); + break; + default: + break; + } + } - else if ( eType == ::dbaccess::DST_EMBEDDED_HSQLDB ) + if ( eType == ::dbaccess::DST_EMBEDDED_HSQLDB ) _inout_rDisplayName = String(); return _inout_rDisplayName.Len() > 0; diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk index ceeac9f8cdc7..af576ec5c57b 100644 --- a/dbaccess/source/ui/dlg/makefile.mk +++ b/dbaccess/source/ui/dlg/makefile.mk @@ -60,6 +60,7 @@ SRC1FILES = \ AutoControls.src \ ConnectionPage.src \ UserAdmin.src \ + admincontrols.src \ directsql.src \ AdabasStat.src \ indexdialog.src \ @@ -94,6 +95,7 @@ EXCEPTIONSFILES= \ $(SLO)$/RelationDlg.obj \ $(SLO)$/adtabdlg.obj \ $(SLO)$/dlgsave.obj \ + $(SLO)$/admincontrols.obj \ $(SLO)$/adminpages.obj \ $(SLO)$/queryorder.obj \ $(SLO)$/queryfilter.obj \ |