From a6abfa16cd66addbda3a5ea3defd5d465a75a9a0 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 14 Sep 2009 11:18:01 +0000 Subject: 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 --- dbaccess/qa/complex/dbaccess/TestCase.java | 7 +- dbaccess/qa/complex/dbaccess/dbaccess.sce | 2 +- dbaccess/source/core/dataaccess/ContentHelper.cxx | 33 ++- dbaccess/source/core/dataaccess/ModelImpl.cxx | 2 + .../source/core/dataaccess/databasedocument.cxx | 47 +++- .../source/core/dataaccess/databasedocument.hxx | 4 +- dbaccess/source/core/dataaccess/datasource.cxx | 7 +- .../source/core/dataaccess/documentdefinition.cxx | 2 +- dbaccess/source/core/inc/ContentHelper.hxx | 3 + dbaccess/source/core/inc/core_resource.hrc | 1 + dbaccess/source/core/inc/core_resource.hxx | 25 +- dbaccess/source/core/misc/dsntypes.cxx | 106 +++---- dbaccess/source/core/resource/core_resource.cxx | 11 + dbaccess/source/core/resource/strings.src | 6 + dbaccess/source/filter/xml/makefile.mk | 1 - dbaccess/source/filter/xml/xmlDataSource.cxx | 9 +- dbaccess/source/filter/xml/xmlExport.cxx | 70 +++-- dbaccess/source/filter/xml/xmlExport.hxx | 1 - dbaccess/source/filter/xml/xmlJavaClassPath.cxx | 113 -------- dbaccess/source/filter/xml/xmlJavaClassPath.hxx | 58 ---- dbaccess/source/filter/xml/xmlfilter.cxx | 39 ++- dbaccess/source/inc/dsntypes.hxx | 4 + dbaccess/source/ui/browser/unodatbr.cxx | 2 +- dbaccess/source/ui/dlg/AutoControls_tmpl.hrc | 22 +- dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx | 220 ++++++++------- dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx | 55 ++-- dbaccess/source/ui/dlg/DbAdminImpl.cxx | 1 + dbaccess/source/ui/dlg/DriverSettings.cxx | 26 +- dbaccess/source/ui/dlg/admincontrols.cxx | 310 +++++++++++++++++++++ dbaccess/source/ui/dlg/admincontrols.hrc | 48 ++++ dbaccess/source/ui/dlg/admincontrols.hxx | 81 ++++++ dbaccess/source/ui/dlg/admincontrols.src | 130 +++++++++ dbaccess/source/ui/dlg/adminpages.cxx | 20 +- dbaccess/source/ui/dlg/adminpages.hxx | 34 ++- dbaccess/source/ui/dlg/dbadmin.cxx | 2 + dbaccess/source/ui/dlg/dbadmin.src | 28 +- dbaccess/source/ui/dlg/dbadminsetup.hrc | 13 +- dbaccess/source/ui/dlg/dbadminsetup.src | 44 +-- dbaccess/source/ui/dlg/dbwizsetup.cxx | 66 +++-- dbaccess/source/ui/dlg/detailpages.cxx | 70 +---- dbaccess/source/ui/dlg/detailpages.hxx | 10 +- dbaccess/source/ui/dlg/dsitems.hxx | 3 +- dbaccess/source/ui/dlg/generalpage.cxx | 79 +++++- dbaccess/source/ui/dlg/makefile.mk | 2 + dbaccess/source/ui/inc/dbu_resource.hrc | 1 + dbaccess/source/ui/inc/dbwizsetup.hxx | 1 + 46 files changed, 1227 insertions(+), 592 deletions(-) delete mode 100644 dbaccess/source/filter/xml/xmlJavaClassPath.cxx delete mode 100644 dbaccess/source/filter/xml/xmlJavaClassPath.hxx create mode 100755 dbaccess/source/ui/dlg/admincontrols.cxx create mode 100755 dbaccess/source/ui/dlg/admincontrols.hrc create mode 100755 dbaccess/source/ui/dlg/admincontrols.hxx create mode 100755 dbaccess/source/ui/dlg/admincontrols.src (limited to 'dbaccess') diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index 89b1f9ede56b..1051b549c8f0 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -84,9 +84,10 @@ public abstract class TestCase extends complexlib.ComplexTestCase */ protected final String createTempFileURL() throws IOException { - final File documentFile = java.io.File.createTempFile( getTestObjectName(), ".odb" ); - documentFile.deleteOnExit(); - return documentFile.getAbsoluteFile().toURI().toURL().toString(); + final File documentFile = java.io.File.createTempFile( getTestObjectName(), ".odb" ).getAbsoluteFile(); + if ( documentFile.exists() ) + documentFile.delete(); + return FileHelper.getOOoCompatibleFileURL( documentFile.toURI().toURL().toString() ); } // -------------------------------------------------------------------------------------------------------- diff --git a/dbaccess/qa/complex/dbaccess/dbaccess.sce b/dbaccess/qa/complex/dbaccess/dbaccess.sce index c5fa408ff273..47387e459ae9 100644 --- a/dbaccess/qa/complex/dbaccess/dbaccess.sce +++ b/dbaccess/qa/complex/dbaccess/dbaccess.sce @@ -7,6 +7,6 @@ -o complex.dbaccess.DataSource -o complex.dbaccess.Parser -o complex.dbaccess.ApplicationController --o complex.dbaccess.CopyTableWizard +#-o complex.dbaccess.CopyTableWizard -o complex.dbaccess.UISettings -o complex.dbaccess.Beamer diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index b43292aada37..3dd5bbd27c54 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -139,25 +139,38 @@ IMPLEMENT_IMPLEMENTATION_ID(OContentHelper) Reference< XContentIdentifier > SAL_CALL OContentHelper::getIdentifier( ) throw (RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - ::rtl::OUString sContentId = m_pImpl->m_aProps.aTitle; + ::rtl::OUStringBuffer aIdentifier; + aIdentifier.appendAscii( "private:" ); + aIdentifier.append( impl_getHierarchicalName( true ) ); + return new ::ucbhelper::ContentIdentifier( m_aContext.getLegacyServiceFactory(), aIdentifier.makeStringAndClear() ); +} +// ----------------------------------------------------------------------------- +::rtl::OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer ) const +{ + ::rtl::OUStringBuffer aHierarchicalName( m_pImpl->m_aProps.aTitle ); Reference< XInterface > xParent = m_xParentContainer; while( xParent.is() ) { - Reference xProp(xParent,UNO_QUERY); - Reference xChild(xParent,UNO_QUERY); - xParent.set(xChild.is() ? xChild->getParent() : Reference< XInterface >(),UNO_QUERY); + Reference xProp( xParent, UNO_QUERY ); + Reference< XChild > xChild( xParent, UNO_QUERY ); + xParent.set( xChild.is() ? xChild->getParent() : Reference< XInterface >(), UNO_QUERY ); if ( xProp.is() && xParent.is() ) { ::rtl::OUString sName; - xProp->getPropertyValue(PROPERTY_NAME) >>= sName; - sContentId = sName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sContentId; + xProp->getPropertyValue( PROPERTY_NAME ) >>= sName; + + ::rtl::OUString sPrevious = aHierarchicalName.makeStringAndClear(); + aHierarchicalName.append( sName ); + aHierarchicalName.append( sal_Unicode( '/' ) ); + aHierarchicalName.append( sPrevious ); } } - - sContentId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:")) + sContentId; - return new ::ucbhelper::ContentIdentifier( m_aContext.getLegacyServiceFactory(), sContentId ); - // return Reference< XContentIdentifier >(); + ::rtl::OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() ); + if ( !_includingRootContainer ) + sHierarchicalName = sHierarchicalName.copy( sHierarchicalName.indexOf( '/' ) + 1 ); + return sHierarchicalName; } + // ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OContentHelper::getContentType() throw (RuntimeException) { diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 23c6a34d7808..0989bce23195 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -1080,6 +1080,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() { // known JDBC settings AsciiPropertyValue( "JavaDriverClass", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "JavaDriverClassPath", makeAny( ::rtl::OUString() ) ), AsciiPropertyValue( "IgnoreCurrency", makeAny( (sal_Bool)sal_False ) ), // known settings for file-based drivers AsciiPropertyValue( "Extension", makeAny( ::rtl::OUString() ) ), @@ -1111,6 +1112,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() AsciiPropertyValue( "MaxRowCount", makeAny( (sal_Int32)100 ) ), // known MySQLNative driver settings AsciiPropertyValue( "LocalSocket", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "NamedPipe", makeAny( ::rtl::OUString() ) ), // misc known driver settings AsciiPropertyValue( "ParameterNameSubstitution", makeAny( (sal_Bool)sal_False ) ), AsciiPropertyValue( "AddIndexAppendix", makeAny( (sal_Bool)sal_True ) ), diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 896edc257f1c..b1d8792ae281 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -31,6 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" +#include "core_resource.hxx" +#include "core_resource.hrc" #include "datasource.hxx" #include "databasedocument.hxx" #include "dbastrings.hrc" @@ -724,7 +726,7 @@ void SAL_CALL ODatabaseDocument::store( ) throw (IOException, RuntimeException) // ----------------------------------------------------------------------------- void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const Sequence< PropertyValue>& _rArguments, - const StoreType _eType, DocumentGuard& _rGuard ) + const StoreType _eType, DocumentGuard& _rGuard ) throw ( IOException, RuntimeException ) { OSL_PRECOND( ( _eType == SAVE ) || ( _eType == SAVE_AS ), "ODatabaseDocument::impl_storeAs_throw: you introduced a new type which cannot be handled here!" ); @@ -788,10 +790,29 @@ void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const } catch( const Exception& ) { + Any aError = ::cppu::getCaughtException(); + // notify the failure if ( !bIsInitializationProcess ) m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", NULL, makeAny( _rURL ) ); - throw; + + if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) + ) + { + // allowed to leave + throw; + } + + Exception aExcept; + aError >>= aExcept; + + ::rtl::OUString sErrorMessage = ResourceManager::loadString( + RID_STR_ERROR_WHILE_SAVING, + "$except$", aError.getValueTypeName(), + "$message$", aExcept.Message + ); + throw IOException( sErrorMessage, *this ); } // notify the document event @@ -933,8 +954,26 @@ void SAL_CALL ODatabaseDocument::storeToURL( const ::rtl::OUString& _rURL, const } catch( const Exception& ) { - m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToFailed", NULL, makeAny( _rURL ) ); - throw; + Any aError = ::cppu::getCaughtException(); + m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToFailed", NULL, aError ); + + if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) + ) + { + // allowed to leave + throw; + } + + Exception aExcept; + aError >>= aExcept; + + ::rtl::OUString sErrorMessage = ResourceManager::loadString( + RID_STR_ERROR_WHILE_SAVING, + "$except$", aError.getValueTypeName(), + "$message$", aExcept.Message + ); + throw IOException( sErrorMessage, *this ); } m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToDone", NULL, makeAny( _rURL ) ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index d7e72fd339f4..3430a60e037d 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -227,7 +227,9 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rArguments, const StoreType _eType, DocumentGuard& _rGuard - ); + ) + throw ( ::com::sun::star::io::IOException + , ::com::sun::star::uno::RuntimeException ); /** notifies our storage change listeners that our underlying storage changed diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 2f4577d57628..9d50a0d06623 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -783,8 +783,13 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O { DBG_ERROR( "ODatabaseSource::buildLowLevelConnection: got a strange exception while analyzing the error!" ); } - if ( !xDriver.is() ) + if ( !xDriver.is() || !xDriver->acceptsURL( m_pImpl->m_sConnectURL ) ) + { + // Nowadays, it's allowed for a driver to be registered for a given URL, but actually not to accept it. + // This is because registration nowadays happens at compile time (by adding respective configuration data), + // but acceptance is decided at runtime. nExceptionMessageId = RID_STR_COULDNOTCONNECT_NODRIVER; + } else { Sequence< PropertyValue > aDriverInfo = lcl_filterDriverProperties( diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 599da2aa1e86..8a4cff9624ae 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1928,7 +1928,7 @@ Reference< XComponent > ODocumentDefinition::impl_openUI_nolck_throw( bool _bFor Reference< XComponent > xComponent; try { - ::rtl::OUString sName( m_pImpl->m_aProps.aTitle ); + ::rtl::OUString sName( impl_getHierarchicalName( false ) ); sal_Int32 nObjectType = m_bForm ? DatabaseObject::FORM : DatabaseObject::REPORT; aGuard.clear(); diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx index 0f5247528709..227110bd324d 100644 --- a/dbaccess/source/core/inc/ContentHelper.hxx +++ b/dbaccess/source/core/inc/ContentHelper.hxx @@ -180,6 +180,9 @@ namespace dbaccess * @param evt is a sequence of property change events. */ void notifyPropertiesChange( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyChangeEvent >& evt ) const; + + ::rtl::OUString impl_getHierarchicalName( bool _includingRootContainer ) const; + public: OContentHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc index 245b90b985b3..c3fcb7541c68 100644 --- a/dbaccess/source/core/inc/core_resource.hrc +++ b/dbaccess/source/core/inc/core_resource.hrc @@ -88,6 +88,7 @@ #define RID_STR_OBJECT_ALREADY_CONTAINED ( RID_CORE_STRINGS_START + 44 ) #define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 ) #define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 ) +#define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 ) #endif // _DBA_CORE_RESOURCE_HRC_ diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx index 8b660c044ada..8778bf0204b7 100644 --- a/dbaccess/source/core/inc/core_resource.hxx +++ b/dbaccess/source/core/inc/core_resource.hxx @@ -78,11 +78,11 @@ namespace dbaccess /** loads a string from the resource file, substituting a placeholder with a given string @param _nResId - the resource ID of the string to loAD + the resource ID of the string to load @param _pPlaceholderAscii the ASCII representation of the placeholder string @param _rReplace - the string which should substutite the placeholder + the string which should substitute the placeholder */ static ::rtl::OUString loadString( sal_uInt16 _nResId, @@ -90,6 +90,27 @@ namespace dbaccess const ::rtl::OUString& _rReplace ); + /** loads a string from the resource file, substituting two placeholders with given strings + + @param _nResId + the resource ID of the string to load + @param _pPlaceholderAscii1 + the ASCII representation of the first placeholder string + @param _rReplace1 + the string which should substitute the first placeholder + @param _pPlaceholderAscii2 + the ASCII representation of the second placeholder string + @param _rReplace2 + the string which should substitute the second placeholder + */ + static ::rtl::OUString loadString( + sal_uInt16 _nResId, + const sal_Char* _pPlaceholderAscii1, + const ::rtl::OUString& _rReplace1, + const sal_Char* _pPlaceholderAscii2, + const ::rtl::OUString& _rReplace2 + ); + static ResMgr* getResManager(); }; diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index eb2e1ed6de67..48dc51e482f7 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -125,6 +125,7 @@ String ODsnTypeCollection::cutPrefix(const ::rtl::OUString& _sURL) const return sRet; } + //------------------------------------------------------------------------- String ODsnTypeCollection::getPrefix(const ::rtl::OUString& _sURL) const { @@ -149,6 +150,14 @@ String ODsnTypeCollection::getPrefix(const ::rtl::OUString& _sURL) const return sRet; } + +//------------------------------------------------------------------------- +bool ODsnTypeCollection::hasDriver( const sal_Char* _pAsciiPattern ) const +{ + String sPrefix( getPrefix( ::rtl::OUString::createFromAscii( _pAsciiPattern ) ) ); + return ( sPrefix.Len() > 0 ); +} + // ----------------------------------------------------------------------------- bool ODsnTypeCollection::isConnectionUrlRequired(const ::rtl::OUString& _sURL) const { @@ -369,6 +378,9 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const if (sDsn.EqualsIgnoreCaseAscii("jdbc", 0, nSeparator)) return DST_JDBC; + if (sDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, sDsn.Len())) + return DST_EMBEDDED_HSQLDB; + // find second : nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1); if (STRING_NOTFOUND == nSeparator) @@ -378,13 +390,6 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const return DST_UNKNOWN; } - if (sDsn.EqualsIgnoreCaseAscii("sdbc:adabas", 0, nSeparator)) - return DST_ADABAS; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:odbc", 0, nSeparator)) - return DST_ODBC; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:dbase", 0, nSeparator)) - return DST_DBASE; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:ado:", 0, nSeparator)) { nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1); @@ -398,56 +403,57 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const } return DST_ADO; } - if (sDsn.EqualsIgnoreCaseAscii("sdbc:flat:", 0, nSeparator)) - return DST_FLAT; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:calc:", 0, nSeparator)) - return DST_CALC; - //if ( ( 11 <= nSeparator) && sDsn.EqualsIgnoreCaseAscii("sdbc:mysqlc:", 0, nSeparator)) - // return DST_MYSQL_NATIVE; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, sDsn.Len())) - return DST_EMBEDDED_HSQLDB; + struct KnownPrefix + { + const sal_Char* pAsciiPrefix; + const DATASOURCE_TYPE eType; + const bool bMatchComplete; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:address:", 0, nSeparator)) + KnownPrefix() + :pAsciiPrefix( NULL ) + ,eType( DST_UNKNOWN ) + ,bMatchComplete( false ) + { + } + KnownPrefix( const sal_Char* _p, const DATASOURCE_TYPE _t, const bool _m ) + :pAsciiPrefix( _p ) + ,eType ( _t ) + ,bMatchComplete( _m ) + { + } + }; + KnownPrefix aKnowPrefixes[] = { - ++nSeparator; - if (sDsn.EqualsIgnoreCaseAscii("mozilla:", nSeparator,sDsn.Len() - nSeparator)) - return DST_MOZILLA; - if (sDsn.EqualsIgnoreCaseAscii("thunderbird:", nSeparator,sDsn.Len() - nSeparator)) - return DST_THUNDERBIRD; - if (sDsn.EqualsIgnoreCaseAscii("ldap:", nSeparator,sDsn.Len() - nSeparator)) - return DST_LDAP; - if (sDsn.EqualsIgnoreCaseAscii("outlook", nSeparator,sDsn.Len() - nSeparator)) - return DST_OUTLOOK; - if (sDsn.EqualsIgnoreCaseAscii("outlookexp", nSeparator,sDsn.Len() - nSeparator)) - return DST_OUTLOOKEXP; - if (sDsn.EqualsIgnoreCaseAscii("evolution:ldap", nSeparator,sDsn.Len() - nSeparator)) - return DST_EVOLUTION_LDAP; - if (sDsn.EqualsIgnoreCaseAscii("evolution:groupwise", nSeparator,sDsn.Len() - nSeparator)) - return DST_EVOLUTION_GROUPWISE; - if (sDsn.EqualsIgnoreCaseAscii("evolution:local", nSeparator,sDsn.Len() - nSeparator)) - return DST_EVOLUTION; - if (sDsn.EqualsIgnoreCaseAscii("kab", nSeparator,sDsn.Len() - nSeparator)) - return DST_KAB; - if (sDsn.EqualsIgnoreCaseAscii("macab", nSeparator,sDsn.Len() - nSeparator)) - return DST_MACAB; - } + KnownPrefix( "sdbc:calc:", DST_CALC, false ), + KnownPrefix( "sdbc:flat:", DST_FLAT, false ), + KnownPrefix( "sdbc:adabas:", DST_ADABAS, false ), + KnownPrefix( "sdbc:odbc:", DST_ODBC, false ), + KnownPrefix( "sdbc:dbase:", DST_DBASE, false ), + KnownPrefix( "sdbc:mysql:odbc:", DST_MYSQL_ODBC, false ), + KnownPrefix( "sdbc:mysql:jdbc:", DST_MYSQL_JDBC, false ), + KnownPrefix( "sdbc:mysql:mysqlc:", DST_MYSQL_NATIVE, false ), + KnownPrefix( "sdbc:mysqlc:", DST_MYSQL_NATIVE_DIRECT,false ), - // find third : - nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1); - if (STRING_NOTFOUND == nSeparator) + KnownPrefix( "sdbc:address:mozilla:", DST_MOZILLA, true ), + KnownPrefix( "sdbc:address:thunderbird:", DST_THUNDERBIRD, true ), + KnownPrefix( "sdbc:address:ldap:", DST_LDAP, true ), + KnownPrefix( "sdbc:address:outlook", DST_OUTLOOK, true ), + KnownPrefix( "sdbc:address:outlookexp", DST_OUTLOOKEXP, true ), + KnownPrefix( "sdbc:address:evolution:ldap", DST_EVOLUTION_LDAP, true ), + KnownPrefix( "sdbc:address:evolution:groupwise",DST_EVOLUTION_GROUPWISE,true ), + KnownPrefix( "sdbc:address:evolution:local", DST_EVOLUTION, true ), + KnownPrefix( "sdbc:address:kab", DST_KAB, true ), + KnownPrefix( "sdbc:address:macab", DST_MACAB, true ) + }; + + for ( size_t i=0; i < sizeof( aKnowPrefixes ) / sizeof( aKnowPrefixes[0] ); ++i ) { - DBG_ERROR("ODsnTypeCollection::implDetermineType : missing the third colon !"); - return DST_UNKNOWN; + USHORT nMatchLen = aKnowPrefixes[i].bMatchComplete ? sDsn.Len() : (USHORT)rtl_str_getLength( aKnowPrefixes[i].pAsciiPrefix ); + if ( sDsn.EqualsIgnoreCaseAscii( aKnowPrefixes[i].pAsciiPrefix, 0, nMatchLen ) ) + return aKnowPrefixes[i].eType; } - if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:odbc", 0, nSeparator)) - return DST_MYSQL_ODBC; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:jdbc", 0, nSeparator)) - return DST_MYSQL_JDBC; - if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:mysqlc", 0, nSeparator)) - return DST_MYSQL_NATIVE; - DBG_ERROR("ODsnTypeCollection::implDetermineType : unrecognized data source type !"); return DST_UNKNOWN; } diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx index 9783afae4bf8..dea6ea6b9d9d 100644 --- a/dbaccess/source/core/resource/core_resource.cxx +++ b/dbaccess/source/core/resource/core_resource.cxx @@ -88,6 +88,17 @@ namespace dbaccess sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace ); return sString; } + + //------------------------------------------------------------------ + ::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii1, const ::rtl::OUString& _rReplace1, + const sal_Char* _pPlaceholderAscii2, const ::rtl::OUString& _rReplace2 ) + { + String sString( loadString( _nResId ) ); + sString.SearchAndReplaceAscii( _pPlaceholderAscii1, _rReplace1 ); + sString.SearchAndReplaceAscii( _pPlaceholderAscii2, _rReplace2 ); + return sString; + } + //------------------------------------------------------------------------- void ResourceManager::registerClient() { diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index 4cf5b457c9fe..2f65a3391dff 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -235,9 +235,15 @@ String RID_STR_OBJECT_ALREADY_CONTAINED { Text [ en-US ] = "The object already is, with a different name, part of the container."; }; + String RID_STR_NAME_NOT_FOUND { Text [ en-US ] = "Unable to find the document '$name$'."; }; +String RID_STR_ERROR_WHILE_SAVING +{ + Text [ en-US ] = "Could not save the document:\n\n$except$:\n$message$"; +}; + //------------------------------------------------------------------------- diff --git a/dbaccess/source/filter/xml/makefile.mk b/dbaccess/source/filter/xml/makefile.mk index 41388880a30f..8b6d4df71288 100644 --- a/dbaccess/source/filter/xml/makefile.mk +++ b/dbaccess/source/filter/xml/makefile.mk @@ -67,7 +67,6 @@ SLOFILES= $(SLO)$/xmlfilter.obj \ $(SLO)$/xmlFileBasedDatabase.obj \ $(SLO)$/xmlServerDatabase.obj \ $(SLO)$/xmlConnectionResource.obj \ - $(SLO)$/xmlJavaClassPath.obj \ $(SLO)$/xmlservices.obj # --- Library ----------------------------------- diff --git a/dbaccess/source/filter/xml/xmlDataSource.cxx b/dbaccess/source/filter/xml/xmlDataSource.cxx index 5ec715764073..a5e5b2909c48 100644 --- a/dbaccess/source/filter/xml/xmlDataSource.cxx +++ b/dbaccess/source/filter/xml/xmlDataSource.cxx @@ -73,7 +73,7 @@ #include #endif #include "xmlConnectionData.hxx" -#include "xmlJavaClassPath.hxx" + namespace dbaxml { using namespace ::com::sun::star::uno; @@ -196,6 +196,9 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport, aProperty.Name = INFO_CONN_LDAP_ROWCOUNT; aProperty.Value <<= sValue.toInt32(); break; + case XML_TOK_JAVA_CLASSPATH: + aProperty.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClassPath")); + break; } if ( aProperty.Name.getLength() ) { @@ -286,10 +289,6 @@ SvXMLImportContext* OXMLDataSource::CreateChildContext( GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList, OXMLDataSource::eDriverSettings ); break; - case XML_TOK_JAVA_CLASSPATH: - GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLJavaClassPath( GetOwnImport(), nPrefix, rLocalName,xAttrList ); - break; case XML_TOK_APPLICATION_CONNECTION_SETTINGS: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); pContext = new OXMLDataSource( GetOwnImport(), nPrefix, rLocalName, xAttrList, OXMLDataSource::eAppSettings ); diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index b42d65ba1cb0..8008416956f4 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -343,8 +343,7 @@ void ODBExport::exportDataSource() ::connectivity::DriversConfig aDriverConfig(getServiceFactory()); const ::rtl::OUString sURL = ::comphelper::getString(xProp->getPropertyValue(PROPERTY_URL)); - ::comphelper::NamedValueCollection aMetaData = aDriverConfig.getMetaData(sURL); - aMetaData.merge( aDriverConfig.getProperties(sURL),true ) ; + ::comphelper::NamedValueCollection aDriverSupportedProperties( aDriverConfig.getProperties( sURL ) ); static ::rtl::OUString s_sTrue(::xmloff::token::GetXMLToken( XML_TRUE )); static ::rtl::OUString s_sFalse(::xmloff::token::GetXMLToken( XML_FALSE )); @@ -404,7 +403,6 @@ void ODBExport::exportDataSource() PropertyMap aTokens[] = { - PropertyMap( INFO_JDBCDRIVERCLASS, XML_JAVA_DRIVER_CLASS ), PropertyMap( INFO_TEXTFILEHEADER, XML_IS_FIRST_ROW_HEADER_LINE, s_sTrue ), PropertyMap( INFO_SHOWDELETEDROWS, XML_SHOW_DELETED, s_sFalse ), PropertyMap( INFO_ALLOWLONGTABLENAMES, XML_IS_TABLE_NAME_LENGTH_LIMITED, s_sTrue ), @@ -514,7 +512,7 @@ void ODBExport::exportDataSource() } else { - if ( !aMetaData.has(pProperties->Name) || aMetaData.get(pProperties->Name) != aValue ) + if ( !aDriverSupportedProperties.has(pProperties->Name) || aDriverSupportedProperties.get(pProperties->Name) != aValue ) { m_aDataSourceSettings.push_back( TypedPropertyValue( pProperties->Name, pProperties->Type, aValue ) ); @@ -578,21 +576,10 @@ void ODBExport::exportApplicationConnectionSettings(const TSettingsMap& _aSettin exportDataSourceSettings(); } // ----------------------------------------------------------------------------- -void ODBExport::exportJavaClassPath(const TSettingsMap& _aSettings) -{ - TSettingsMap::const_iterator aFind = _aSettings.find(XML_JAVA_CLASSPATH); - if ( aFind != _aSettings.end() ) - { - AddAttribute(XML_NAMESPACE_XLINK, XML_HREF,aFind->second); - SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_JAVA_CLASSPATH, sal_True, sal_True); - } -} -// ----------------------------------------------------------------------------- void ODBExport::exportDriverSettings(const TSettingsMap& _aSettings) { const ::xmloff::token::XMLTokenEnum pSettings[] = { - XML_JAVA_DRIVER_CLASS - ,XML_SHOW_DELETED + XML_SHOW_DELETED ,XML_SYSTEM_DRIVER_SETTINGS ,XML_BASE_DN ,XML_IS_FIRST_ROW_HEADER_LINE @@ -605,7 +592,6 @@ void ODBExport::exportDriverSettings(const TSettingsMap& _aSettings) AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second); } SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_DRIVER_SETTINGS, sal_True, sal_True); - exportJavaClassPath(_aSettings); exportAutoIncrement(); exportDelimiter(); exportCharSet(); @@ -678,19 +664,47 @@ void ODBExport::exportConnectionData() if ( sDatabaseName.Len() ) AddAttribute(XML_NAMESPACE_DB,XML_DATABASE_NAME,sDatabaseName); - Reference< XPropertySet > xDataSourceSettings; - OSL_VERIFY( xProp->getPropertyValue( PROPERTY_SETTINGS ) >>= xDataSourceSettings ); - Reference< XPropertyState > xSettingsState( xDataSourceSettings, UNO_QUERY ); - Reference< XPropertySetInfo > xSettingsInfo; - if ( xDataSourceSettings.is() ) - xSettingsInfo = xDataSourceSettings->getPropertySetInfo(); - static const ::rtl::OUString s_sLocalSocket(RTL_CONSTASCII_USTRINGPARAM("LocalSocket")); - if ( xSettingsInfo.is() && xSettingsInfo->hasPropertyByName(s_sLocalSocket) ) + try { - ::rtl::OUString sSocket; - if ( ( xDataSourceSettings->getPropertyValue(s_sLocalSocket) >>= sSocket ) && sSocket.getLength() ) - AddAttribute(XML_NAMESPACE_DB,XML_LOCAL_SOCKET,sSocket); + Reference< XPropertySet > xDataSourceSettings( xProp->getPropertyValue( PROPERTY_SETTINGS ), UNO_QUERY_THROW ); + Reference< XPropertySetInfo > xSettingsInfo( xDataSourceSettings->getPropertySetInfo(), UNO_SET_THROW ); + struct PropertyMap + { + const sal_Char* pAsciiPropertyName; + sal_uInt16 nAttributeId; + + PropertyMap() :pAsciiPropertyName( NULL ), nAttributeId(0) { } + PropertyMap( const sal_Char* _pAsciiPropertyName, const sal_uInt16 _nAttributeId ) + :pAsciiPropertyName( _pAsciiPropertyName ) + ,nAttributeId( _nAttributeId ) + { + } + }; + PropertyMap aProperties[] = + { + PropertyMap( "LocalSocket", XML_LOCAL_SOCKET ) + //PropertyMap( "NamedPipe", 0 /* TODO */ ) + }; + + for ( size_t i=0; + i < sizeof( aProperties ) / sizeof( aProperties[0] ); + ++i + ) + { + const ::rtl::OUString sPropertyName = ::rtl::OUString::createFromAscii( aProperties[i].pAsciiPropertyName ); + if ( xSettingsInfo->hasPropertyByName( sPropertyName ) ) + { + ::rtl::OUString sPropertyValue; + if ( ( xDataSourceSettings->getPropertyValue( sPropertyName ) >>= sPropertyValue ) && sPropertyValue.getLength() ) + AddAttribute( XML_NAMESPACE_DB, XML_LOCAL_SOCKET, sPropertyValue ); + + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } SvXMLElementExport aServerDB(*this,XML_NAMESPACE_DB, XML_SERVER_DATABASE, sal_True, sal_True); diff --git a/dbaccess/source/filter/xml/xmlExport.hxx b/dbaccess/source/filter/xml/xmlExport.hxx index ae10a9a20709..fb82d50d2fe1 100644 --- a/dbaccess/source/filter/xml/xmlExport.hxx +++ b/dbaccess/source/filter/xml/xmlExport.hxx @@ -173,7 +173,6 @@ class ODBExport : public SvXMLExport void exportDataSource(); void exportConnectionData(); void exportDriverSettings(const TSettingsMap& _aSettings); - void exportJavaClassPath(const TSettingsMap& _aSettings); void exportApplicationConnectionSettings(const TSettingsMap& _aSettings); void exportLogin(); void exportSequence(const Sequence< ::rtl::OUString>& _aValue diff --git a/dbaccess/source/filter/xml/xmlJavaClassPath.cxx b/dbaccess/source/filter/xml/xmlJavaClassPath.cxx deleted file mode 100644 index 9d3ba852e14c..000000000000 --- a/dbaccess/source/filter/xml/xmlJavaClassPath.cxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: xmlJavaClassPath.cxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" -#ifndef DBA_XMLJAVACLASSPATH_HXX_INCLUDED -#include "xmlJavaClassPath.hxx" -#endif -#ifndef DBA_XMLFILTER_HXX -#include "xmlfilter.hxx" -#endif -#ifndef _XMLOFF_XMLTOKEN_HXX -#include -#endif -#ifndef _XMLOFF_XMLNMSPE_HXX -#include -#endif -#ifndef _XMLOFF_NMSPMAP_HXX -#include -#endif -#ifndef DBA_XMLENUMS_HXX -#include "xmlEnums.hxx" -#endif -#ifndef DBACCESS_SHARED_XMLSTRINGS_HRC -#include "xmlstrings.hrc" -#endif -#ifndef _TOOLS_DEBUG_HXX -#include -#endif -#ifndef TOOLS_DIAGNOSE_EX_H -#include -#endif - -namespace dbaxml -{ - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::xml::sax; -DBG_NAME(OXMLJavaClassPath) - -OXMLJavaClassPath::OXMLJavaClassPath( ODBFilter& rImport, - sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName, - const Reference< XAttributeList > & _xAttrList ) : - SvXMLImportContext( rImport, nPrfx, _sLocalName ) -{ - DBG_CTOR(OXMLJavaClassPath,NULL); - - OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!"); - const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap(); - const SvXMLTokenMap& rTokenMap = rImport.GetComponentElemTokenMap(); - - ::rtl::OUString sJavaClassPath; - const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0; - for(sal_Int16 i = 0; i < nLength; ++i) - { - ::rtl::OUString sLocalName; - const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i ); - const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName ); - const rtl::OUString sValue = _xAttrList->getValueByIndex( i ); - switch( rTokenMap.Get( nPrefix, sLocalName ) ) - { - case XML_TOK_HREF: - sJavaClassPath += sValue; - break; - } - if ( sJavaClassPath.getLength() ) - sJavaClassPath += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - } - if ( sJavaClassPath.getLength() ) - { - PropertyValue aProperty; - aProperty.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClassPath")); - aProperty.Value <<= sJavaClassPath; - rImport.addInfo(aProperty); - } -} -// ----------------------------------------------------------------------------- - -OXMLJavaClassPath::~OXMLJavaClassPath() -{ - DBG_DTOR(OXMLJavaClassPath,NULL); -} -// ----------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -} // namespace dbaxml -// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/filter/xml/xmlJavaClassPath.hxx b/dbaccess/source/filter/xml/xmlJavaClassPath.hxx deleted file mode 100644 index fc47a9bb1c63..000000000000 --- a/dbaccess/source/filter/xml/xmlJavaClassPath.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: xmlJavaClassPath.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef DBA_XMLJAVACLASSPATH_HXX_INCLUDED -#define DBA_XMLJAVACLASSPATH_HXX_INCLUDED - -#ifndef _XMLOFF_XMLICTXT_HXX -#include -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ -#include -#endif -#include - -namespace dbaxml -{ - class ODBFilter; - class OXMLJavaClassPath : public SvXMLImportContext - { - public: - - OXMLJavaClassPath( ODBFilter& rImport, sal_uInt16 nPrfx, - const ::rtl::OUString& rLName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); - virtual ~OXMLJavaClassPath(); - }; -// ----------------------------------------------------------------------------- -} // namespace dbaxml -// ----------------------------------------------------------------------------- - -#endif // DBA_XMLJAVACLASSPATH_HXX_INCLUDED - diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index a02b26b9d209..9a6c42e9d39e 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -960,30 +960,29 @@ UniReference < XMLPropertySetMapper > ODBFilter::GetCellStylesPropertySetMapper( void ODBFilter::setPropertyInfo() { Reference xDataSource(getDataSource()); - if ( xDataSource.is() ) + if ( !xDataSource.is() ) + return; + + ::connectivity::DriversConfig aDriverConfig(getServiceFactory()); + const ::rtl::OUString sURL = ::comphelper::getString(xDataSource->getPropertyValue(PROPERTY_URL)); + ::comphelper::NamedValueCollection aDataSourceSettings = aDriverConfig.getProperties( sURL ); + + Sequence aInfo; + if ( !m_aInfoSequence.empty() ) + aInfo = Sequence(&(*m_aInfoSequence.begin()),m_aInfoSequence.size()); + aDataSourceSettings.merge( ::comphelper::NamedValueCollection( aInfo ), true ); + + aDataSourceSettings >>= aInfo; + if ( aInfo.getLength() ) { - ::connectivity::DriversConfig aDriverConfig(getServiceFactory()); - const ::rtl::OUString sURL = ::comphelper::getString(xDataSource->getPropertyValue(PROPERTY_URL)); - ::comphelper::NamedValueCollection aMetaData = aDriverConfig.getMetaData(sURL); - aMetaData.merge( aDriverConfig.getProperties(sURL),true ) ; - Sequence aInfo; - if ( !m_aInfoSequence.empty() ) + try { - aInfo = Sequence(&(*m_aInfoSequence.begin()),m_aInfoSequence.size()); + xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(aInfo)); } - aMetaData.merge(::comphelper::NamedValueCollection(aInfo),true); - aMetaData >>= aInfo; - if ( aInfo.getLength() ) + catch(Exception) { - try - { - xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(aInfo)); - } - catch(Exception) - { - DBG_UNHANDLED_EXCEPTION(); - } - } // if ( !m_aInfoSequence.empty() && xDataSource.is() ) + DBG_UNHANDLED_EXCEPTION(); + } } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx index 575202a4fc43..ec2eb177cd9b 100644 --- a/dbaccess/source/inc/dsntypes.hxx +++ b/dbaccess/source/inc/dsntypes.hxx @@ -73,6 +73,7 @@ enum DATASOURCE_TYPE DST_MSACCESS_2007 = 22, DST_EMBEDDED_HSQLDB = 23, DST_MYSQL_NATIVE = 24, + DST_MYSQL_NATIVE_DIRECT = 25, DST_USERDEFINE1, /// first user defined driver DST_USERDEFINE2, @@ -145,6 +146,9 @@ public: /// on a given string, return the type prefix String getPrefix(const ::rtl::OUString& _sURL) const; + /// determines whether there is a driver for the given URL prefix/pattern + bool hasDriver( const sal_Char* _pAsciiPattern ) const; + /// on a given string, return the Java Driver Class String getJavaDriverClass(const ::rtl::OUString& _sURL) const; diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 3c26b06aa003..8f2528e1f96a 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1617,7 +1617,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const else if ( nId == ID_TREE_EDIT_DATABASE ) { ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithServiceFactory( getORB(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/ApplicationIntegration/InstalledFeatures/Common" ) ) ) ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/Policies/Features/Common" ) ) ) ); sal_Bool bHaveEditDatabase( sal_True ); OSL_VERIFY( aConfig.getNodeValue( "EditDatabaseFromDataSourceView" ) >>= bHaveEditDatabase ); aReturn.bEnabled = getORB().is() && ( pDataSourceEntry != NULL ) && bHaveEditDatabase; 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 #include "finteraction.hxx" #include -#include #include "dbaccess_helpid.hrc" #include #include @@ -240,18 +239,10 @@ 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 ) { @@ -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,30 +502,49 @@ 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) { @@ -527,7 +552,6 @@ DBG_NAME(OMySQLIntroPageSetup) _rControlList.push_back(new OSaveValueWrapper(&m_aETDriverClass)); _rControlList.push_back(new OSaveValueWrapper(&m_aETHostname)); _rControlList.push_back(new OSaveValueWrapper(&m_aNFPortNumber)); - _rControlList.push_back(new OSaveValueWrapper(&m_aETSocket)); } // ----------------------------------------------------------------------- void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) @@ -537,21 +561,17 @@ DBG_NAME(OMySQLIntroPageSetup) _rControlList.push_back(new ODisableWrapper(&m_aFTHostname)); _rControlList.push_back(new ODisableWrapper(&m_aFTPortNumber)); _rControlList.push_back(new ODisableWrapper(&m_aFTDefaultPortNumber)); - _rControlList.push_back(new ODisableWrapper(&m_aFTSocket)); - if ( m_bUseClass ) - _rControlList.push_back(new ODisableWrapper(&m_aFTDriverClass)); + _rControlList.push_back(new ODisableWrapper(&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 -#endif -#ifndef _DBAUI_CURLEDIT_HXX_ +#include "admincontrols.hxx" #include "curledit.hxx" -#endif -#ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX +#include "TextConnectionHelper.hxx" + #include -#endif -#ifndef _SV_FIELD_HXX +#include #include -#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 +#include +#include + +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 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 +* +* 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 +#include +#include + +//........................................................................ +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 +* +* 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 +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef DBACCESS_ADMINCONTROLS_HXX +#define DBACCESS_ADMINCONTROLS_HXX + +#include "adminpages.hxx" + +#include +#include +#include + +#include + +//........................................................................ +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 +* +* 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 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 if something changed otherwise */ - 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 if something changed otherwise */ - 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 #endif +#include /** === begin UNO includes === **/ #ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ @@ -162,8 +163,8 @@ #include #endif #include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include +#include /** === 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(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: @@ -846,10 +850,24 @@ void ODbTypeWizDialogSetup::enableConfirmSettings( bool _bEnable ) (void)_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(&m_aDatabaseName)); - _rControlList.push_back(new OSaveValueWrapper(&m_aEDHostname)); - _rControlList.push_back(new OSaveValueWrapper(&m_aNFPortNumber)); - _rControlList.push_back(new OSaveValueWrapper(&m_aEDSocket)); _rControlList.push_back(new OSaveValueWrapper(&m_aUserName)); _rControlList.push_back(new OSaveValueWrapper(&m_aPasswordRequired)); } // ----------------------------------------------------------------------- void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) { - OCommonBehaviourTabPage::fillWindows(_rControlList); + OCommonBehaviourTabPage::fillWindows( _rControlList ); + m_aMySQLSettings.fillWindows( _rControlList); _rControlList.push_back(new ODisableWrapper(&m_aSeparator1)); - _rControlList.push_back(new ODisableWrapper(&m_aDatabaseNameLabel)); - _rControlList.push_back(new ODisableWrapper(&m_aFTHostname)); - _rControlList.push_back(new ODisableWrapper(&m_aPortNumber)); - _rControlList.push_back(new ODisableWrapper(&m_aFTSocket)); _rControlList.push_back(new ODisableWrapper(&m_aSeparator2)); _rControlList.push_back(new ODisableWrapper(&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 @@ -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 #include -#include #include #include #include @@ -53,6 +52,9 @@ #include #include "DriverSettings.hxx" #include "UITools.hxx" +#include +#include + //......................................................................... 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 \ diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 28917c91396a..4686b540e936 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -341,6 +341,7 @@ // controls #define RID_DB_TAB_EDITOR RID_CONTROL_START + 0 +#define RID_MYSQL_NATIVE_SETTINGS RID_CONTROL_START + 1 //======================================================================== // strings diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx index 2cf3577ba1c6..29dd45cf7e4b 100644 --- a/dbaccess/source/ui/inc/dbwizsetup.hxx +++ b/dbaccess/source/ui/inc/dbwizsetup.hxx @@ -98,6 +98,7 @@ private: String m_sRM_ADABASText; String m_sRM_ADOText; String m_sRM_JDBCText; + String m_sRM_MySQLNativePageTitle; String m_sRM_OracleText; String m_sRM_MySQLText; String m_sRM_ODBCText; -- cgit