summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-25 21:47:16 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-25 21:47:16 +0200
commit6b196c043833bfb73fcfe1146d64e2721a039e96 (patch)
tree3f03890d6d146c6ad710f4312ea39e9b242be33c /dbaccess/source
parent595834be2b412b1bac89ec77e9094b469e03fabf (diff)
parent2a05747f83fbf060c002424f9815cc3778f21e5a (diff)
merge commit
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx8
-rw-r--r--dbaccess/source/core/api/resultcolumn.cxx64
-rw-r--r--dbaccess/source/core/api/resultcolumn.hxx15
-rw-r--r--dbaccess/source/core/dataaccess/ContentHelper.cxx33
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx13
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx47
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.hxx4
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx7
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx2
-rw-r--r--dbaccess/source/core/inc/ContentHelper.hxx3
-rw-r--r--dbaccess/source/core/inc/PropertyForward.hxx1
-rw-r--r--dbaccess/source/core/inc/core_resource.hrc1
-rw-r--r--dbaccess/source/core/inc/core_resource.hxx25
-rw-r--r--dbaccess/source/core/misc/ContainerMediator.cxx6
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx106
-rw-r--r--dbaccess/source/core/resource/core_resource.cxx11
-rw-r--r--dbaccess/source/core/resource/strings.src6
-rw-r--r--dbaccess/source/filter/xml/makefile.mk1
-rw-r--r--dbaccess/source/filter/xml/xmlDataSource.cxx9
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx72
-rw-r--r--dbaccess/source/filter/xml/xmlExport.hxx1
-rw-r--r--dbaccess/source/filter/xml/xmlJavaClassPath.cxx113
-rw-r--r--dbaccess/source/filter/xml/xmlJavaClassPath.hxx58
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx41
-rw-r--r--dbaccess/source/inc/dsntypes.hxx4
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx2
-rw-r--r--dbaccess/source/ui/dlg/AutoControls_tmpl.hrc24
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx220
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx55
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx1
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx26
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.cxx310
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.hrc48
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.hxx81
-rw-r--r--dbaccess/source/ui/dlg/admincontrols.src130
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx20
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx34
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx2
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.src28
-rw-r--r--dbaccess/source/ui/dlg/dbadminsetup.hrc13
-rw-r--r--dbaccess/source/ui/dlg/dbadminsetup.src46
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx66
-rw-r--r--dbaccess/source/ui/dlg/detailpages.cxx70
-rw-r--r--dbaccess/source/ui/dlg/detailpages.hxx10
-rw-r--r--dbaccess/source/ui/dlg/dsitems.hxx3
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx79
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk7
-rw-r--r--dbaccess/source/ui/inc/RelationController.hxx8
-rw-r--r--dbaccess/source/ui/inc/dbu_resource.hrc1
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx1
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx21
-rw-r--r--dbaccess/source/ui/misc/dbumiscres.src2
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx355
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx6
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx71
56 files changed, 1608 insertions, 788 deletions
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 574bd1778..d62ee8d8b 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -344,7 +344,7 @@ void OSingleSelectQueryComposer::setQuery_Impl( const ::rtl::OUString& command )
// update columns and tables
// why? Shouldn't this be done on request only?
// otherwise nothing is working anymore :-)
- getColumns();
+// getColumns();
getTables();
}
// -----------------------------------------------------------------------------
@@ -380,6 +380,7 @@ void SAL_CALL OSingleSelectQueryComposer::appendFilterByColumn( const Reference<
{
::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed);
+ getColumns();
if ( !column.is()
|| !m_aCurrentColumns[SelectColumns]
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
@@ -734,7 +735,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
if ( aSelectColumns->get().empty() )
{
- // This is a valid casse. If we can syntactically parse the query, but not semantically
+ // This is a valid case. If we can syntactically parse the query, but not semantically
// (e.g. because it is based on a table we do not know), then there will be no SelectColumns
aSelectColumns = ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, m_xMetaData );
break;
@@ -1476,7 +1477,8 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
column->getPropertyValue(PROPERTY_VALUE) >>= aValue;
::rtl::OUStringBuffer aSQL;
- ::rtl::OUString aQuote = m_xMetaData->getIdentifierQuoteString();
+ const ::rtl::OUString aQuote = m_xMetaData->getIdentifierQuoteString();
+ getColumns();
if ( m_aCurrentColumns[SelectColumns] && m_aCurrentColumns[SelectColumns]->hasByName(aName) )
{
diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx
index 671951b69..b49d92867 100644
--- a/dbaccess/source/core/api/resultcolumn.cxx
+++ b/dbaccess/source/core/api/resultcolumn.cxx
@@ -237,64 +237,84 @@ void OResultColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
break;
case PROPERTY_ID_ISSIGNED:
{
- sal_Bool bVal = m_xMetaData->isSigned(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isSigned )
+ m_isSigned.reset( m_xMetaData->isSigned(m_nPos));
+ rValue <<= *m_isSigned;
} break;
case PROPERTY_ID_ISCURRENCY:
{
- sal_Bool bVal = m_xMetaData->isCurrency(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isCurrency )
+ m_isCurrency.reset( m_xMetaData->isCurrency(m_nPos));
+ rValue <<= *m_isCurrency;
} break;
case PROPERTY_ID_ISSEARCHABLE:
{
- sal_Bool bVal = m_xMetaData->isSearchable(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_bSearchable )
+ m_bSearchable.reset( m_xMetaData->isSearchable(m_nPos));
+ rValue <<= *m_bSearchable;
} break;
case PROPERTY_ID_ISCASESENSITIVE:
{
- sal_Bool bVal = m_xMetaData->isCaseSensitive(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isCaseSensitive )
+ m_isCaseSensitive.reset( m_xMetaData->isCaseSensitive(m_nPos));
+ rValue <<= *m_isCaseSensitive;
} break;
case PROPERTY_ID_ISREADONLY:
{
- sal_Bool bVal = m_xMetaData->isReadOnly(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isReadOnly )
+ m_isReadOnly.reset( m_xMetaData->isReadOnly(m_nPos));
+ rValue <<= *m_isReadOnly;
} break;
case PROPERTY_ID_ISWRITABLE:
{
- sal_Bool bVal = m_xMetaData->isWritable(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isWritable )
+ m_isWritable.reset( m_xMetaData->isWritable(m_nPos));
+ rValue <<= *m_isWritable;
} break;
case PROPERTY_ID_ISDEFINITELYWRITABLE:
{
- sal_Bool bVal = m_xMetaData->isDefinitelyWritable(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isDefinitelyWritable )
+ m_isDefinitelyWritable.reset( m_xMetaData->isDefinitelyWritable(m_nPos));
+ rValue <<= *m_isDefinitelyWritable;
} break;
case PROPERTY_ID_ISAUTOINCREMENT:
{
- sal_Bool bVal = m_xMetaData->isAutoIncrement(m_nPos);
- rValue.setValue(&bVal, getBooleanCppuType());
+ if ( !m_isAutoIncrement )
+ m_isAutoIncrement.reset( m_xMetaData->isAutoIncrement(m_nPos));
+ rValue <<= *m_isAutoIncrement;
} break;
case PROPERTY_ID_SERVICENAME:
rValue <<= m_xMetaData->getColumnServiceName(m_nPos);
break;
case PROPERTY_ID_LABEL:
- rValue <<= m_xMetaData->getColumnLabel(m_nPos);
+ if ( !m_sColumnLabel )
+ m_sColumnLabel.reset( m_xMetaData->getColumnLabel(m_nPos));
+ rValue <<= *m_sColumnLabel;
break;
case PROPERTY_ID_DISPLAYSIZE:
- rValue <<= m_xMetaData->getColumnDisplaySize(m_nPos);
+ if ( !m_nColumnDisplaySize )
+ m_nColumnDisplaySize.reset( m_xMetaData->getColumnDisplaySize(m_nPos));
+ rValue <<= *m_nColumnDisplaySize;
break;
case PROPERTY_ID_TYPE:
- rValue <<= m_xMetaData->getColumnType(m_nPos);
+ if ( !m_nColumnType )
+ m_nColumnType.reset( m_xMetaData->getColumnType(m_nPos));
+ rValue <<= *m_nColumnType;
break;
case PROPERTY_ID_PRECISION:
- rValue <<= m_xMetaData->getPrecision(m_nPos);
+ if ( !m_nPrecision )
+ m_nPrecision.reset( m_xMetaData->getPrecision(m_nPos));
+ rValue <<= *m_nPrecision;
break;
case PROPERTY_ID_SCALE:
- rValue <<= m_xMetaData->getScale(m_nPos);
+ if ( !m_nScale )
+ m_nScale.reset( m_xMetaData->getScale(m_nPos));
+ rValue <<= *m_nScale;
break;
case PROPERTY_ID_ISNULLABLE:
- rValue <<= m_xMetaData->isNullable(m_nPos);
+ if ( !m_isNullable )
+ m_isNullable.reset( m_xMetaData->isNullable(m_nPos));
+ rValue <<= *m_isNullable;
break;
case PROPERTY_ID_TYPENAME:
rValue <<= m_xMetaData->getColumnTypeName(m_nPos);
diff --git a/dbaccess/source/core/api/resultcolumn.hxx b/dbaccess/source/core/api/resultcolumn.hxx
index c74addc7c..abbe8c78d 100644
--- a/dbaccess/source/core/api/resultcolumn.hxx
+++ b/dbaccess/source/core/api/resultcolumn.hxx
@@ -37,6 +37,7 @@
#ifndef _DBA_COREAPI_COLUMN_HXX_
#include <column.hxx>
#endif
+#include <boost/optional.hpp>
namespace dbaccess
{
//************************************************************
@@ -50,6 +51,20 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xDBMetaData;
sal_Int32 m_nPos;
::com::sun::star::uno::Any m_aIsRowVersion;
+ mutable ::boost::optional< sal_Bool > m_isSigned;
+ mutable ::boost::optional< sal_Bool > m_isCurrency;
+ mutable ::boost::optional< sal_Bool > m_bSearchable;
+ mutable ::boost::optional< sal_Bool > m_isCaseSensitive;
+ mutable ::boost::optional< sal_Bool > m_isReadOnly;
+ mutable ::boost::optional< sal_Bool > m_isWritable;
+ mutable ::boost::optional< sal_Bool > m_isDefinitelyWritable;
+ mutable ::boost::optional< sal_Bool > m_isAutoIncrement;
+ mutable ::boost::optional< sal_Int32 > m_isNullable;
+ mutable ::boost::optional< ::rtl::OUString > m_sColumnLabel;
+ mutable ::boost::optional< sal_Int32 > m_nColumnDisplaySize;
+ mutable ::boost::optional< sal_Int32 > m_nColumnType;
+ mutable ::boost::optional< sal_Int32 > m_nPrecision;
+ mutable ::boost::optional< sal_Int32 > m_nScale;
virtual ~OResultColumn();
public:
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index fe3e7c9b9..c63c655d5 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<XPropertySet> xProp(xParent,UNO_QUERY);
- Reference<XChild> xChild(xParent,UNO_QUERY);
- xParent.set(xChild.is() ? xChild->getParent() : Reference< XInterface >(),UNO_QUERY);
+ Reference<XPropertySet> 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 1148cf440..aa7323bd5 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 ) ),
@@ -1398,7 +1400,7 @@ sal_Bool ODatabaseModelImpl::setCurrentMacroExecMode( sal_uInt16 nMacroMode )
}
// -----------------------------------------------------------------------------
-Reference< XStorage > ODatabaseModelImpl::getLastCommitDocumentStorage()
+Reference< XStorage > ODatabaseModelImpl::getZipStorageToSign()
{
// we do not support signing the scripting storages, so we're allowed to
// return <NULL/> here.
@@ -1442,13 +1444,20 @@ Reference< XEmbeddedScripts > ODatabaseModelImpl::getEmbeddedDocumentScripts() c
}
// -----------------------------------------------------------------------------
-sal_Int16 ODatabaseModelImpl::getScriptingSignatureState() const
+sal_Int16 ODatabaseModelImpl::getScriptingSignatureState()
{
// no support for signatures at the moment
return SIGNATURESTATE_NOSIGNATURES;
}
// -----------------------------------------------------------------------------
+sal_Bool ODatabaseModelImpl::hasTrustedScriptingSignature( sal_Bool /*bAllowUIToAddAuthor*/ )
+{
+ // no support for signatures at the moment
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
void ODatabaseModelImpl::showBrokenSignatureWarning( const Reference< XInteractionHandler >& /*_rxInteraction*/ ) const
{
OSL_ENSURE( false, "ODatabaseModelImpl::showBrokenSignatureWarning: signatures can't be broken - we do not support them!" );
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index de30a2ed2..287a1fc26 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -507,10 +507,11 @@ public:
virtual sal_Int16 getCurrentMacroExecMode() const;
virtual sal_Bool setCurrentMacroExecMode( sal_uInt16 );
virtual ::rtl::OUString getDocumentLocation() const;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getLastCommitDocumentStorage();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getZipStorageToSign();
virtual sal_Bool documentStorageHasMacros() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const;
- virtual sal_Int16 getScriptingSignatureState() const;
+ virtual sal_Int16 getScriptingSignatureState();
+ virtual sal_Bool hasTrustedScriptingSignature( sal_Bool bAllowUIToAddAuthor );
virtual void showBrokenSignatureWarning( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction ) const;
// IModifiableDocument
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 7aaf0d2e4..3deda0791 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 133b229d5..550aaa70e 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 33567da20..cbf30c87d 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 c8bcd6046..b72a620ad 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 176cc6280..e1657169c 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/PropertyForward.hxx b/dbaccess/source/core/inc/PropertyForward.hxx
index eb0656b1f..0ca98fec6 100644
--- a/dbaccess/source/core/inc/PropertyForward.hxx
+++ b/dbaccess/source/core/inc/PropertyForward.hxx
@@ -82,6 +82,7 @@ namespace dbaccess
inline void setName(const ::rtl::OUString& _sName) { m_sName = _sName; }
void setDefinition(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xDest);
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getDefinition() const { return m_xDest;}
};
//........................................................................
} // namespace dbaccess
diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc
index b18a1d2ed..39814c63b 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 2c82dcbcb..96dbd174e 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/ContainerMediator.cxx b/dbaccess/source/core/misc/ContainerMediator.cxx
index 95515dd89..d0841ab67 100644
--- a/dbaccess/source/core/misc/ContainerMediator.cxx
+++ b/dbaccess/source/core/misc/ContainerMediator.cxx
@@ -289,7 +289,7 @@ Reference< XPropertySet > OContainerMediator::impl_getSettingsForInitialization_
void OContainerMediator::notifyElementCreated(const ::rtl::OUString& _sName,const Reference<XPropertySet>& _xDest)
{
PropertyForwardList::iterator aFind = m_aForwardList.find(_sName);
- if ( aFind == m_aForwardList.end() && m_xSettings.is() )
+ if ( (aFind == m_aForwardList.end() || !aFind->second->getDefinition().is() )&& m_xSettings.is() )
{
::std::vector< ::rtl::OUString> aPropertyList;
@@ -321,8 +321,8 @@ void OContainerMediator::notifyElementCreated(const ::rtl::OUString& _sName,cons
}
::rtl::Reference< OPropertyForward > pForward( new OPropertyForward( _xDest, m_xSettings, _sName, aPropertyList ) );
- m_aForwardList.insert( PropertyForwardList::value_type( _sName, pForward ) );
- }
+ m_aForwardList[_sName] = pForward;
+ } // if ( aFind == m_aForwardList.end() && m_xSettings.is() )
}
// -----------------------------------------------------------------------------
//........................................................................
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index e49b3fa8a..ad7b6145b 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 474a5d3b3..0cbbd0f07 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 cb2c768c7..2d14b2784 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 41388880a..8b6d4df71 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 e470ef8e0..0f77bf86b 100644
--- a/dbaccess/source/filter/xml/xmlDataSource.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSource.cxx
@@ -73,7 +73,7 @@
#include <tools/diagnose_ex.h>
#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 f671ae235..68cd26f44 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,21 +664,49 @@ 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 052bfd52b..23e5755e1 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 0c80700d7..000000000
--- 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#ifndef DBA_XMLJAVACLASSPATH_HXX_INCLUDED
-#include "xmlJavaClassPath.hxx"
-#endif
-#ifndef DBA_XMLFILTER_HXX
-#include "xmlfilter.hxx"
-#endif
-#ifndef _XMLOFF_XMLTOKEN_HXX
-#include <xmloff/xmltoken.hxx>
-#endif
-#ifndef _XMLOFF_XMLNMSPE_HXX
-#include <xmloff/xmlnmspe.hxx>
-#endif
-#ifndef _XMLOFF_NMSPMAP_HXX
-#include <xmloff/nmspmap.hxx>
-#endif
-#ifndef DBA_XMLENUMS_HXX
-#include "xmlEnums.hxx"
-#endif
-#ifndef DBACCESS_SHARED_XMLSTRINGS_HRC
-#include "xmlstrings.hrc"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#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 7a4b5aec3..000000000
--- 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBA_XMLJAVACLASSPATH_HXX_INCLUDED
-#define DBA_XMLJAVACLASSPATH_HXX_INCLUDED
-
-#ifndef _XMLOFF_XMLICTXT_HXX
-#include <xmloff/xmlictxt.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
-#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#include <vector>
-
-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 c4f9c323b..6eed831a1 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -518,7 +518,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
{
try
{
- xStorage = pMedium->GetStorage();
+ xStorage = pMedium->GetStorage( sal_False );
// nError = pMedium->GetError();
}
catch(const Exception&)
@@ -960,30 +960,29 @@ UniReference < XMLPropertySetMapper > ODBFilter::GetCellStylesPropertySetMapper(
void ODBFilter::setPropertyInfo()
{
Reference<XPropertySet> 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<PropertyValue> aInfo;
+ if ( !m_aInfoSequence.empty() )
+ aInfo = Sequence<PropertyValue>(&(*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<PropertyValue> aInfo;
- if ( !m_aInfoSequence.empty() )
+ try
{
- aInfo = Sequence<PropertyValue>(&(*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 81cd04933..423144eda 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 73bb97694..a889b2d15 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 da0334d21..c22fbbc89 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,13 +505,13 @@
};
-#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_JDBCDRIVERCLASSGROUP(146, AUTO_HID + 3)
-
+ AUTO_SOCKETCONTROLGROUP(129) \
+ AUTO_JDBCDRIVERCLASSGROUP(146, AUTO_HID + 3)
// --------------------------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 3b649c6f7..438c498d1 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -108,7 +108,6 @@
#include <ucbhelper/commandenvironment.hxx>
#include "finteraction.hxx"
#include <connectivity/CommonTools.hxx>
-#include <connectivity/DriversConfig.hxx>
#include "dbaccess_helpid.hrc"
#include <svtools/pathoptions.hxx>
#include <svtools/roadmapwizard.hxx>
@@ -240,19 +239,11 @@ DBG_NAME(OTextConnectionPageSetup)
m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
- // #98982# OJ
- m_aNFPortNumber.SetUseThousandSep(sal_False);
SetRoadmapStateValue(sal_False);
FreeResource();
}
// -----------------------------------------------------------------------
- /* OGenericAdministrationPage* ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet )
- {
- return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) );
- }*/
-
- // -----------------------------------------------------------------------
sal_Bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = sal_False;
@@ -344,9 +335,9 @@ DBG_NAME(OMySQLIntroPageSetup)
DBG_CTOR(OMySQLIntroPageSetup,NULL);
SetControlFontWeight(&m_aFT_Headertext);
+ m_aRB_ODBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
m_aRB_JDBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
m_aRB_NATIVEDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
- m_aRB_JDBCDatabase.SetState(sal_True);
FreeResource();
}
@@ -367,17 +358,21 @@ DBG_NAME(OMySQLIntroPageSetup)
// -----------------------------------------------------------------------
void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
{
+ // show the "Connect directly" option only if the driver is installed
DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
- if (pCollectionItem)
- {
- ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
- if ( pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"))).Len() )
- {
- m_aRB_NATIVEDatabase.Show();
- m_aRB_JDBCDatabase.SetState(sal_False);
- m_aRB_NATIVEDatabase.SetState(sal_True);
- }
- }
+ bool bHasMySQLNative = ( pCollectionItem != NULL ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" );
+ if ( bHasMySQLNative )
+ m_aRB_NATIVEDatabase.Show();
+
+ // if any of the options is checked, then there's nothing to do
+ if ( m_aRB_ODBCDatabase.IsChecked() || m_aRB_JDBCDatabase.IsChecked() || m_aRB_NATIVEDatabase.IsChecked() )
+ return;
+
+ // prefer "native" or "JDBC"
+ if ( bHasMySQLNative )
+ m_aRB_NATIVEDatabase.Check();
+ else
+ m_aRB_JDBCDatabase.Check();
}
@@ -410,54 +405,79 @@ DBG_NAME(OMySQLIntroPageSetup)
return VIA_ODBC;
}
+ // =======================================================================
+ // = MySQLNativeSetupPage
+ // =======================================================================
+ // -----------------------------------------------------------------------
+ MySQLNativeSetupPage::MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs )
+ :OGenericAdministrationPage( _pParent, ModuleRes( PAGE_DBWIZARD_MYSQL_NATIVE ), _rCoreAttrs )
+ ,m_aHeader ( this, ModuleRes( FT_SETUP_WIZARD_HEADER ) )
+ ,m_aHelpText ( this, ModuleRes( FT_SETUP_WIZARD_HELP ) )
+ ,m_aMySQLSettings ( *this, getControlModifiedLink() )
+ {
+ SetControlFontWeight( &m_aHeader );
+
+ LayoutHelper::positionBelow( m_aHelpText, m_aMySQLSettings, UnrelatedControls, 0 );
+ m_aMySQLSettings.Show();
+
+ SetRoadmapStateValue(sal_False);
+ FreeResource();
+ }
// -----------------------------------------------------------------------
- OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
+ OGenericAdministrationPage* MySQLNativeSetupPage::Create( Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
- PAGE_DBWIZARD_MYSQL_JDBC,
- _rAttrSet,
- DSID_MYSQL_PORTNUMBER ,
- STR_MYSQL_DEFAULT,
- STR_MYSQLJDBC_HELPTEXT,
- STR_MYSQLJDBC_HEADERTEXT,
- STR_MYSQL_DRIVERCLASSTEXT) );
+ return new MySQLNativeSetupPage( pParent, _rAttrSet );
}
// -----------------------------------------------------------------------
- OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLNATIVETabPage( Window* pParent, const SfxItemSet& _rAttrSet )
+ void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
- return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
- PAGE_DBWIZARD_MYSQL_NATIVE,
- _rAttrSet,
- DSID_MYSQL_PORTNUMBER ,
- STR_MYSQL_DEFAULT,
- STR_MYSQLJDBC_HELPTEXT,
- STR_MYSQLJDBC_HEADERTEXT,
- 0) );
+ m_aMySQLSettings.fillControls( _rControlList );
}
+ // -----------------------------------------------------------------------
+ void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
+ {
+ _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHelpText ) );
+ m_aMySQLSettings.fillWindows( _rControlList );
+ }
// -----------------------------------------------------------------------
- OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
+ sal_Bool MySQLNativeSetupPage::FillItemSet( SfxItemSet& _rSet )
{
- return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
- PAGE_DBWIZARD_ORACLE,
- _rAttrSet,
- DSID_ORACLE_PORTNUMBER,
- STR_ORACLE_DEFAULT,
- STR_ORACLE_HELPTEXT,
- STR_ORACLE_HEADERTEXT,
- STR_ORACLE_DRIVERCLASSTEXT) );
+ return m_aMySQLSettings.FillItemSet( _rSet );
+ }
+
+ // -----------------------------------------------------------------------
+ void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue )
+ {
+ m_aMySQLSettings.implInitControls( _rSet );
+
+ OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
+
+ OnModified( NULL );
+ }
+
+ // -----------------------------------------------------------------------
+ Link MySQLNativeSetupPage::getControlModifiedLink()
+ {
+ return LINK( this, MySQLNativeSetupPage, OnModified );
}
+ // -----------------------------------------------------------------------
+ IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit )
+ {
+ SetRoadmapStateValue( m_aMySQLSettings.canAdvance() );
+
+ return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit );
+ }
//========================================================================
//= OMySQLJDBCConnectionPageSetup
//========================================================================
OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId)
:OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs)
- ,m_pFTHeaderText (NULL)
,m_aFTHelpText (this, ModuleRes(FT_AUTOWIZARDHELPTEXT))
,m_aFTDatabasename (this, ModuleRes(FT_AUTODATABASENAME))
,m_aETDatabasename (this, ModuleRes(ET_AUTODATABASENAME))
@@ -466,26 +486,12 @@ DBG_NAME(OMySQLIntroPageSetup)
,m_aFTPortNumber (this, ModuleRes(FT_AUTOPORTNUMBER))
,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
,m_aNFPortNumber (this, ModuleRes(NF_AUTOPORTNUMBER))
- ,m_aFTSocket (this, ModuleRes(FT_SOCKET))
- ,m_aETSocket (this, ModuleRes(ET_SOCKET))
,m_aFTDriverClass (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
,m_aETDriverClass (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
,m_aPBTestJavaDriver (this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
,m_nPortId(_nPortId)
- ,m_bUseClass(true)
{
- if ( _nDriverClassId )
- m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId)));
- else
- {
- m_bUseClass = false;
- m_aFTDriverClass.Show(FALSE);
- m_aPBTestJavaDriver.Show(FALSE);
- m_aETDriverClass.Show(FALSE);
- }
-
- m_aFTSocket.Show(_nResId == PAGE_DBWIZARD_MYSQL_NATIVE && !m_bUseClass);
- m_aETSocket.Show(_nResId == PAGE_DBWIZARD_MYSQL_NATIVE && !m_bUseClass);
+ m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId)));
m_aFTDefaultPortNumber.SetText(String(ModuleRes(_nDefaultPortResId)));
String sHelpText = String(ModuleRes(_nHelpTextResId));
@@ -496,38 +502,56 @@ DBG_NAME(OMySQLIntroPageSetup)
m_aETDatabasename.SetModifyHdl(getControlModifiedLink());
m_aETHostname.SetModifyHdl(getControlModifiedLink());
m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
- m_aETSocket.SetModifyHdl(getControlModifiedLink());
- if ( m_bUseClass )
- {
- m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified));
- m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl));
- }
+ m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified));
+ m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl));
- m_aNFPortNumber.SetUseThousandSep(sal_False);
- if ( m_bUseClass )
+ SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
+ SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
+ if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
{
- SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
- SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
- ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
- if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
- {
- m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
- }
+ m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
}
+
SetRoadmapStateValue(sal_False);
FreeResource();
}
// -----------------------------------------------------------------------
+ OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
+ {
+ return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
+ PAGE_DBWIZARD_MYSQL_JDBC,
+ _rAttrSet,
+ DSID_MYSQL_PORTNUMBER ,
+ STR_MYSQL_DEFAULT,
+ STR_MYSQLJDBC_HELPTEXT,
+ STR_MYSQLJDBC_HEADERTEXT,
+ STR_MYSQL_DRIVERCLASSTEXT) );
+ }
+
+ // -----------------------------------------------------------------------
+ OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
+ {
+ return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
+ PAGE_DBWIZARD_ORACLE,
+ _rAttrSet,
+ DSID_ORACLE_PORTNUMBER,
+ STR_ORACLE_DEFAULT,
+ STR_ORACLE_HELPTEXT,
+ STR_ORACLE_HEADERTEXT,
+ STR_ORACLE_DRIVERCLASSTEXT) );
+ }
+
+ // -----------------------------------------------------------------------
void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDatabasename));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostname));
_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
- _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETSocket));
}
// -----------------------------------------------------------------------
void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
@@ -537,21 +561,17 @@ DBG_NAME(OMySQLIntroPageSetup)
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
- _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
- if ( m_bUseClass )
- _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
+ _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
}
// -----------------------------------------------------------------------
sal_Bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = sal_False;
- if ( m_bUseClass )
- fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
+ fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
fillString(_rSet,&m_aETHostname,DSID_CONN_HOSTNAME,bChangedSomething);
fillString(_rSet,&m_aETDatabasename,DSID_DATABASENAME,bChangedSomething);
fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
- fillString(_rSet,&m_aETSocket,DSID_CONN_SOCKET,bChangedSomething);
return bChangedSomething;
}
@@ -562,42 +582,36 @@ DBG_NAME(OMySQLIntroPageSetup)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
- const SfxStringItem *pDrvItem = NULL;
- if ( m_bUseClass )
- pDrvItem = (const SfxStringItem*) (_rSet).GetItem( DSID_JDBCDRIVERCLASS, sal_True, TYPE(SfxStringItem) );
-
+ SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True);
+ SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
- SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
if ( bValid )
{
- if ( m_bUseClass )
- {
- m_aETDriverClass.SetText(pDrvItem->GetValue());
- m_aETDriverClass.ClearModifyFlag();
- }
+ m_aETDatabasename.SetText(pDatabaseName->GetValue());
+ m_aETDatabasename.ClearModifyFlag();
+
+ m_aETDriverClass.SetText(pDrvItem->GetValue());
+ m_aETDriverClass.ClearModifyFlag();
m_aETHostname.SetText(pHostName->GetValue());
m_aETHostname.ClearModifyFlag();
m_aNFPortNumber.SetValue(pPortNumber->GetValue());
m_aNFPortNumber.ClearModifyFlag();
-
- m_aETSocket.SetText(pSocket->GetValue());
- m_aETSocket.ClearModifyFlag();
}
OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
// to get the correct value when saveValue was called by base class
- if ( m_bUseClass && !m_aETDriverClass.GetText().Len() )
+ if ( !m_aETDriverClass.GetText().Len() )
{
m_aETDriverClass.SetText(m_sDefaultJdbcDriverName);
m_aETDriverClass.SetModifyFlag();
}
callModifiedHdl();
- sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( !m_bUseClass || m_aETDriverClass.GetText().Len() != 0 ));
+ sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
SetRoadmapStateValue(bRoadmapState);
}
@@ -605,7 +619,6 @@ DBG_NAME(OMySQLIntroPageSetup)
IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
- OSL_ENSURE(m_bUseClass,"Who called this one?");
sal_Bool bSuccess = sal_False;
try
@@ -630,15 +643,14 @@ DBG_NAME(OMySQLIntroPageSetup)
// -----------------------------------------------------------------------
IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
{
- if ( m_bUseClass && _pEdit == &m_aETDriverClass )
+ if ( _pEdit == &m_aETDriverClass )
m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
- sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( !m_bUseClass || m_aETDriverClass.GetText().Len() != 0 ));
+ sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
SetRoadmapStateValue(bRoadmapState);
callModifiedHdl();
return 0L;
}
-
// -----------------------------------------------------------------------
OGenericAdministrationPage* OJDBCConnectionPageSetup::CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
{
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 5813af68c..b8a1d1d78 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -35,24 +35,14 @@
#include "ConnectionPageSetup.hxx"
#endif
-#ifndef _DBAUI_ADMINPAGES_HXX_
#include "adminpages.hxx"
-#endif
-#ifndef _UCBHELPER_CONTENT_HXX
-#include <ucbhelper/content.hxx>
-#endif
-#ifndef _DBAUI_CURLEDIT_HXX_
+#include "admincontrols.hxx"
#include "curledit.hxx"
-#endif
-#ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX
+#include "TextConnectionHelper.hxx"
+
#include <svtools/roadmapwizard.hxx>
-#endif
-#ifndef _SV_FIELD_HXX
+#include <ucbhelper/content.hxx>
#include <vcl/field.hxx>
-#endif
-#ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
-#include "TextConnectionHelper.hxx"
-#endif
//.........................................................................
@@ -140,6 +130,33 @@ namespace dbaui
CheckBox m_aCBUseSSL;
};
+ //========================================================================
+ //= MySQLNativeSetupPage
+ //========================================================================
+ class MySQLNativeSetupPage : public OGenericAdministrationPage
+ {
+ private:
+ FixedText m_aHeader;
+ FixedText m_aHelpText;
+ MySQLNativeSettings m_aMySQLSettings;
+
+ public:
+ MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs );
+
+ static OGenericAdministrationPage* Create( Window* pParent, const SfxItemSet& _rAttrSet );
+
+ protected:
+ virtual void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList );
+ virtual void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList );
+
+ virtual BOOL FillItemSet( SfxItemSet& _rCoreAttrs );
+ virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
+
+ virtual Link getControlModifiedLink();
+
+ private:
+ DECL_LINK( OnModified, Edit* );
+ };
//========================================================================
//= OGeneralSpecialJDBCConnectionPageSetup
@@ -156,22 +173,17 @@ namespace dbaui
, USHORT _nHeaderTextResId
, USHORT _nDriverClassId );
static OGenericAdministrationPage* CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
- static OGenericAdministrationPage* CreateMySQLNATIVETabPage( Window* pParent, const SfxItemSet& _rAttrSet );
static OGenericAdministrationPage* CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet );
- virtual Link getControlModifiedLink() { return LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified); }
-
protected:
-
-
virtual BOOL FillItemSet( SfxItemSet& _rCoreAttrs );
virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
+ virtual Link getControlModifiedLink() { return LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified); }
DECL_LINK(OnTestJavaClickHdl,PushButton*);
DECL_LINK(OnEditModified,Edit*);
- FixedText* m_pFTHeaderText;
FixedText m_aFTHelpText;
FixedText m_aFTDatabasename;
Edit m_aETDatabasename;
@@ -180,8 +192,6 @@ namespace dbaui
FixedText m_aFTPortNumber;
FixedText m_aFTDefaultPortNumber;
NumericField m_aNFPortNumber;
- FixedText m_aFTSocket;
- Edit m_aETSocket;
FixedText m_aFTDriverClass;
@@ -190,7 +200,6 @@ namespace dbaui
String m_sDefaultJdbcDriverName;
USHORT m_nPortId;
- bool m_bUseClass;
};
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index d205a12bb..061950b28 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 8c5b6f8d5..cd0caca1d 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -36,11 +36,18 @@
#include "datasourceui.hxx"
#include <connectivity/DriversConfig.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::NamedValue;
+
using namespace dbaui;
void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory, ::std::vector< sal_Int32>& _out_rDetailsIds )
{
// for a number of settings, we do not need to use hard-coded here, but can ask a
// central DataSourceUI instance.
+ // TODO: isn't DataSourceUI obsolete, now that this is in the configuration?
DataSourceMetaData aMeta(_sURLPrefix);
DataSourceUI aDSUI( aMeta );
const USHORT nGenericKnownSettings[] =
@@ -67,9 +74,23 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
if ( aDSUI.hasSetting( *pGenericKnowSetting ) )
_out_rDetailsIds.push_back( *pGenericKnowSetting );
- // the rest is hard-coded. On the long run, all of this should be done via DataSourceUI::hasSetting
+ // the rest is configuration-based
::connectivity::DriversConfig aDriverConfig(_xFactory);
const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
+#if OSL_DEBUG_LEVEL > 0
+ {
+ Sequence< NamedValue > aNamedValues;
+ aProperties >>= aNamedValues;
+ for ( const NamedValue* loop = aNamedValues.getConstArray();
+ loop != aNamedValues.getConstArray() + aNamedValues.getLength();
+ ++loop
+ )
+ {
+ int dummy = 0;
+ (void)dummy;
+ }
+ }
+#endif
typedef ::std::pair<USHORT, ::rtl::OUString> TProperties;
TProperties aProps[] = { TProperties(DSID_SHOWDELETEDROWS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted")))
,TProperties(DSID_CHARSET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")))
@@ -87,6 +108,7 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
,TProperties(DSID_CONN_CTRLPWD,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")))
,TProperties(DSID_USECATALOG,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog")))
,TProperties(DSID_CONN_SOCKET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalSocket")))
+ ,TProperties(DSID_NAMED_PIPE,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedPipe")))
,TProperties(DSID_JDBCDRIVERCLASS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")))
,TProperties(DSID_CONN_LDAP_BASEDN,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN")))
,TProperties(DSID_CONN_LDAP_ROWCOUNT,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount")))
@@ -94,6 +116,8 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
,TProperties(DSID_IGNORECURRENCY,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency")))
,TProperties(0,::rtl::OUString())
};
+ // TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper.
+ // We should not duplicate it here.
for ( TProperties* pProps = aProps; pProps->first; ++pProps )
{
if ( aProperties.has(pProps->second) )
diff --git a/dbaccess/source/ui/dlg/admincontrols.cxx b/dbaccess/source/ui/dlg/admincontrols.cxx
new file mode 100644
index 000000000..00feec0fa
--- /dev/null
+++ b/dbaccess/source/ui/dlg/admincontrols.cxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+
+#include "admincontrols.hxx"
+#include "admincontrols.hrc"
+#include "dbu_dlg.hrc"
+#include "dsitems.hxx"
+#include "moduledbu.hxx"
+
+#include <svtools/eitem.hxx>
+#include <svtools/stritem.hxx>
+#include <svtools/intitem.hxx>
+
+//........................................................................
+namespace dbaui
+{
+//........................................................................
+
+ //====================================================================
+ //= TextResetOperatorEventFilter
+ //====================================================================
+ class TextResetOperatorEventFilter : public ::svt::IWindowEventFilter
+ {
+ public:
+ TextResetOperatorEventFilter()
+ {
+ }
+
+ // IWindowEventFilter
+ virtual bool payAttentionTo( const VclWindowEvent& _rEvent ) const
+ {
+ return ( _rEvent.GetId() == VCLEVENT_WINDOW_ENABLED )
+ || ( _rEvent.GetId() == VCLEVENT_WINDOW_DISABLED )
+ || ( _rEvent.GetId() == VCLEVENT_EDIT_MODIFY );
+ }
+ };
+
+ //====================================================================
+ //= TextResetOperator
+ //====================================================================
+ class TextResetOperator :public ::svt::IWindowOperator
+ {
+ public:
+ TextResetOperator( const String& _rDisabledText )
+ :m_sDisabledText( _rDisabledText )
+ {
+ }
+
+ // IWindowOperator
+ virtual void operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const;
+
+ private:
+ const String m_sDisabledText;
+ String m_sUserText;
+ BOOL m_bLastKnownEnabledState;
+ };
+
+ //--------------------------------------------------------------------
+ void TextResetOperator::operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const
+ {
+ OSL_ENSURE( _rTrigger.GetWindow() == &_rOperateOn, "TextResetOperator::operateOn: you're misusing this implementation!" );
+
+ switch ( _rTrigger.GetId() )
+ {
+ case 0:
+ // initial call
+ const_cast< TextResetOperator* >( this )->m_sUserText = _rTrigger.GetWindow()->GetText();
+ break;
+
+ case VCLEVENT_EDIT_MODIFY:
+ if ( _rTrigger.GetWindow()->IsEnabled() )
+ const_cast< TextResetOperator* >( this )->m_sUserText = _rTrigger.GetWindow()->GetText();
+ break;
+
+ case VCLEVENT_WINDOW_ENABLED:
+ _rOperateOn.SetText( m_sUserText );
+ break;
+
+ case VCLEVENT_WINDOW_DISABLED:
+ _rOperateOn.SetText( m_sDisabledText );
+ break;
+
+ default:
+ OSL_ENSURE( false, "TextResetOperator::operateOn: unexpected event ID!" );
+ // all those IDs should have been filtered out by payAttentionTo
+ break;
+ }
+ }
+
+ //====================================================================
+ //= TextResetOperatorController
+ //====================================================================
+ class TextResetOperatorController_Base
+ {
+ protected:
+ TextResetOperatorController_Base( const String& _rDisabledText )
+ :m_pEventFilter( new TextResetOperatorEventFilter )
+ ,m_pOperator( new TextResetOperator( _rDisabledText ) )
+ {
+ }
+
+ inline ::svt::PWindowEventFilter getEventFilter() const { return m_pEventFilter; }
+ inline ::svt::PWindowOperator getOperator() const { return m_pOperator; }
+
+ private:
+ ::svt::PWindowEventFilter m_pEventFilter;
+ ::svt::PWindowOperator m_pOperator;
+ };
+
+ class TextResetOperatorController :public TextResetOperatorController_Base
+ ,public ::svt::DialogController
+ {
+ public:
+ TextResetOperatorController( Window& _rObservee, const String& _rDisabledText )
+ :TextResetOperatorController_Base( _rDisabledText )
+ ,::svt::DialogController( _rObservee, getEventFilter(), getOperator() )
+ {
+ addDependentWindow( _rObservee );
+ }
+ };
+
+ //====================================================================
+ //= MySQLNativeSettings
+ //====================================================================
+ //--------------------------------------------------------------------
+ MySQLNativeSettings::MySQLNativeSettings( Window& _rParent, const Link& _rControlModificationLink )
+ :Control( &_rParent, ModuleRes( RID_MYSQL_NATIVE_SETTINGS ).SetAutoRelease( FALSE ) )
+ ,m_aDatabaseNameLabel ( this, ModuleRes( FT_MYSQL_DATABASE_NAME ) )
+ ,m_aDatabaseName ( this, ModuleRes( ED_MYSQL_DATABASE_NAME ) )
+ ,m_aHostPortRadio ( this, ModuleRes( RB_MYSQL_HOST_PORT ) )
+ ,m_aSocketRadio ( this, ModuleRes( RB_MYSQL_SOCKET ) )
+ ,m_aNamedPipeRadio ( this, ModuleRes( RB_MYSQL_NAMED_PIPE ) )
+ ,m_aHostNameLabel ( this, ModuleRes( FT_COMMON_HOST_NAME ) )
+ ,m_aHostName ( this, ModuleRes( ED_COMMON_HOST_NAME ) )
+ ,m_aPortLabel ( this, ModuleRes( FT_COMMON_PORT ) )
+ ,m_aPort ( this, ModuleRes( NF_COMMON_PORT ) )
+ ,m_aDefaultPort ( this, ModuleRes( FT_COMMON_PORT_DEFAULT ) )
+ ,m_aSocket ( this, ModuleRes( ED_MYSQL_SOCKET ) )
+ ,m_aNamedPipe ( this, ModuleRes( ED_MYSQL_NAMED_PIPE ) )
+ {
+ FreeResource();
+
+ m_aDatabaseName.SetModifyHdl( _rControlModificationLink );
+ m_aHostName.SetModifyHdl( _rControlModificationLink );
+ m_aPort.SetModifyHdl( _rControlModificationLink );
+ m_aNamedPipe.SetModifyHdl( _rControlModificationLink );
+ m_aSocketRadio.SetToggleHdl( _rControlModificationLink );
+ m_aNamedPipeRadio.SetToggleHdl( _rControlModificationLink );
+
+ m_aControlDependencies.enableOnRadioCheck( m_aHostPortRadio, m_aHostNameLabel, m_aHostName, m_aPortLabel, m_aPort, m_aDefaultPort );
+ m_aControlDependencies.enableOnRadioCheck( m_aSocketRadio, m_aSocket );
+ m_aControlDependencies.enableOnRadioCheck( m_aNamedPipeRadio, m_aNamedPipe );
+
+ m_aControlDependencies.addController( ::svt::PDialogController(
+ new TextResetOperatorController( m_aHostName, String::CreateFromAscii( "localhost" ) )
+ ) );
+
+ // sockets are available on Unix systems only, named pipes only on Windows
+#ifdef UNX
+ m_aNamedPipeRadio.Hide();
+ m_aNamedPipe.Hide();
+#else
+ m_aSocketRadio.Hide();
+ m_aSocket.Hide();
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ MySQLNativeSettings::~MySQLNativeSettings()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void MySQLNativeSettings::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
+ {
+ _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aDatabaseName ) );
+ _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aHostName ) );
+ _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aPort ) );
+ _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aSocket ) );
+ _rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aNamedPipe ) );
+ }
+
+ //--------------------------------------------------------------------
+ void MySQLNativeSettings::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
+ {
+ _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aDatabaseNameLabel ) );
+ _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHostNameLabel ) );
+ _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aPortLabel ) );
+ _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aDefaultPort ) );
+ _rControlList.push_back( new ODisableWrapper< RadioButton >( &m_aSocketRadio ) );
+ _rControlList.push_back( new ODisableWrapper< RadioButton >( &m_aNamedPipeRadio ) );
+ }
+
+ //--------------------------------------------------------------------
+ BOOL MySQLNativeSettings::FillItemSet( SfxItemSet& _rSet )
+ {
+ sal_Bool bChangedSomething = sal_False;
+
+ OGenericAdministrationPage::fillString( _rSet, &m_aHostName, DSID_CONN_HOSTNAME, bChangedSomething );
+ OGenericAdministrationPage::fillString( _rSet, &m_aDatabaseName, DSID_DATABASENAME, bChangedSomething );
+ OGenericAdministrationPage::fillInt32 ( _rSet, &m_aPort, DSID_MYSQL_PORTNUMBER, bChangedSomething );
+#ifdef UNX
+ OGenericAdministrationPage::fillString( _rSet, &m_aSocket, DSID_CONN_SOCKET, bChangedSomething );
+#else
+ OGenericAdministrationPage::fillString( _rSet, &m_aNamedPipe, DSID_NAMED_PIPE, bChangedSomething );
+#endif
+
+ return bChangedSomething;
+ }
+
+ //--------------------------------------------------------------------
+ void MySQLNativeSettings::implInitControls(const SfxItemSet& _rSet )
+ {
+ SFX_ITEMSET_GET( _rSet, pInvalid, SfxBoolItem, DSID_INVALID_SELECTION, sal_True );
+ bool bValid = !pInvalid || !pInvalid->GetValue();
+ if ( !bValid )
+ return;
+
+ SFX_ITEMSET_GET( _rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True );
+ SFX_ITEMSET_GET( _rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True );
+ SFX_ITEMSET_GET( _rSet, pPortNumber, SfxInt32Item, DSID_MYSQL_PORTNUMBER, sal_True );
+ SFX_ITEMSET_GET( _rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True );
+ SFX_ITEMSET_GET( _rSet, pNamedPipe, SfxStringItem, DSID_NAMED_PIPE, sal_True );
+
+ m_aDatabaseName.SetText( pDatabaseName->GetValue() );
+ m_aDatabaseName.ClearModifyFlag();
+
+ m_aHostName.SetText( pHostName->GetValue() );
+ m_aHostName.ClearModifyFlag();
+
+ m_aPort.SetValue( pPortNumber->GetValue() );
+ m_aPort.ClearModifyFlag();
+
+ m_aSocket.SetText( pSocket->GetValue() );
+ m_aSocket.ClearModifyFlag();
+
+ m_aNamedPipe.SetText( pNamedPipe->GetValue() );
+ m_aNamedPipe.ClearModifyFlag();
+
+ // if a socket (on Unix) or a pipe name (on Windows) is given, this is preferred over
+ // the port
+#ifdef UNX
+ RadioButton& rSocketPipeRadio = m_aSocketRadio;
+ const SfxStringItem* pSocketPipeItem = pSocket;
+#else
+ RadioButton& rSocketPipeRadio = m_aNamedPipeRadio;
+ const SfxStringItem* pSocketPipeItem = pNamedPipe;
+#endif
+ String sSocketPipe( pSocketPipeItem->GetValue() );
+ if ( sSocketPipe.Len() > 0 )
+ rSocketPipeRadio.Check();
+ else
+ m_aHostPortRadio.Check();
+ }
+
+ //--------------------------------------------------------------------
+ bool MySQLNativeSettings::canAdvance() const
+ {
+ if ( m_aDatabaseName.GetText().Len() == 0 )
+ return false;
+
+ if ( m_aHostPortRadio.IsChecked()
+ && ( ( m_aHostName.GetText().Len() == 0 )
+ || ( m_aPort.GetText().Len() == 0 )
+ )
+ )
+ return false;
+
+#ifdef UNX
+ if ( ( m_aSocketRadio.IsChecked() )
+ && ( m_aSocket.GetText().Len() == 0 )
+ )
+#else
+ if ( ( m_aNamedPipeRadio.IsChecked() )
+ && ( m_aNamedPipe.GetText().Len() == 0 )
+ )
+#endif
+ return false;
+
+ return true;
+ }
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
diff --git a/dbaccess/source/ui/dlg/admincontrols.hrc b/dbaccess/source/ui/dlg/admincontrols.hrc
new file mode 100644
index 000000000..725c35139
--- /dev/null
+++ b/dbaccess/source/ui/dlg/admincontrols.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef ADMINCONTROLS_HRC
+#define ADMINCONTROLS_HRC
+
+#define FT_MYSQL_DATABASE_NAME 1
+#define FT_COMMON_HOST_NAME 2
+#define FT_COMMON_PORT_DEFAULT 3
+#define FT_COMMON_PORT 4
+
+
+#define RB_MYSQL_HOST_PORT 1
+#define RB_MYSQL_SOCKET 2
+#define RB_MYSQL_NAMED_PIPE 3
+
+
+#define ED_MYSQL_DATABASE_NAME 1
+#define ED_MYSQL_SOCKET 2
+#define ED_COMMON_HOST_NAME 3
+#define ED_MYSQL_NAMED_PIPE 4
+
+
+#define NF_COMMON_PORT 1
+
+#endif // ADMINCONTROLS_HRC
diff --git a/dbaccess/source/ui/dlg/admincontrols.hxx b/dbaccess/source/ui/dlg/admincontrols.hxx
new file mode 100644
index 000000000..58d054def
--- /dev/null
+++ b/dbaccess/source/ui/dlg/admincontrols.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef DBACCESS_ADMINCONTROLS_HXX
+#define DBACCESS_ADMINCONTROLS_HXX
+
+#include "adminpages.hxx"
+
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+#include <svtools/dialogcontrolling.hxx>
+
+//........................................................................
+namespace dbaui
+{
+//........................................................................
+
+ //====================================================================
+ //= MySQLNativeSettings
+ //====================================================================
+ class MySQLNativeSettings : public Control
+ {
+ private:
+ FixedText m_aDatabaseNameLabel;
+ Edit m_aDatabaseName;
+ RadioButton m_aHostPortRadio;
+ RadioButton m_aSocketRadio;
+ RadioButton m_aNamedPipeRadio;
+ FixedText m_aHostNameLabel;
+ Edit m_aHostName;
+ FixedText m_aPortLabel;
+ NumericField m_aPort;
+ FixedText m_aDefaultPort;
+ Edit m_aSocket;
+ Edit m_aNamedPipe;
+
+ ::svt::ControlDependencyManager
+ m_aControlDependencies;
+
+ public:
+ MySQLNativeSettings( Window& _rParent, const Link& _rControlModificationLink );
+ ~MySQLNativeSettings();
+
+ void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList );
+ void fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList );
+
+ BOOL FillItemSet( SfxItemSet& _rCoreAttrs );
+ void implInitControls( const SfxItemSet& _rSet );
+
+ bool canAdvance() const;
+ };
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
+
+#endif // DBACCESS_ADMINCONTROLS_HXX
diff --git a/dbaccess/source/ui/dlg/admincontrols.src b/dbaccess/source/ui/dlg/admincontrols.src
new file mode 100644
index 000000000..cd8edeed8
--- /dev/null
+++ b/dbaccess/source/ui/dlg/admincontrols.src
@@ -0,0 +1,130 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "AutoControls.hrc"
+#include "dbu_dlg.hrc"
+#include "admincontrols.hrc"
+
+#define LINE_HEIGHT ( EDIT_HEIGHT + RELATED_CONTROLS )
+#define SETTINGS_CONTROL_WIDTH ( WIZARD_PAGE_X - 2 * START_X )
+#define COLUMN_WIDTH_1 80
+#define COLUMN_WIDTH_2 ( SETTINGS_CONTROL_WIDTH - COLUMN_WIDTH_1 )
+
+Control RID_MYSQL_NATIVE_SETTINGS
+{
+ DialogControl = TRUE;
+ Size = MAP_APPFONT( SETTINGS_CONTROL_WIDTH, 5 * LINE_HEIGHT );
+ Hide = FALSE;
+
+ FixedText FT_MYSQL_DATABASE_NAME
+ {
+ Pos = MAP_APPFONT ( 0, 2 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_1 - UNRELATED_CONTROLS, FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Database name";
+ };
+
+ Edit ED_MYSQL_DATABASE_NAME
+ {
+ Pos = MAP_APPFONT ( COLUMN_WIDTH_1, 0 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT );
+ Border = TRUE;
+ };
+
+ RadioButton RB_MYSQL_HOST_PORT
+ {
+ Pos = MAP_APPFONT ( 0, LINE_HEIGHT );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_1, FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Se~rver / Port" ;
+ Group = TRUE;
+ };
+
+#define OPTION_GROUP_START ( LINE_HEIGHT + FIXEDTEXT_HEIGHT + RELATED_CONTROLS )
+
+ FixedText FT_COMMON_HOST_NAME
+ {
+ Pos = MAP_APPFONT ( INDENT_BELOW_RADIO, OPTION_GROUP_START + 2 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS - INDENT_BELOW_RADIO, FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "~Server" ;
+ };
+
+ Edit ED_COMMON_HOST_NAME
+ {
+ Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT );
+ Border = TRUE;
+ };
+
+ FixedText FT_COMMON_PORT
+ {
+ Pos = MAP_APPFONT ( INDENT_BELOW_RADIO, OPTION_GROUP_START + LINE_HEIGHT + 2 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS - INDENT_BELOW_RADIO, FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Port" ;
+ Group = TRUE;
+ };
+
+ NumericField NF_COMMON_PORT
+ {
+ Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START + LINE_HEIGHT );
+ Size = MAP_APPFONT ( 25, EDIT_HEIGHT );
+ Border = TRUE;
+ NoThousandSep = TRUE;
+ Value = 3306;
+ };
+
+ FixedText FT_COMMON_PORT_DEFAULT
+ {
+ Pos = MAP_APPFONT ( COLUMN_WIDTH_1 + 25 + RELATED_CONTROLS, OPTION_GROUP_START + LINE_HEIGHT + 2 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_2 - 25 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Default: 3306";
+ };
+
+ RadioButton RB_MYSQL_SOCKET
+ {
+ Pos = MAP_APPFONT ( 0, OPTION_GROUP_START + 2 * LINE_HEIGHT + 2 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "So~cket";
+ };
+
+ Edit ED_MYSQL_SOCKET
+ {
+ Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START + 2 * LINE_HEIGHT );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT );
+ Border = TRUE ;
+ };
+
+ RadioButton RB_MYSQL_NAMED_PIPE
+ {
+ Pos = MAP_APPFONT ( 0, OPTION_GROUP_START + 2 * LINE_HEIGHT + 2 );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_1 - RELATED_CONTROLS, FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Named p~ipe";
+ };
+
+ Edit ED_MYSQL_NAMED_PIPE
+ {
+ Pos = MAP_APPFONT ( COLUMN_WIDTH_1, OPTION_GROUP_START + 2 * LINE_HEIGHT );
+ Size = MAP_APPFONT ( COLUMN_WIDTH_2, EDIT_HEIGHT );
+ Border = TRUE ;
+ };
+};
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index c05de9fa5..d48e962bc 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 78bdce259..f8ba43384 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -215,6 +215,7 @@ namespace dbaui
*/
virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) = 0;
+ public:
/** fills the Boolean value into the item set when the value changed.
@param _rSet
The item set where to put the new value into.
@@ -227,7 +228,7 @@ namespace dbaui
@param _bRevertValue
set to <TRUE/> if the display value should be reverted before putting it into the set
*/
- void fillBool( SfxItemSet& _rSet, CheckBox* _pCheckBox, USHORT _nID, sal_Bool& _bChangedSomething, bool _bRevertValue = false);
+ static void fillBool( SfxItemSet& _rSet, CheckBox* _pCheckBox, USHORT _nID, sal_Bool& _bChangedSomething, bool _bRevertValue = false);
/** fills the int value into the item set when the value changed.
@param _rSet
@@ -239,7 +240,7 @@ namespace dbaui
@param _bChangedSomething
<TRUE/> if something changed otherwise <FALSE/>
*/
- void fillInt32(SfxItemSet& _rSet,NumericField* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething);
+ static void fillInt32(SfxItemSet& _rSet,NumericField* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething);
/** fills the String value into the item set when the value changed.
@param _rSet
@@ -251,16 +252,13 @@ namespace dbaui
@param _bChangedSomething
<TRUE/> if something changed otherwise <FALSE/>
*/
- void fillString(SfxItemSet& _rSet,Edit* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething);
+ static void fillString(SfxItemSet& _rSet,Edit* _pEdit,USHORT _nID,sal_Bool& _bChangedSomething);
+ protected:
// used to set the right Pane header of a wizard to bold
void SetControlFontWeight(Window* _pWindow, FontWeight _eWeight = WEIGHT_BOLD);
void SetHeaderText( USHORT _nFTResId, USHORT _StringResId);
- Point MovePoint(Point _aPixelBasePoint, sal_Int32 _XShift, sal_Int32 _YShift);
-
-
- protected:
/** This link be used for controls where the tabpage does not need to take any special action when the control
is modified. The implementation just calls callModifiedHdl.
*/
@@ -271,6 +269,28 @@ namespace dbaui
virtual Link getControlModifiedLink() { return LINK(this, OGenericAdministrationPage, OnControlModified); }
};
+ //=========================================================================
+ //= ControlRelation
+ //=========================================================================
+ enum ControlRelation
+ {
+ RelatedControls, UnrelatedControls
+ };
+
+ //=========================================================================
+ //= LayoutHelper
+ //=========================================================================
+ class LayoutHelper
+ {
+ public:
+ static void positionBelow(
+ const Control& _rReference,
+ Control& _rControl,
+ const ControlRelation _eRelation,
+ const long _nIndentAppFont
+ );
+ };
+
//.........................................................................
} // namespace dbaui
//.........................................................................
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 6dd20a91a..937e8b4cf 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 dfb991f19..c5dfc6321 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 26fcf2986..6f89d88ef 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 8f14ebecb..7bc1d861a 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 8ee9f2c67..22cb00e2d 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -102,6 +102,7 @@
#ifndef _FILEDLGHELPER_HXX
#include <sfx2/filedlghelper.hxx>
#endif
+#include <cppuhelper/exc_hlp.hxx>
/** === begin UNO includes === **/
#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
@@ -162,8 +163,8 @@
#include <com/sun/star/document/MacroExecMode.hpp>
#endif
#include <com/sun/star/ucb/IOErrorCode.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
/** === end UNO includes === **/
@@ -264,6 +265,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
, m_sRM_ADABASText(ModuleRes(STR_PAGETITLE_ADABAS))
, m_sRM_ADOText(ModuleRes(STR_PAGETITLE_ADO))
, m_sRM_JDBCText(ModuleRes(STR_PAGETITLE_JDBC))
+ , m_sRM_MySQLNativePageTitle(ModuleRes(STR_PAGETITLE_MYSQL_NATIVE))
, m_pGeneralPage( NULL )
, m_pMySQLIntroPage(NULL)
, m_pCollection( NULL )
@@ -387,7 +389,7 @@ String ODbTypeWizDialogSetup::getStateDisplayName( WizardState _nState ) const
sRoadmapItem = m_sRM_JDBCText;
break;
case PAGE_DBSETUPWIZARD_MYSQL_NATIVE:
- sRoadmapItem = m_sRM_JDBCText;
+ sRoadmapItem = m_sRM_MySQLNativePageTitle;
break;
case PAGE_DBSETUPWIZARD_MYSQL_ODBC:
sRoadmapItem = m_sRM_ODBCText;
@@ -454,14 +456,11 @@ void DataSourceInfoConverter::convert(const ::dbaccess::ODsnTypeCollection* _pCo
::comphelper::NamedValueCollection aDS(aInfo);
::connectivity::DriversConfig aDriverConfig(m_xFactory);
- const ::comphelper::NamedValueCollection& aOldMetaData = aDriverConfig.getMetaData(_sOldURLPrefix);
- const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix);
- const ::comphelper::NamedValueCollection& aNewMetaData = aDriverConfig.getMetaData(_sNewURLPrefix);
+ const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix);
const ::comphelper::NamedValueCollection& aNewProperties = aDriverConfig.getProperties(_sNewURLPrefix);
-
- lcl_removeUnused(aOldMetaData,aNewMetaData,aDS);
lcl_removeUnused(aOldProperties,aNewProperties,aDS);
+
aDS >>= aInfo;
_xDatasource->setPropertyValue(PROPERTY_INFO,uno::makeAny(aInfo));
}
@@ -472,7 +471,12 @@ void ODbTypeWizDialogSetup::activateDatabasePath()
{
case OGeneralPage::eCreateNew:
{
- activatePath( static_cast<PathId>(m_pCollection->getIndexOf(m_pCollection->getEmbeddedDatabase()) + 1), sal_True);
+ sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pCollection->getEmbeddedDatabase() );
+ if ( nCreateNewDBIndex == -1 )
+ nCreateNewDBIndex = m_pCollection->getIndexOf( ::rtl::OUString::createFromAscii( "sdbc:dbase:" ) );
+ OSL_ENSURE( nCreateNewDBIndex != -1, "ODbTypeWizDialogSetup::activateDatabasePath: the GeneralPage should have prevented this!" );
+ activatePath( static_cast< PathId >( nCreateNewDBIndex + 1 ), sal_True );
+
enableState(PAGE_DBSETUPWIZARD_FINAL, sal_True );
enableButtons( WZB_FINISH, sal_True);
}
@@ -675,7 +679,7 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
break;
case PAGE_DBSETUPWIZARD_MYSQL_NATIVE:
m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:")))));
- pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLNATIVETabPage( this, *m_pOutSet);
+ pPage = MySQLNativeSetupPage::Create( this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_ORACLE:
@@ -847,9 +851,23 @@ void ODbTypeWizDialogSetup::enableConfirmSettings( bool _bEnable )
}
//-------------------------------------------------------------------------
+namespace
+{
+ bool lcl_handle( const Reference< XInteractionHandler2 >& _rxHandler, const Any& _rRequest )
+ {
+ OInteractionRequest* pRequest = new OInteractionRequest( _rRequest );
+ Reference < XInteractionRequest > xRequest( pRequest );
+ OInteractionAbort* pAbort = new OInteractionAbort;
+ pRequest->addContinuation( pAbort );
+
+ return _rxHandler->handleInteractionRequest( xRequest );
+ }
+}
+
+//-------------------------------------------------------------------------
sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
{
- Reference< XInteractionHandler > xHandler( getORB()->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY );
+ Reference< XInteractionHandler2 > xHandler( getORB()->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY );
try
{
if (callSaveAsDialog() == sal_True)
@@ -876,17 +894,25 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
return sal_True;
}
}
- catch (Exception& e)
+ catch ( const Exception& e )
{
- InteractiveIOException aRequest;
- aRequest.Code = IOErrorCode_GENERAL;
- OInteractionRequest * pRequest = new OInteractionRequest (makeAny (aRequest));
- Reference < XInteractionRequest > xRequest(pRequest );
- OInteractionAbort* pAbort = new OInteractionAbort;
- pRequest ->addContinuation (pAbort );
+ Any aError = ::cppu::getCaughtException();
if ( xHandler.is() )
- xHandler->handle( xRequest );
- (void)e; // make compiler happy
+ {
+ if ( !lcl_handle( xHandler, aError ) )
+ {
+ InteractiveIOException aRequest;
+ aRequest.Classification = InteractionClassification_ERROR;
+ if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) )
+ // assume savint the document faile
+ aRequest.Code = IOErrorCode_CANT_WRITE;
+ else
+ aRequest.Code = IOErrorCode_GENERAL;
+ aRequest.Message = e.Message;
+ aRequest.Context = e.Context;
+ lcl_handle( xHandler, makeAny( aRequest ) );
+ }
+ }
}
return sal_False;
}
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 419723748..24183ab37 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -571,9 +571,6 @@ namespace dbaui
m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
m_aEDSocket.SetModifyHdl(getControlModifiedLink());
- // #98982# OJ
- m_aNFPortNumber.SetUseThousandSep(sal_False);
-
Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname,
&m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
&m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver,
@@ -701,62 +698,42 @@ namespace dbaui
MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false )
,m_aSeparator1 ( this, ModuleRes( FL_SEPARATOR1) )
- ,m_aDatabaseNameLabel ( this, ModuleRes( FT_AUTODATABASENAME ) )
- ,m_aDatabaseName ( this, ModuleRes( ET_AUTODATABASENAME ) )
- ,m_aFTHostname ( this, ModuleRes(FT_HOSTNAME))
- ,m_aEDHostname ( this, ModuleRes(ET_HOSTNAME))
- ,m_aPortNumber ( this, ModuleRes(FT_PORTNUMBER))
- ,m_aNFPortNumber ( this, ModuleRes(NF_PORTNUMBER))
- ,m_aFTSocket ( this, ModuleRes(FT_SOCKET))
- ,m_aEDSocket ( this, ModuleRes(ET_SOCKET))
+ ,m_aMySQLSettings ( *this, getControlModifiedLink() )
,m_aSeparator2 ( this, ModuleRes(FL_SEPARATOR2))
,m_aUserNameLabel ( this, ModuleRes(FT_USERNAME))
,m_aUserName ( this, ModuleRes(ET_USERNAME))
,m_aPasswordRequired ( this, ModuleRes(CB_PASSWORD_REQUIRED))
{
- m_aDatabaseName.SetModifyHdl(getControlModifiedLink());
- m_aEDHostname.SetModifyHdl(getControlModifiedLink());
- m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
- m_aEDSocket.SetModifyHdl(getControlModifiedLink());
m_aUserName.SetModifyHdl(getControlModifiedLink());
- // #98982# OJ
- m_aNFPortNumber.SetUseThousandSep(sal_False);
-
- Window* pWindows[] = { &m_aDatabaseNameLabel, &m_aDatabaseName, &m_aFTHostname, &m_aEDHostname,
- &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
- &m_aSeparator2, &m_aUserNameLabel, &m_aUserName, &m_aPasswordRequired,
- m_pCharsetLabel, m_pCharset};
-
+ Window* pWindows[] = { &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName,
+ &m_aPasswordRequired, m_pCharsetLabel, m_pCharset};
sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
for (sal_Int32 i=1; i < nCount; ++i)
pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
+ LayoutHelper::positionBelow( m_aSeparator1, m_aMySQLSettings, RelatedControls, 3 );
+ m_aMySQLSettings.Show();
+
FreeResource();
}
// -----------------------------------------------------------------------
void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
- OCommonBehaviourTabPage::fillControls(_rControlList);
+ OCommonBehaviourTabPage::fillControls( _rControlList );
+ m_aMySQLSettings.fillControls( _rControlList );
- _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aDatabaseName));
- _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
- _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
- _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket));
_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName));
_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired));
}
// -----------------------------------------------------------------------
void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
{
- OCommonBehaviourTabPage::fillWindows(_rControlList);
+ OCommonBehaviourTabPage::fillWindows( _rControlList );
+ m_aMySQLSettings.fillWindows( _rControlList);
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1));
- _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aDatabaseNameLabel));
- _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
- _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
- _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2));
_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel));
}
@@ -764,12 +741,9 @@ namespace dbaui
// -----------------------------------------------------------------------
sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet )
{
- sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
+ sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet );
- fillString(_rSet,&m_aDatabaseName,DSID_DATABASENAME,bChangedSomething);
- fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
- fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething);
- fillInt32(_rSet,&m_aNFPortNumber,DSID_MYSQL_PORTNUMBER,bChangedSomething );
+ bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet );
if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() )
{
@@ -788,27 +762,13 @@ namespace dbaui
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
- SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True);
- SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
- SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_MYSQL_PORTNUMBER, sal_True);
- SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
+ m_aMySQLSettings.implInitControls( _rSet );
+
SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
if ( bValid )
{
- m_aDatabaseName.SetText( pDatabaseName->GetValue() );
- m_aDatabaseName.ClearModifyFlag();
-
- m_aEDHostname.SetText(pHostName->GetValue());
- m_aEDHostname.ClearModifyFlag();
-
- m_aNFPortNumber.SetValue(pPortNumber->GetValue());
- m_aNFPortNumber.ClearModifyFlag();
-
- m_aEDSocket.SetText(pSocket->GetValue());
- m_aEDSocket.ClearModifyFlag();
-
m_aUserName.SetText(pUidItem->GetValue());
m_aUserName.ClearModifyFlag();
m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue());
@@ -1023,8 +983,6 @@ namespace dbaui
m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
m_aNFRowCount.SetModifyHdl(getControlModifiedLink());
- // #98982# OJ
- m_aNFPortNumber.SetUseThousandSep(sal_False);
m_aNFRowCount.SetUseThousandSep(sal_False);
m_iNormalPort = 389;
m_iSSLPort = 636;
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index 04cc1ddc6..74f550889 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -58,6 +58,7 @@
#ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
#include "TextConnectionHelper.hxx"
#endif
+#include "admincontrols.hxx"
#include <svtools/dialogcontrolling.hxx>
@@ -261,14 +262,7 @@ namespace dbaui
private:
FixedLine m_aSeparator1;
- FixedText m_aDatabaseNameLabel;
- Edit m_aDatabaseName;
- FixedText m_aFTHostname;
- Edit m_aEDHostname;
- FixedText m_aPortNumber;
- NumericField m_aNFPortNumber;
- FixedText m_aFTSocket;
- Edit m_aEDSocket;
+ MySQLNativeSettings m_aMySQLSettings;
FixedLine m_aSeparator2;
FixedText m_aUserNameLabel;
diff --git a/dbaccess/source/ui/dlg/dsitems.hxx b/dbaccess/source/ui/dlg/dsitems.hxx
index 5a6c9a140..97ed22ba4 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 844db6b66..99b0957a5 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -45,7 +45,6 @@
#include "localresaccess.hxx"
#include <vcl/msgbox.hxx>
#include <svtools/stritem.hxx>
-#include <connectivity/DriversConfig.hxx>
#include <vcl/waitobj.hxx>
#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -53,6 +52,9 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include "DriverSettings.hxx"
#include "UITools.hxx"
+#include <comphelper/processfactory.hxx>
+#include <unotools/confignode.hxx>
+
//.........................................................................
namespace dbaui
{
@@ -100,16 +102,51 @@ namespace dbaui
DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rItems.GetItem(DSID_TYPECOLLECTION));
if (pCollectionItem)
m_pCollection = pCollectionItem->getCollection();
-
DBG_ASSERT(m_pCollection, "OGeneralPage::OGeneralPage : really need a DSN type collection !");
+ // If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option
+ sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pCollection->getEmbeddedDatabase() );
+ if ( nCreateNewDBIndex == -1 )
+ nCreateNewDBIndex = m_pCollection->getIndexOf( ::rtl::OUString::createFromAscii( "sdbc:dbase:" ) );
+ bool bHideCreateNew = ( nCreateNewDBIndex == -1 );
+
+ // also, if our application policies tell us to hide the option, do it
+ ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/Policies/Features/Base" ) )
+ ) );
+ sal_Bool bAllowCreateLocalDatabase( sal_True );
+ OSL_VERIFY( aConfig.getNodeValue( "CreateLocalDatabase" ) >>= bAllowCreateLocalDatabase );
+ if ( !bAllowCreateLocalDatabase )
+ bHideCreateNew = true;
+
+ if ( bHideCreateNew )
+ {
+ m_aRB_CreateDatabase.Hide();
+ Window* pWindowsToMove[] = {
+ &m_aRB_OpenDocument, &m_aRB_GetExistingDatabase, &m_aFT_DocListLabel, m_pLB_DocumentList.get(),
+ &m_aPB_OpenDocument, &m_aDatasourceTypeLabel, m_pDatasourceType.get(), &m_aFTDataSourceAppendix,
+ &m_aTypePostLabel
+ };
+ const long nOffset = m_aRB_OpenDocument.GetPosPixel().Y() - m_aRB_CreateDatabase.GetPosPixel().Y();
+ for ( size_t i=0; i < sizeof( pWindowsToMove ) / sizeof( pWindowsToMove[0] ); ++i )
+ {
+ Point aPos( pWindowsToMove[i]->GetPosPixel() );
+ aPos.Y() -= nOffset;
+ pWindowsToMove[i]->SetPosPixel( aPos );
+ }
+ }
+
+ if ( bHideCreateNew )
+ m_aRB_GetExistingDatabase.Check();
+ else
+ m_aRB_CreateDatabase.Check();
+
// do some knittings
m_pDatasourceType->SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected));
m_aRB_CreateDatabase.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected));
m_aRB_GetExistingDatabase.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected));
m_aRB_OpenDocument.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected));
- m_aRB_CreateDatabase.Check();
-
m_pLB_DocumentList->SetSelectHdl( LINK( this, OGeneralPage, OnDocumentSelected ) );
m_aPB_OpenDocument.SetClickHdl( LINK( this, OGeneralPage, OnOpenDocument ) );
}
@@ -275,7 +312,7 @@ namespace dbaui
SetControlFontWeight(&m_aFTHeaderText);
SetText(String());
- m_pDatasourceType->SetPosPixel( MovePoint( m_aRB_GetExistingDatabase.GetPosPixel(), INDENT_BELOW_RADIO, 14 ) );
+ LayoutHelper::positionBelow( m_aRB_GetExistingDatabase, *m_pDatasourceType, RelatedControls, INDENT_BELOW_RADIO );
if ( !bValid || bReadonly )
{
@@ -384,16 +421,32 @@ namespace dbaui
bool OGeneralPage::approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName )
{
const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(_sURLPrefix);
- if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_JDBC ) )
- _inout_rDisplayName = m_sMySQLEntry;
-
- else if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_ODBC ) )
- _inout_rDisplayName = String();
- else if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_NATIVE ) )
- _inout_rDisplayName = String();
+ if ( m_DBWizardMode )
+ {
+ switch ( eType )
+ {
+ case ::dbaccess::DST_MYSQL_JDBC:
+ _inout_rDisplayName = m_sMySQLEntry;
+ break;
+ case ::dbaccess::DST_MYSQL_ODBC:
+ case ::dbaccess::DST_MYSQL_NATIVE:
+ // don't display those, the decision whether the user connects via JDBC/ODBC/C-OOo is made on another
+ // page
+ _inout_rDisplayName = String();
+ break;
+ case ::dbaccess::DST_MYSQL_NATIVE_DIRECT:
+ // do not display the Connector/OOo driver itself, it is always wrapped via the MySQL-Driver, if
+ // this driver is installed
+ if ( m_pCollection->hasDriver( "sdbc:mysql:mysqlc:" ) )
+ _inout_rDisplayName = String();
+ break;
+ default:
+ break;
+ }
+ }
- else if ( eType == ::dbaccess::DST_EMBEDDED_HSQLDB )
+ if ( eType == ::dbaccess::DST_EMBEDDED_HSQLDB )
_inout_rDisplayName = String();
return _inout_rDisplayName.Len() > 0;
diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk
index ceeac9f8c..ca2098778 100644
--- a/dbaccess/source/ui/dlg/makefile.mk
+++ b/dbaccess/source/ui/dlg/makefile.mk
@@ -55,11 +55,15 @@ CFLAGS+=-fpermissive
# ... resource files ............................
+
+LOCALIZE_ME=AutoControls_tmpl.hrc
+
SRS1NAME=$(TARGET)
SRC1FILES = \
AutoControls.src \
ConnectionPage.src \
UserAdmin.src \
+ admincontrols.src \
directsql.src \
AdabasStat.src \
indexdialog.src \
@@ -94,6 +98,7 @@ EXCEPTIONSFILES= \
$(SLO)$/RelationDlg.obj \
$(SLO)$/adtabdlg.obj \
$(SLO)$/dlgsave.obj \
+ $(SLO)$/admincontrols.obj \
$(SLO)$/adminpages.obj \
$(SLO)$/queryorder.obj \
$(SLO)$/queryfilter.obj \
@@ -136,7 +141,7 @@ SLOFILES+= $(SLO)$/adodatalinks.obj
.ENDIF
# --- Targets ----------------------------------
-LOCALIZE_ME=AutoControls_tmpl.hrc
+#LOCALIZE_ME=AutoControls_tmpl.hrc
.INCLUDE : target.mk
diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx
index ebbebc020..b39181e01 100644
--- a/dbaccess/source/ui/inc/RelationController.hxx
+++ b/dbaccess/source/ui/inc/RelationController.hxx
@@ -38,6 +38,7 @@
#endif
class VCLXWindow;
+class WaitObject;
namespace dbaui
{
class OTableConnectionData;
@@ -48,6 +49,8 @@ namespace dbaui
class ORelationController : public OJoinController
{
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTables;
+ ::std::auto_ptr<WaitObject> m_pWaitObject;
+ ULONG m_nThreadEvent;
sal_Bool m_bRelationsPossible;
protected:
// all the features which should be handled by this class
@@ -59,7 +62,7 @@ namespace dbaui
ORelationDesignView* getRelationView() { return static_cast<ORelationDesignView*>(m_pView); }
void loadData();
- TTableWindowData::value_type existsTable(const ::rtl::OUString& _rComposedTableName) const;
+ TTableWindowData::value_type existsTable(const ::rtl::OUString& _rComposedTableName,sal_Bool _bCase) const;
// load the window positions out of the datasource
void loadLayoutInformation();
@@ -71,6 +74,8 @@ namespace dbaui
// temp
void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
+ void mergeData(const TTableConnectionData& _aConnectionData);
+
virtual sal_Bool Construct(Window* pParent);
// XServiceInfo
@@ -92,6 +97,7 @@ namespace dbaui
virtual void reset();
virtual void impl_initialize();
virtual ::rtl::OUString getPrivateTitle( ) const;
+ DECL_LINK( OnThreadFinished, void* );
};
}
#endif // DBAUI_RELATIONCONTROLLER_HXX
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index 1b4b5ad1c..de4492e9f 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 6a6bb1bc3..966df1bd2 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;
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index e901f6135..8f559e2a4 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -66,6 +66,7 @@
#include "WExtendPages.hxx"
#include "WCPage.hxx"
#include <svtools/syslocale.hxx>
+#include <svtools/zforlist.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/FValue.hxx>
#include <com/sun/star/sdbc/SQLWarning.hpp>
@@ -344,9 +345,14 @@ void ODatabaseExport::insertValueIntoColumn()
bool bNumberFormatError = false;
if ( m_pFormatter && m_sNumToken.Len() )
{
- LanguageType eNumLang;
- sal_uInt32 nNumberFormat2;
+ LanguageType eNumLang = LANGUAGE_NONE;
+ sal_uInt32 nNumberFormat2( nNumberFormat );
fOutNumber = SfxHTMLParser::GetTableDataOptionsValNum(nNumberFormat2,eNumLang,m_sTextToken,m_sNumToken,*m_pFormatter);
+ if ( eNumLang != LANGUAGE_NONE )
+ {
+ nNumberFormat2 = m_pFormatter->GetFormatForLanguageIfBuiltIn( nNumberFormat2, eNumLang );
+ m_pFormatter->IsNumberFormat( m_sTextToken, nNumberFormat2, fOutNumber );
+ }
nNumberFormat = static_cast<sal_Int32>(nNumberFormat2);
}
else
@@ -357,6 +363,7 @@ void ODatabaseExport::insertValueIntoColumn()
NumberFormat::DATETIME
,NumberFormat::DATE
,NumberFormat::TIME
+ ,NumberFormat::CURRENCY
,NumberFormat::NUMBER
,NumberFormat::LOGICAL
};
@@ -438,9 +445,13 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
if ( m_pFormatter && m_sNumToken.Len() )
{
LanguageType eNumLang;
- sal_uInt32 nFormatKey;
+ sal_uInt32 nFormatKey(0);
fOutNumber = SfxHTMLParser::GetTableDataOptionsValNum(nFormatKey,eNumLang,m_sTextToken,m_sNumToken,*m_pFormatter);
- //double fOutNumber2 = SfxHTMLParser::GetTableDataOptionsValNum(nNumberFormat2,eNumLang,m_sValToken,m_sNumToken,*m_pFormatter);
+ if ( eNumLang != LANGUAGE_NONE )
+ {
+ nFormatKey = m_pFormatter->GetFormatForLanguageIfBuiltIn( nFormatKey, eNumLang );
+ m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber );
+ }
Reference<XPropertySet> xProp = xFormats->getByKey(nFormatKey);
xProp->getPropertyValue(PROPERTY_TYPE) >>= nNumberFormat;
}
@@ -575,7 +586,7 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
{
sal_Int32 nDataType;
sal_Int32 nLength(0),nScale(0);
- sal_Int16 nType = m_vNumberFormat[i];
+ sal_Int16 nType = m_vNumberFormat[i] & ~NumberFormat::DEFINED;
switch ( nType )
{
diff --git a/dbaccess/source/ui/misc/dbumiscres.src b/dbaccess/source/ui/misc/dbumiscres.src
index c8f8ac710..72a8270d7 100644
--- a/dbaccess/source/ui/misc/dbumiscres.src
+++ b/dbaccess/source/ui/misc/dbumiscres.src
@@ -99,5 +99,5 @@ String STR_NAMED_OBJECT_ALREADY_EXISTS
String RID_STR_EXTENSION_NOT_PRESENT
{
// #i96130# use hard coded name
- Text [ en-US ] = "The report, \"$file$\", requires the extension Sun™ Report Builder.";
+ Text [ en-US ] = "The report, \"$file$\", requires the extension Sun Report Builder.";
};
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index bb9bc9afe..b47782baa 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -157,6 +157,11 @@
#ifndef _SV_WAITOBJ_HXX
#include <vcl/waitobj.hxx>
#endif
+#include <osl/thread.hxx>
+#include <vos/mutex.hxx>
+
+
+#define MAX_THREADS 10
extern "C" void SAL_CALL createRegistryInfo_ORelationControl()
{
@@ -181,6 +186,7 @@ using namespace ::com::sun::star::util;
using namespace ::dbtools;
using namespace ::dbaui;
using namespace ::comphelper;
+using namespace ::osl;
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL ORelationController::getImplementationName() throw( RuntimeException )
@@ -214,6 +220,7 @@ DBG_NAME(ORelationController);
// -----------------------------------------------------------------------------
ORelationController::ORelationController(const Reference< XMultiServiceFactory >& _rM)
: OJoinController(_rM)
+ ,m_nThreadEvent(0)
,m_bRelationsPossible(sal_True)
{
DBG_CTOR(ORelationController,NULL);
@@ -321,13 +328,8 @@ void ORelationController::impl_initialize()
try
{
loadData();
- getView()->initialize(); // show the windows and fill with our informations
- getView()->Invalidate(INVALIDATE_NOERASE);
- getUndoMgr()->Clear(); // clear all undo redo things
- setModified(sal_False); // and we are not modified yet
-
- if(m_vTableData.empty())
- Execute(ID_BROWSER_ADDTABLE,Sequence<PropertyValue>());
+ if ( !m_nThreadEvent )
+ Application::PostUserEvent(LINK(this, ORelationController, OnThreadFinished));
}
catch( const Exception& )
{
@@ -369,24 +371,53 @@ void ORelationController::describeSupportedFeatures()
OJoinController::describeSupportedFeatures();
implDescribeSupportedFeature( ".uno:DBAddRelation", SID_RELATION_ADD_RELATION, CommandGroup::EDIT );
}
-// -----------------------------------------------------------------------------
-void ORelationController::loadData()
+namespace
{
- WaitObject aWaitCursor(getView());
- try
+ class RelationLoader : public ::osl::Thread
{
- if ( !m_xTables.is() )
- return;
- // this may take some time
+ DECLARE_STL_MAP(::rtl::OUString,::boost::shared_ptr<OTableWindowData>,::comphelper::UStringMixLess,TTableDataHelper);
+ TTableDataHelper m_aTableData;
+ TTableConnectionData m_vTableConnectionData;
+ const Sequence< ::rtl::OUString> m_aTableList;
+ ORelationController* m_pParent;
+ const Reference< XDatabaseMetaData> m_xMetaData;
+ const Reference< XNameAccess > m_xTables;
+ const sal_Int32 m_nStartIndex;
+ const sal_Int32 m_nEndIndex;
- Reference< XDatabaseMetaData> xMetaData = getConnection()->getMetaData();
- Sequence< ::rtl::OUString> aNames = m_xTables->getElementNames();
- const ::rtl::OUString* pIter = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ public:
+ RelationLoader(ORelationController* _pParent
+ ,const Reference< XDatabaseMetaData>& _xMetaData
+ ,const Reference< XNameAccess >& _xTables
+ ,const Sequence< ::rtl::OUString>& _aTableList
+ ,const sal_Int32 _nStartIndex
+ ,const sal_Int32 _nEndIndex)
+ :m_aTableData(_xMetaData.is() && _xMetaData->supportsMixedCaseQuotedIdentifiers())
+ ,m_aTableList(_aTableList)
+ ,m_pParent(_pParent)
+ ,m_xMetaData(_xMetaData)
+ ,m_xTables(_xTables)
+ ,m_nStartIndex(_nStartIndex)
+ ,m_nEndIndex(_nEndIndex)
+ {
+ }
+
+ protected:
+ virtual ~RelationLoader(){}
+
+ /// Working method which should be overridden.
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+ void loadTableData(const Any& _aTable);
+ };
+
+ void SAL_CALL RelationLoader::run()
+ {
+ const ::rtl::OUString* pIter = m_aTableList.getConstArray() + m_nStartIndex;
+ for(sal_Int32 i = m_nStartIndex; i < m_nEndIndex;++i,++pIter)
{
::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(xMetaData,
+ ::dbtools::qualifiedNameComponents(m_xMetaData,
*pIter,
sCatalog,
sSchema,
@@ -396,124 +427,210 @@ void ORelationController::loadData()
if ( sCatalog.getLength() )
aCatalog <<= sCatalog;
- Reference< XResultSet > xResult = xMetaData->getImportedKeys(aCatalog, sSchema,sTable);
- if ( xResult.is() && xResult->next() )
- loadTableData(m_xTables->getByName(*pIter));
+ try
+ {
+ Reference< XResultSet > xResult = m_xMetaData->getImportedKeys(aCatalog, sSchema,sTable);
+ if ( xResult.is() && xResult->next() )
+ {
+ ::comphelper::disposeComponent(xResult);
+ loadTableData(m_xTables->getByName(*pIter));
+ } // if ( xResult.is() && xResult->next() )
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
}
- catch(SQLException& e)
+ void SAL_CALL RelationLoader::onTerminated()
{
- showError(SQLExceptionInfo(e));
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-// -----------------------------------------------------------------------------
-void ORelationController::loadTableData(const Any& _aTable)
-{
- Reference<XPropertySet> xTableProp(_aTable,UNO_QUERY);
- const ::rtl::OUString sSourceName = ::dbtools::composeTableName( getConnection()->getMetaData(), xTableProp, ::dbtools::eInTableDefinitions, false, false, false );
- TTableWindowData::value_type pReferencingTable = existsTable(sSourceName);
- bool bNotFound = true, bAdded = false;
- if ( !pReferencingTable )
- {
- pReferencingTable.reset(new OTableWindowData(xTableProp,sSourceName, sSourceName));
- pReferencingTable->ShowAll(FALSE);
- bAdded = true;
- m_vTableData.push_back(pReferencingTable);
+ m_pParent->mergeData(m_vTableConnectionData);
+ delete this;
}
- Reference<XIndexAccess> xKeys = pReferencingTable->getKeys();
- Reference<XKeysSupplier> xKeySup(xTableProp,UNO_QUERY);
-
- if ( !xKeys.is() && xKeySup.is() )
+ void RelationLoader::loadTableData(const Any& _aTable)
{
- xKeys = xKeySup->getKeys();
- }
-
- if ( xKeys.is() )
- {
- Reference<XPropertySet> xKey;
- const sal_Int32 nCount = xKeys->getCount();
- for(sal_Int32 i = 0 ; i < nCount ; ++i)
+ Reference<XPropertySet> xTableProp(_aTable,UNO_QUERY);
+ const ::rtl::OUString sSourceName = ::dbtools::composeTableName( m_xMetaData, xTableProp, ::dbtools::eInTableDefinitions, false, false, false );
+ TTableDataHelper::iterator aFind = m_aTableData.find(sSourceName);
+ bool bNotFound = true, bAdded = false;
+ if ( aFind == m_aTableData.end() )
+ {
+ aFind = m_aTableData.insert(TTableDataHelper::value_type(sSourceName,::boost::shared_ptr<OTableWindowData>(new OTableWindowData(xTableProp,sSourceName, sSourceName)))).first;
+ aFind->second->ShowAll(FALSE);
+ bAdded = true;
+ }
+ TTableWindowData::value_type pReferencingTable = aFind->second;
+ Reference<XIndexAccess> xKeys = pReferencingTable->getKeys();
+ const Reference<XKeysSupplier> xKeySup(xTableProp,UNO_QUERY);
+
+ if ( !xKeys.is() && xKeySup.is() )
{
- xKeys->getByIndex(i) >>= xKey;
- sal_Int32 nKeyType = 0;
- xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
- if ( KeyType::FOREIGN == nKeyType )
+ xKeys = xKeySup->getKeys();
+ }
+
+ if ( xKeys.is() )
+ {
+ Reference<XPropertySet> xKey;
+ const sal_Int32 nCount = xKeys->getCount();
+ for(sal_Int32 i = 0 ; i < nCount ; ++i)
{
- bNotFound = false;
- ::rtl::OUString sReferencedTable;
- xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
- //////////////////////////////////////////////////////////////////////
- // insert windows
- TTableWindowData::value_type pReferencedTable = existsTable(sReferencedTable);
- if ( !pReferencedTable )
+ xKeys->getByIndex(i) >>= xKey;
+ sal_Int32 nKeyType = 0;
+ xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
+ if ( KeyType::FOREIGN == nKeyType )
{
- if ( m_xTables->hasByName(sReferencedTable) )
+ bNotFound = false;
+ ::rtl::OUString sReferencedTable;
+ xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
+ //////////////////////////////////////////////////////////////////////
+ // insert windows
+ TTableDataHelper::iterator aRefFind = m_aTableData.find(sReferencedTable);
+ if ( aRefFind == m_aTableData.end() )
{
- Reference<XPropertySet> xReferencedTable(m_xTables->getByName(sReferencedTable),UNO_QUERY);
- pReferencedTable.reset(new OTableWindowData(xReferencedTable,sReferencedTable, sReferencedTable));
- pReferencedTable->ShowAll(FALSE);
- m_vTableData.push_back(pReferencedTable);
- }
- else
- continue; // table name could not be found so we do not show this table releation
- }
+ if ( m_xTables->hasByName(sReferencedTable) )
+ {
+ Reference<XPropertySet> xReferencedTable(m_xTables->getByName(sReferencedTable),UNO_QUERY);
+ aRefFind = m_aTableData.insert(TTableDataHelper::value_type(sReferencedTable,::boost::shared_ptr<OTableWindowData>(new OTableWindowData(xReferencedTable,sReferencedTable, sReferencedTable)))).first;
+ aRefFind->second->ShowAll(FALSE);
+ }
+ else
+ continue; // table name could not be found so we do not show this table releation
+ } // if ( aFind == m_aTableData.end() )
+ TTableWindowData::value_type pReferencedTable = aRefFind->second;
- ::rtl::OUString sKeyName;
- xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName;
- //////////////////////////////////////////////////////////////////////
- // insert connection
- ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( pReferencingTable, pReferencedTable, sKeyName );
- m_vTableConnectionData.push_back(TTableConnectionData::value_type(pTabConnData));
- //////////////////////////////////////////////////////////////////////
- // insert columns
- Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY);
- OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!");
- Reference<XNameAccess> xColumns = xColsSup->getColumns();
- Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
- const ::rtl::OUString* pIter = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aNames.getLength();
- ::rtl::OUString sColumnName,sRelatedName;
- for(sal_uInt16 j=0;pIter != pEnd;++pIter,++j)
- {
- Reference<XPropertySet> xPropSet;
- xColumns->getByName(*pIter) >>= xPropSet;
- OSL_ENSURE(xPropSet.is(),"Invalid column found in KeyColumns!");
- if ( xPropSet.is() )
+ ::rtl::OUString sKeyName;
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName;
+ //////////////////////////////////////////////////////////////////////
+ // insert connection
+ ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( pReferencingTable, pReferencedTable, sKeyName );
+ m_vTableConnectionData.push_back(TTableConnectionData::value_type(pTabConnData));
+ //////////////////////////////////////////////////////////////////////
+ // insert columns
+ const Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY);
+ OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!");
+ const Reference<XNameAccess> xColumns = xColsSup->getColumns();
+ const Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
+ const ::rtl::OUString* pIter = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aNames.getLength();
+ ::rtl::OUString sColumnName,sRelatedName;
+ for(sal_uInt16 j=0;pIter != pEnd;++pIter,++j)
{
- xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
- xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName;
+ const Reference<XPropertySet> xPropSet(xColumns->getByName(*pIter),UNO_QUERY);
+ OSL_ENSURE(xPropSet.is(),"Invalid column found in KeyColumns!");
+ if ( xPropSet.is() )
+ {
+ xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
+ xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName;
+ }
+ pTabConnData->SetConnLine( j, sColumnName, sRelatedName );
}
- pTabConnData->SetConnLine( j, sColumnName, sRelatedName );
- }
- //////////////////////////////////////////////////////////////////////
- // Update/Del-Flags setzen
- sal_Int32 nUpdateRule = 0;
- sal_Int32 nDeleteRule = 0;
- xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule;
- xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule;
-
- pTabConnData->SetUpdateRules( nUpdateRule );
- pTabConnData->SetDeleteRules( nDeleteRule );
+ //////////////////////////////////////////////////////////////////////
+ // Update/Del-Flags setzen
+ sal_Int32 nUpdateRule = 0;
+ sal_Int32 nDeleteRule = 0;
+ xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule;
+ xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule;
+
+ pTabConnData->SetUpdateRules( nUpdateRule );
+ pTabConnData->SetDeleteRules( nDeleteRule );
- //////////////////////////////////////////////////////////////////////
- // Kardinalitaet setzen
- pTabConnData->SetCardinality();
+ //////////////////////////////////////////////////////////////////////
+ // Kardinalitaet setzen
+ pTabConnData->SetCardinality();
+ }
}
+ } // if ( xKeys.is() )
+ }
+}
+
+void ORelationController::mergeData(const TTableConnectionData& _aConnectionData)
+{
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ ::std::copy( _aConnectionData.begin(), _aConnectionData.end(), ::std::back_inserter( m_vTableConnectionData ));
+ //const Reference< XDatabaseMetaData> xMetaData = getConnection()->getMetaData();
+ const sal_Bool bCase = sal_True;//xMetaData.is() && xMetaData->supportsMixedCaseQuotedIdentifiers();
+ // here we are finished, so we can collect the table from connection data
+ TTableConnectionData::iterator aConnDataIter = m_vTableConnectionData.begin();
+ TTableConnectionData::iterator aConnDataEnd = m_vTableConnectionData.end();
+ for(;aConnDataIter != aConnDataEnd;++aConnDataIter)
+ {
+ if ( !existsTable((*aConnDataIter)->getReferencingTable()->GetComposedName(),bCase) )
+ {
+ m_vTableData.push_back((*aConnDataIter)->getReferencingTable());
+ }
+ if ( !existsTable((*aConnDataIter)->getReferencedTable()->GetComposedName(),bCase) )
+ {
+ m_vTableData.push_back((*aConnDataIter)->getReferencedTable());
}
- } // if ( xKeys.is() )
- if ( bNotFound && bAdded )
- m_vTableData.pop_back();
+ } // for(;aConnDataIter != aConnDataEnd;++aConnDataIter)
+ --m_nThreadEvent;
+ if ( !m_nThreadEvent )
+ Application::PostUserEvent(LINK(this, ORelationController, OnThreadFinished));
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( ORelationController, OnThreadFinished, void*, /*NOTINTERESTEDIN*/ )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( getMutex() );
+ try
+ {
+ getView()->initialize(); // show the windows and fill with our informations
+ getView()->Invalidate(INVALIDATE_NOERASE);
+ getUndoMgr()->Clear(); // clear all undo redo things
+ setModified(sal_False); // and we are not modified yet
+
+ if(m_vTableData.empty())
+ Execute(ID_BROWSER_ADDTABLE,Sequence<PropertyValue>());
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_pWaitObject.reset();
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void ORelationController::loadData()
+{
+ m_pWaitObject.reset( new WaitObject(getView()) );
+ try
+ {
+ if ( !m_xTables.is() )
+ return;
+ // this may take some time
+ const Reference< XDatabaseMetaData> xMetaData = getConnection()->getMetaData();
+ const Sequence< ::rtl::OUString> aNames = m_xTables->getElementNames();
+ const sal_Int32 nCount = aNames.getLength();
+ const sal_Int32 nMaxElements = (nCount / MAX_THREADS) +1;
+
+ sal_Int32 nStart = 0,nEnd = ::std::min(nMaxElements,nCount);
+ while(nStart != nEnd)
+ {
+ ++m_nThreadEvent;
+ RelationLoader* pThread = new RelationLoader(this,xMetaData,m_xTables,aNames,nStart,nEnd);
+ pThread->createSuspended();
+ pThread->setPriority(osl_Thread_PriorityBelowNormal);
+ pThread->resume();
+ nStart = nEnd;
+ nEnd += nMaxElements;
+ nEnd = ::std::min(nEnd,nCount);
+ } // for(;pIter != pEnd;++pIter)
+ }
+ catch(SQLException& e)
+ {
+ showError(SQLExceptionInfo(e));
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
// -----------------------------------------------------------------------------
-TTableWindowData::value_type ORelationController::existsTable(const ::rtl::OUString& _rComposedTableName) const
+TTableWindowData::value_type ORelationController::existsTable(const ::rtl::OUString& _rComposedTableName,sal_Bool _bCase) const
{
- Reference<XDatabaseMetaData> xMeta = getConnection()->getMetaData();
- ::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
+ ::comphelper::UStringMixEqual bCase(_bCase);
TTableWindowData::const_iterator aIter = m_vTableData.begin();
TTableWindowData::const_iterator aEnd = m_vTableData.end();
for(;aIter != aEnd;++aIter)
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index d3ae601cf..fd47db6d2 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -165,7 +165,7 @@ void ORelationTableView::ReSync()
// Verbindungen einfuegen
TTableConnectionData* pTabConnDataList = m_pView->getController().getTableConnectionData();
TTableConnectionData::reverse_iterator aConIter = pTabConnDataList->rbegin();
-
+
for(;aConIter != pTabConnDataList->rend();++aConIter)
{
ORelationTableConnectionData* pTabConnData = static_cast<ORelationTableConnectionData*>(aConIter->get());
@@ -182,8 +182,8 @@ void ORelationTableView::ReSync()
pTabConnDataList->erase( ::std::remove(pTabConnDataList->begin(),pTabConnDataList->end(),*aConIter),pTabConnDataList->end() );
continue;
}
- }
-
+ } // if ( !arrInvalidTables.empty() )
+
addConnection( new ORelationTableConnection(this, *aConIter), sal_False ); // don't add the data again
}
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index ac53e1900..f236eb112 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -1179,7 +1179,8 @@ void OTableController::alterColumns()
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vRowList.begin();
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_vRowList.end();
// first look for columns where something other than the name changed
- for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos)
+ sal_Int32 nPos = 0;
+ for(;aIter != aEnd;++aIter,++nPos)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1198,10 +1199,9 @@ void OTableController::alterColumns()
xColumns->getByName(pField->GetName()) >>= xColumn;
OSL_ENSURE(xColumn.is(),"Column is null!");
- sal_Int32 nType=0,nPrecision=0,nScale=0,nNullable=0,nFormatKey=0,nAlignment=0;
+ sal_Int32 nType=0,nPrecision=0,nScale=0,nNullable=0;
sal_Bool bAutoIncrement = false;
- ::rtl::OUString sDescription, sTypeName;
- Any aControlDefault;
+ ::rtl::OUString sTypeName;
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
@@ -1220,19 +1220,10 @@ void OTableController::alterColumns()
}
// xColumn->getPropertyValue(PROPERTY_ISCURRENCY,::cppu::bool2any(pField->IsCurrency()));
- if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
- xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sDescription;
- if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- aControlDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT);
- if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
- xColumn->getPropertyValue(PROPERTY_FORMATKEY) >>= nFormatKey;
- if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
- xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlignment;
-
// check if something changed
if((nType != pField->GetType() ||
sTypeName != pField->GetTypeName() ||
- nPrecision != pField->GetPrecision() ||
+ (nPrecision != pField->GetPrecision() && nPrecision ) ||
nScale != pField->GetScale() ||
nNullable != pField->GetIsNullable() ||
bAutoIncrement != pField->IsAutoIncrement())&&
@@ -1285,26 +1276,7 @@ void OTableController::alterColumns()
bReload = sal_True;
}
- if(nFormatKey != pField->GetFormatKey())
- {
- if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
- xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
- }
- if(nAlignment != dbaui::mapTextAllign(pField->GetHorJustify()))
- {
- if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
- xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(pField->GetHorJustify())));
- }
- if(sDescription != pField->GetDescription())
- {
- if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
- xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetDescription()));
- }
- if ( aControlDefault != pField->GetControlDefault())
- {
- if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
- }
+
}
else if(xColumnFactory.is() && xAlter.is() && nPos < nColumnCount)
{ // we can't find the column so we could try it with the index before we drop and append a new column
@@ -1350,6 +1322,37 @@ void OTableController::alterColumns()
}
else
bReload = sal_True;
+ } // for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos)
+ // alter column settings
+ aIter = m_vRowList.begin();
+
+ // first look for columns where something other than the name changed
+ for(nPos = 0;aIter != aEnd;++aIter,++nPos)
+ {
+ OSL_ENSURE(*aIter,"OTableRow is null!");
+ OFieldDescription* pField = (*aIter)->GetActFieldDescr();
+ if ( !pField )
+ continue;
+ if ( (*aIter)->IsReadOnly() )
+ {
+ aColumns[pField->GetName()] = sal_True;
+ continue;
+ }
+
+ Reference<XPropertySet> xColumn;
+ if ( xColumns->hasByName(pField->GetName()) )
+ {
+ xColumns->getByName(pField->GetName()) >>= xColumn;
+ Reference<XPropertySetInfo> xInfo = xColumn->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetDescription()));
+ if(xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
+ xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
+ if(xInfo->hasPropertyByName(PROPERTY_FORMATKEY))
+ xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+ if(xInfo->hasPropertyByName(PROPERTY_ALIGN))
+ xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(pField->GetHorJustify())));
+ } // if ( xColumns->hasByName(pField->GetName()) )
}
// second drop all columns which could be found by name
Reference<XNameAccess> xKeyColumns = getKeyColumns();