summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2009-11-16 09:59:12 +0100
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2009-11-16 09:59:12 +0100
commitf53e28b8a3380ba67bbc7a63ce3e1bc8c3d24994 (patch)
tree117f773216853aae137d02003716ca5b61ebbbbb /dbaccess/source
parent9da2e3d1e84a00accd0e688a1273873f3fcfa75c (diff)
parent70d7ac8e4969c4de099f691b649e5bfd232e4632 (diff)
dba33d: pull from dba33b
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.cxx206
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.hxx33
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx154
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.hxx14
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx6
-rw-r--r--dbaccess/source/core/api/column.cxx388
-rw-r--r--dbaccess/source/core/api/columnsettings.cxx153
-rw-r--r--dbaccess/source/core/api/datasettings.cxx30
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx865
-rw-r--r--dbaccess/source/core/api/makefile.mk3
-rw-r--r--dbaccess/source/core/api/preparedstatement.cxx73
-rw-r--r--dbaccess/source/core/api/resultcolumn.cxx196
-rw-r--r--dbaccess/source/core/api/table.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx6
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx23
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx13
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx9
-rw-r--r--dbaccess/source/core/inc/column.hxx177
-rw-r--r--dbaccess/source/core/inc/columnsettings.hxx110
-rw-r--r--dbaccess/source/core/inc/datasettings.hxx1
-rw-r--r--dbaccess/source/core/inc/definitioncolumn.hxx189
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx3
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx517
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx3
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx3
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx183
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx51
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx82
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx72
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hrc1
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx4
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src18
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.cxx99
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.hxx80
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx66
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk4
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.cxx75
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.hxx66
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx (renamed from dbaccess/source/ui/dlg/dsitems.hxx)5
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx114
-rw-r--r--dbaccess/source/ui/inc/exsrcbrw.hxx11
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx20
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx177
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx15
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx215
46 files changed, 1791 insertions, 2755 deletions
diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx
index bc48a56ed3f0..0974963dfd72 100644
--- a/dbaccess/source/core/api/CRowSetColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetColumn.cxx
@@ -31,186 +31,84 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
#include "CRowSetColumn.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
+
#include <com/sun/star/sdb/XColumn.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
+#include <comphelper/types.hxx>
+#include <cppuhelper/typeprovider.hxx>
-using namespace dbaccess;
-// using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-// using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-// using namespace ::com::sun::star::util;
-using namespace cppu;
-using namespace osl;
+using namespace ::com::sun::star::beans;
+//..............................................................................
+namespace dbaccess
+{
+//..............................................................................
-// -------------------------------------------------------------------------
-//ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData,
-// const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XRow >& _xRow,
-// sal_Int32 _nPos,
-// ORowSetMatrix::iterator& _rColumnValue,
-// ORowSetMatrix::iterator& _rEnd)
-// : ORowSetDataColumn(_xMetaData,_xRow,NULL,_nPos,_rColumnValue,_rEnd)
-//{
-//
-//}
//------------------------------------------------------------------------------
-Any SAL_CALL ORowSetColumn::queryInterface( const Type & _rType ) throw (RuntimeException)
+ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData, const Reference < XRow >& _xRow, sal_Int32 _nPos,
+ const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rDescription, ORowSetCacheIterator& _rColumnValue )
+ :ORowSetDataColumn( _xMetaData, _xRow, NULL, _nPos, _rxDBMeta, _rDescription, _rColumnValue )
{
- Any aReturn = OResultColumn::queryInterface(_rType);
- if (!aReturn.hasValue())
- aReturn = ::cppu::queryInterface(_rType,static_cast< XColumn* >(this));
- return aReturn;
}
-// -------------------------------------------------------------------------
-// comphelper::OPropertyArrayUsageHelper
+
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(30)
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP1(CATALOGNAME, ::rtl::OUString, READONLY);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCASESENSITIVE, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1_BOOL(ISDEFINITELYWRITABLE, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISREADONLY, READONLY);
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- DECL_PROP1_BOOL(ISSEARCHABLE, READONLY);
- DECL_PROP1_BOOL(ISSIGNED, READONLY);
- DECL_PROP1_BOOL(ISWRITABLE, READONLY);
- DECL_PROP1(LABEL, ::rtl::OUString, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(SCHEMANAME, ::rtl::OUString, READONLY);
- DECL_PROP1(SERVICENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TABLENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP2(VALUE, Any, READONLY,BOUND);
- DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
- END_PROPERTY_HELPER();
+ const sal_Int32 nDerivedProperties = 21;
+ Sequence< Property> aDerivedProperties( nDerivedProperties );
+ Property* pDesc = aDerivedProperties.getArray();
+ sal_Int32 nPos = 0;
+
+ DECL_PROP1( CATALOGNAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY );
+ DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY );
+ DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY );
+ DECL_PROP1_BOOL( ISCURRENCY, READONLY );
+ DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY );
+ DECL_PROP1( ISNULLABLE, sal_Int32, READONLY );
+ DECL_PROP1_BOOL( ISREADONLY, READONLY );
+ DECL_PROP1_BOOL( ISROWVERSION, READONLY );
+ DECL_PROP1_BOOL( ISSEARCHABLE, READONLY );
+ DECL_PROP1_BOOL( ISSIGNED, READONLY );
+ DECL_PROP1_BOOL( ISWRITABLE, READONLY );
+ DECL_PROP1( LABEL, ::rtl::OUString, READONLY );
+ DECL_PROP1( PRECISION, sal_Int32, READONLY );
+ DECL_PROP1( SCALE, sal_Int32, READONLY );
+ DECL_PROP1( SCHEMANAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( SERVICENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TABLENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TYPE, sal_Int32, READONLY );
+ DECL_PROP1( TYPENAME, ::rtl::OUString, READONLY );
+ DECL_PROP2( VALUE, Any, READONLY, BOUND );
+ OSL_ENSURE( nPos == nDerivedProperties, "ORowSetColumn::createArrayHelper: inconsistency!" );
+
+ Sequence< Property > aRegisteredProperties;
+ describeProperties( aRegisteredProperties );
+
+ return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False );
}
-// cppu::OPropertySetHelper
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& ORowSetColumn::getInfoHelper()
{
return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >* >(this)->getArrayHelper();
}
-// -------------------------------------------------------------------------
-void SAL_CALL ORowSetColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- break;
- case PROPERTY_ID_VALUE:
- if ( !m_aColumnValue.isNull() && (*m_aColumnValue).isValid() )
- rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
- break;
- default:
- ORowSetDataColumn::getFastPropertyValue(rValue,nHandle);
- }
-}
-// -------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
{
- switch(nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- break;
- default:
- ORowSetDataColumn::setFastPropertyValue_NoBroadcast(nHandle,rValue );
- }
+ OSL_ENSURE( nHandle != PROPERTY_ID_VALUE, "ORowSetColumn::setFastPropertyValue_NoBroadcast: hmm? This property is marked as READONLY!" );
+ if ( nHandle != PROPERTY_ID_VALUE )
+ ORowSetDataColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ORowSetColumn::convertFastPropertyValue( Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue ) throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch(nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- rConvertedValue = rValue;
- getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
- bModified = !::comphelper::compare(rConvertedValue, rOldValue);
- break;
- default:
- bModified = ORowSetDataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
-
- }
- return bModified;
-}
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< Type > ORowSetColumn::getTypes() throw (RuntimeException)
-{
- OTypeCollection aTypes(::getCppuType( (const Reference< XColumn > *)0 ),OColumn::getTypes());
- return aTypes.getTypes();
-}
-//--------------------------------------------------------------------------
+//..............................................................................
+} // namespace dbaccess
+//..............................................................................
diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx
index 06b701f42601..45d71d8e513a 100644
--- a/dbaccess/source/core/api/CRowSetColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetColumn.hxx
@@ -46,11 +46,9 @@
namespace dbaccess
{
class ORowSetColumn;
- typedef ::comphelper::OPropertyArrayUsageHelper<ORowSetColumn> ORowSetColumn_PROP;
+ class ORowSetColumn :public ORowSetDataColumn
+ ,public ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >
- // -------------------------------------------------------------------------
- class ORowSetColumn : public ORowSetColumn_PROP,
- public ORowSetDataColumn
{
public:
ORowSetColumn( const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XResultSetMetaData >& _xMetaData,
@@ -58,34 +56,13 @@ namespace dbaccess
sal_Int32 _nPos,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
- ORowSetCacheIterator& _rColumnValue)
- : ORowSetDataColumn(_xMetaData,_xRow,NULL,_nPos,_rxDBMeta,_rDescription,_rColumnValue)
- {
- }
+ ORowSetCacheIterator& _rColumnValue);
- // com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
-
- // com::sun::star::uno::XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
-
- // comphelper::OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- // cppu::OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue )throw (::com::sun::star::uno::Exception);
-
- protected:
- using ORowSetDataColumn::getFastPropertyValue;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue )throw (::com::sun::star::uno::Exception );
};
}
-#endif // DBACCESS_CORE_API_CROWSETCOLUMN_HXX
+#endif // DBACCESS_CORE_API_CROWSETCOLUMN_HXX
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index 3205d343f83b..ae78b8af7817 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -75,11 +75,13 @@ ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >&
const Reference< XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
const ORowSetCacheIterator& _rColumnValue)
- : ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
+ :ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
,m_aColumnValue(_rColumnValue)
,m_aDescription(_rDescription)
{
DBG_CTOR(ORowSetDataColumn,NULL);
+ OColumnSettings::registerProperties( *this );
+ registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, PropertyAttribute::READONLY, &m_aDescription, ::getCppuType( &m_aDescription ) );
}
// -------------------------------------------------------------------------
ORowSetDataColumn::~ORowSetDataColumn()
@@ -91,39 +93,38 @@ ORowSetDataColumn::~ORowSetDataColumn()
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* ORowSetDataColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(31)
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP1(CATALOGNAME, ::rtl::OUString, READONLY);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- DECL_PROP1(DESCRIPTION, ::rtl::OUString, READONLY);
- DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCASESENSITIVE, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1_BOOL(ISDEFINITELYWRITABLE, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISREADONLY, READONLY);
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- DECL_PROP1_BOOL(ISSEARCHABLE, READONLY);
- DECL_PROP1_BOOL(ISSIGNED, READONLY);
- DECL_PROP1_BOOL(ISWRITABLE, READONLY);
- DECL_PROP1(LABEL, ::rtl::OUString, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(SCHEMANAME, ::rtl::OUString, READONLY);
- DECL_PROP1(SERVICENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TABLENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP1(VALUE, Any, BOUND);
- DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
- END_PROPERTY_HELPER();
+ const sal_Int32 nDerivedProperties = 21;
+ Sequence< Property> aDerivedProperties( nDerivedProperties );
+ Property* pDesc = aDerivedProperties.getArray();
+ sal_Int32 nPos = 0;
+
+ DECL_PROP1( CATALOGNAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY );
+ DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY );
+ DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY );
+ DECL_PROP1_BOOL( ISCURRENCY, READONLY );
+ DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY );
+ DECL_PROP1( ISNULLABLE, sal_Int32, READONLY );
+ DECL_PROP1_BOOL( ISREADONLY, READONLY );
+ DECL_PROP1_BOOL( ISROWVERSION, READONLY );
+ DECL_PROP1_BOOL( ISSEARCHABLE, READONLY );
+ DECL_PROP1_BOOL( ISSIGNED, READONLY );
+ DECL_PROP1_BOOL( ISWRITABLE, READONLY );
+ DECL_PROP1( LABEL, ::rtl::OUString, READONLY );
+ DECL_PROP1( PRECISION, sal_Int32, READONLY );
+ DECL_PROP1( SCALE, sal_Int32, READONLY );
+ DECL_PROP1( SCHEMANAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( SERVICENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TABLENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( TYPE, sal_Int32, READONLY );
+ DECL_PROP1( TYPENAME, ::rtl::OUString, READONLY );
+ DECL_PROP1( VALUE, Any, BOUND );
+ OSL_ENSURE( nPos == nDerivedProperties, "ORowSetDataColumn::createArrayHelper: inconsistency!" );
+
+ Sequence< Property > aRegisteredProperties;
+ describeProperties( aRegisteredProperties );
+
+ return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False );
}
// cppu::OPropertySetHelper
@@ -135,57 +136,33 @@ ORowSetDataColumn::~ORowSetDataColumn()
// -------------------------------------------------------------------------
void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
- switch(nHandle)
+ if ( PROPERTY_ID_VALUE == nHandle )
{
- case PROPERTY_ID_DESCRIPTION:
- rValue <<= m_aDescription;
- break;
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- break;
- case PROPERTY_ID_VALUE:
- if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() )
- {
- ::osl::Mutex* pMutex = m_aColumnValue.getMutex();
- ::osl::MutexGuard aGuard( *pMutex );
+ if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() )
+ {
+ ::osl::Mutex* pMutex = m_aColumnValue.getMutex();
+ ::osl::MutexGuard aGuard( *pMutex );
#if OSL_DEBUG_LEVEL > 0
- ORowSetRow aRow = *m_aColumnValue;
+ ORowSetRow aRow = *m_aColumnValue;
#endif
- OSL_ENSURE((sal_Int32)aRow->get().size() > m_nPos,"Pos is greater than size of vector");
- rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
- }
- break;
- default:
- ODataColumn::getFastPropertyValue(rValue,nHandle);
+ OSL_ENSURE((sal_Int32)aRow->get().size() > m_nPos,"Pos is greater than size of vector");
+ rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
+ }
}
+ else
+ ODataColumn::getFastPropertyValue( rValue, nHandle );
}
+
// -------------------------------------------------------------------------
void SAL_CALL ORowSetDataColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
{
- switch(nHandle)
+ if ( PROPERTY_ID_VALUE == nHandle )
+ {
+ updateObject(rValue);
+ }
+ else
{
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- updateObject(rValue);
- break;
- default:
- ODataColumn::setFastPropertyValue_NoBroadcast(nHandle,rValue );
+ ODataColumn::setFastPropertyValue_NoBroadcast( nHandle,rValue );
}
}
// -------------------------------------------------------------------------
@@ -195,27 +172,14 @@ sal_Bool SAL_CALL ORowSetDataColumn::convertFastPropertyValue( Any & rConvertedV
const Any& rValue ) throw (IllegalArgumentException)
{
sal_Bool bModified = sal_False;
- switch(nHandle)
+ if ( PROPERTY_ID_VALUE == nHandle )
{
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- case PROPERTY_ID_VALUE:
- rConvertedValue = rValue;
- getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
- bModified = !::comphelper::compare(rConvertedValue, rOldValue);
- break;
- default:
- bModified = ODataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
-
+ rConvertedValue = rValue;
+ getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
+ bModified = rConvertedValue != rOldValue;
}
+ else
+ bModified = ODataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
return bModified;
}
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx
index 93b812815676..ceec7344737c 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx
@@ -30,21 +30,13 @@
#ifndef DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX
#define DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX
-#ifndef _DBACORE_DATACOLUMN_HXX_
#include "datacolumn.hxx"
-#endif
-#ifndef DBACCESS_CORE_API_ROWSETROW_HXX
#include "RowSetRow.hxx"
-#endif
-#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "RowSetCacheIterator.hxx"
+#include "columnsettings.hxx"
+
#include <connectivity/CommonTools.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
-#endif
-#ifndef DBACCESS_ROWSETCACHEITERATOR_HXX
-#include "RowSetCacheIterator.hxx"
-#endif
namespace dbaccess
{
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index b0fa5b7492c6..c8225f1d7a28 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -706,7 +706,7 @@ OColumn* ODBTableDecorator::createColumn(const ::rtl::OUString& _rName) const
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName))
xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper(xProp,xColumnDefintion);
+ pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
}
}
return pReturn;
@@ -734,8 +734,8 @@ Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor()
if(m_xTable.is())
xNames.set(m_xTable->getColumns(),UNO_QUERY);
Reference< XPropertySet > xRet;
- if(xNames.is())
- xRet = new OTableColumnDescriptorWrapper(xNames->createDataDescriptor());
+ if ( xNames.is() )
+ xRet = new OTableColumnDescriptorWrapper( xNames->createDataDescriptor(), false, true );
return xRet;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx
index 0dde122faa1a..05acfa269909 100644
--- a/dbaccess/source/core/api/column.cxx
+++ b/dbaccess/source/core/api/column.cxx
@@ -31,78 +31,31 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_COLUMN_HXX_
+#include "ContainerMediator.hxx"
+#include "apitools.hxx"
#include "column.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
-#ifndef _DBA_CORE_RESOURCE_HXX_
-#include "core_resource.hxx"
-#endif
-#ifndef _DBA_CORE_RESOURCE_HRC_
#include "core_resource.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include "core_resource.hxx"
+#include "dbastrings.hrc"
+#include "sdbcoretools.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
-#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_ENUMHELPER_HXX_
+
+#include <comphelper/basicio.hxx>
#include <comphelper/enumhelper.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
-#endif
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
-#ifndef _COMPHELPER_SEQSTREAM_HXX
+#include <comphelper/property.hxx>
#include <comphelper/seqstream.hxx>
-#endif
-#ifndef _COMPHELPER_BASIC_IO_HXX_
-#include <comphelper/basicio.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-#ifndef CONNECTIVITY_TABLEHELPER_HXX
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
#include <connectivity/TTableHelper.hxx>
-#endif
-#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_
-#include "definitioncolumn.hxx"
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
-#endif
-#ifndef DBA_CONTAINERMEDIATOR_HXX
-#include "ContainerMediator.hxx"
-#endif
-#ifndef DBACORE_SDBCORETOOLS_HXX
-#include "sdbcoretools.hxx"
-#endif
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/diagnose.h>
+#include <tools/debug.hxx>
#include <algorithm>
@@ -128,11 +81,14 @@ DBG_NAME(OColumn)
//= OColumn
//============================================================
//--------------------------------------------------------------------------
-OColumn::OColumn()
- :OColumnBase(m_aMutex)
- , OPropertySetHelper(OColumnBase::rBHelper)
+OColumn::OColumn( const bool _bNameIsReadOnly )
+ :OColumnBase( m_aMutex )
+ ,::comphelper::OPropertyContainer( OColumnBase::rBHelper )
{
DBG_CTOR(OColumn, NULL);
+
+ registerProperty( PROPERTY_NAME, PROPERTY_ID_NAME, _bNameIsReadOnly ? PropertyAttribute::READONLY : 0,
+ &m_sName, ::getCppuType( &m_sName ) );
}
//--------------------------------------------------------------------------
@@ -145,37 +101,14 @@ OColumn::~OColumn()
//--------------------------------------------------------------------------
Sequence< Type > OColumn::getTypes() throw (RuntimeException)
{
- OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
- ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- OColumnBase::getTypes());
- return aTypes.getTypes();
+ return ::comphelper::concatSequences(
+ OColumnBase::getTypes(),
+ ::comphelper::OPropertyContainer::getTypes()
+ );
}
// com::sun::star::uno::XInterface
-//--------------------------------------------------------------------------
-Any OColumn::queryInterface( const Type & rType ) throw (RuntimeException)
-{
- Any aIface = OColumnBase::queryInterface( rType );
- if (!aIface.hasValue())
- aIface = ::cppu::queryInterface(
- rType,
- static_cast< XPropertySet * >( this ),
- static_cast< XMultiPropertySet * >( this ));
-
- return aIface;
-}
-
-//--------------------------------------------------------------------------
-void OColumn::acquire() throw()
-{
- OColumnBase::acquire();
-}
-
-//--------------------------------------------------------------------------
-void OColumn::release() throw()
-{
- OColumnBase::release();
-}
+IMPLEMENT_FORWARD_XINTERFACE2( OColumn, OColumnBase, ::comphelper::OPropertyContainer )
// ::com::sun::star::lang::XServiceInfo
//------------------------------------------------------------------------------
@@ -202,7 +135,7 @@ Sequence< ::rtl::OUString > OColumn::getSupportedServiceNames( ) throw (Runtime
//------------------------------------------------------------------------------
void OColumn::disposing()
{
- OPropertySetHelper::disposing();
+ OPropertyContainer::disposing();
}
// com::sun::star::beans::XPropertySet
@@ -212,52 +145,6 @@ Reference< XPropertySetInfo > OColumn::getPropertySetInfo() throw (RuntimeExcept
return createPropertySetInfo( getInfoHelper() ) ;
}
-//------------------------------------------------------------------------------
-void OColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_sName;
- break;
- }
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OColumn::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch (nHandle)
- {
- case PROPERTY_ID_NAME:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sName);
- break;
- }
- return bModified;
-}
-
-//------------------------------------------------------------------------------
-void OColumn::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_NAME:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< ::rtl::OUString* >(NULL))),
- "OColumn::setFastPropertyValue_NoBroadcast(NAME) : invalid value !");
- rValue >>= m_sName;
- break;
- }
-}
-
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OColumn::getUnoTunnelImplementationId()
{
@@ -293,235 +180,31 @@ void SAL_CALL OColumn::setName( const ::rtl::OUString& _rName ) throw(::com::sun
{
m_sName = _rName;
}
+
// -----------------------------------------------------------------------------
void OColumn::fireValueChange(const ::connectivity::ORowSetValue& /*_rOldValue*/)
{
DBG_ERROR( "OColumn::fireValueChange: not implemented!" );
}
-// -----------------------------------------------------------------------------
-//============================================================
-//= OColumnSettings
-//============================================================
-DBG_NAME( OColumnSettings )
-//------------------------------------------------------------------------------
-OColumnSettings::OColumnSettings()
- :m_bHidden(sal_False)
-{
- DBG_CTOR( OColumnSettings, NULL );
-}
//------------------------------------------------------------------------------
-OColumnSettings::~OColumnSettings()
+void OColumn::registerProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void* _pPointerToMember, const Type& _rMemberType )
{
- DBG_DTOR( OColumnSettings, NULL );
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OColumnSettings::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- if ( ( rId.getLength() == 16 )
- && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- )
- return reinterpret_cast< sal_Int64 >( this );
-
- return 0;
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OColumnSettings::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-//------------------------------------------------------------------------------
-void OColumnSettings::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- rValue = m_aAlignment;
- break;
- case PROPERTY_ID_NUMBERFORMAT:
- rValue = m_aFormatKey;
- break;
- case PROPERTY_ID_RELATIVEPOSITION:
- rValue = m_aRelativePosition;
- break;
- case PROPERTY_ID_WIDTH:
- rValue = m_aWidth;
- break;
- case PROPERTY_ID_HIDDEN:
- rValue.setValue(&m_bHidden, getBooleanCppuType());
- break;
- case PROPERTY_ID_CONTROLMODEL:
- rValue <<= m_xControlModel;
- break;
- case PROPERTY_ID_HELPTEXT:
- rValue = m_aHelpText;
- break;
- case PROPERTY_ID_CONTROLDEFAULT:
- rValue = m_aControlDefault;
- break;
- }
+ ::comphelper::OPropertyContainer::registerProperty( _rName, _nHandle, _nAttributes, _pPointerToMember, _rMemberType );
}
//------------------------------------------------------------------------------
-sal_Bool OColumnSettings::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- bModified = !uno_type_equalData(
- const_cast< void* >( m_aAlignment.getValue() ), m_aAlignment.getValueType().getTypeLibType(),
- const_cast< void* >( rValue.getValue() ), rValue.getValueType().getTypeLibType(),
- reinterpret_cast< uno_QueryInterfaceFunc >( cpp_queryInterface ),
- reinterpret_cast< uno_ReleaseFunc >( cpp_release )
- );
- if ( bModified )
- {
- rConvertedValue = rValue;
- rOldValue = m_aAlignment;
- }
- break;
- case PROPERTY_ID_WIDTH:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth,
- ::getCppuType(static_cast< sal_Int32* >(NULL)));
- break;
- case PROPERTY_ID_HIDDEN:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bHidden);
- break;
- case PROPERTY_ID_RELATIVEPOSITION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aRelativePosition,
- ::getCppuType(static_cast< sal_Int32* >(NULL)));
- break;
- case PROPERTY_ID_NUMBERFORMAT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFormatKey,
- ::getCppuType(static_cast< sal_Int32* >(NULL)));
- break;
- case PROPERTY_ID_CONTROLMODEL:
- {
- Reference< XPropertySet > xTest;
- if (!::cppu::extractInterface(xTest, rValue))
- throw IllegalArgumentException();
- if (xTest.get() != m_xControlModel.get())
- {
- bModified = sal_True;
- rOldValue <<= m_xControlModel;
- rConvertedValue <<= rValue;
- }
- }
- break;
- case PROPERTY_ID_HELPTEXT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aHelpText,
- ::getCppuType(static_cast< ::rtl::OUString* >(NULL)));
- break;
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = rValue != m_aControlDefault;
- if ( bModified )
- {
- rConvertedValue = rValue;
- rOldValue = m_aControlDefault;
- }
- break;
- }
- return bModified;
-}
-
-//------------------------------------------------------------------------------
-void OColumnSettings::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
+void OColumn::registerMayBeVoidProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, Any* _pPointerToMember, const Type& _rExpectedType )
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- {
- if ( rValue.hasValue() )
- {
- sal_Int32 nAlign = 0;
- sal_Bool bSuccess =
- // copy the data from the to-be-set value
- uno_type_assignData(
- static_cast< void* >( &nAlign ), ::getCppuType(static_cast< sal_Int32* >(NULL)).getTypeLibType(),
- const_cast< void* >( rValue.getValue() ), rValue.getValueType().getTypeLibType(),
- reinterpret_cast< uno_QueryInterfaceFunc >( cpp_queryInterface ),
- reinterpret_cast< uno_AcquireFunc >( cpp_acquire ),
- reinterpret_cast< uno_ReleaseFunc >( cpp_release ) );
-
- OSL_ENSURE( bSuccess,
- "OPropertyStateContainer::setFastPropertyValue_NoBroadcast : ooops .... the value could not be assigned!");
- if ( bSuccess )
- m_aAlignment <<= nAlign;
- }
- else
- m_aAlignment = rValue;
- }
-
- break;
- case PROPERTY_ID_WIDTH:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(WIDTH) : invalid value !");
- m_aWidth = rValue;
- break;
- case PROPERTY_ID_NUMBERFORMAT:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(NUMBERFORMAT) : invalid value !");
- m_aFormatKey = rValue;
- break;
- case PROPERTY_ID_RELATIVEPOSITION:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(ID_RELATIVEPOSITION) : invalid value !");
- m_aRelativePosition = rValue;
- break;
- case PROPERTY_ID_HIDDEN:
- OSL_ENSURE(rValue.getValueType().equals(::getBooleanCppuType()),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(HIDDEN) : invalid value !");
- m_bHidden = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_HELPTEXT:
- OSL_ENSURE(!rValue.hasValue() || rValue.getValueType().equals(::getCppuType(static_cast< ::rtl::OUString* >(NULL))),
- "OColumnSettings::setFastPropertyValue_NoBroadcast(ID_RELATIVEPOSITION) : invalid value !");
- m_aHelpText = rValue;
- break;
- case PROPERTY_ID_CONTROLDEFAULT:
- m_aControlDefault = rValue;
- break;
- }
+ ::comphelper::OPropertyContainer::registerMayBeVoidProperty( _rName, _nHandle, _nAttributes, _pPointerToMember, _rExpectedType );
}
-
//------------------------------------------------------------------------------
-sal_Bool OColumnSettings::isDefaulted() const
+void OColumn::registerPropertyNoMember( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const Type& _rType, const void* _pInitialValue )
{
- return !m_aAlignment.hasValue()
- && !m_aWidth.hasValue()
- && !m_aFormatKey.hasValue()
- && !m_aRelativePosition.hasValue()
- && !m_aHelpText.hasValue()
- && !m_aControlDefault.hasValue()
- && !m_bHidden;
+ ::comphelper::OPropertyContainer::registerPropertyNoMember( _rName, _nHandle, _nAttributes, _rType, _pInitialValue );
}
-
//============================================================
//= OColumns
//============================================================
@@ -547,6 +230,7 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent,
{
DBG_CTOR(OColumns, NULL);
}
+
// -------------------------------------------------------------------------
OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxDrvColumns,
diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx
new file mode 100644
index 000000000000..756c427a7d37
--- /dev/null
+++ b/dbaccess/source/core/api/columnsettings.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+* 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 "columnsettings.hxx"
+#include "dbastrings.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/property.hxx>
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::beans::XPropertySet;
+ /** === end UNO using === **/
+ namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+
+ //==============================================================================
+ //= OColumnSettings
+ //==============================================================================
+ DBG_NAME( OColumnSettings )
+ //------------------------------------------------------------------------------
+ OColumnSettings::OColumnSettings()
+ :m_bHidden(sal_False)
+ {
+ DBG_CTOR( OColumnSettings, NULL );
+ }
+
+ //------------------------------------------------------------------------------
+ OColumnSettings::~OColumnSettings()
+ {
+ DBG_DTOR( OColumnSettings, NULL );
+ }
+
+ // XUnoTunnel
+ //------------------------------------------------------------------
+ sal_Int64 OColumnSettings::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
+ {
+ if ( ( rId.getLength() == 16 )
+ && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
+ )
+ return reinterpret_cast< sal_Int64 >( this );
+
+ return 0;
+ }
+
+ //--------------------------------------------------------------------------
+ Sequence< sal_Int8 > OColumnSettings::getUnoTunnelImplementationId()
+ {
+ static ::cppu::OImplementationId * pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+ }
+
+ //------------------------------------------------------------------------------
+ void OColumnSettings::registerProperties( IPropertyContainer& _rPropertyContainer )
+ {
+ const sal_Int32 nBoundAttr = PropertyAttribute::BOUND;
+ const sal_Int32 nMayBeVoidAttr = PropertyAttribute::MAYBEVOID | nBoundAttr;
+
+ const Type& rSalInt32Type = ::getCppuType( static_cast< sal_Int32* >( NULL ) );
+ const Type& rStringType = ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) );
+
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_ALIGN, PROPERTY_ID_ALIGN, nMayBeVoidAttr, &m_aAlignment, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_NUMBERFORMAT, PROPERTY_ID_NUMBERFORMAT, nMayBeVoidAttr, &m_aFormatKey, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_RELATIVEPOSITION, PROPERTY_ID_RELATIVEPOSITION, nMayBeVoidAttr, &m_aRelativePosition, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_WIDTH, PROPERTY_ID_WIDTH, nMayBeVoidAttr, &m_aWidth, rSalInt32Type );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_HELPTEXT, PROPERTY_ID_HELPTEXT, nMayBeVoidAttr, &m_aHelpText, rStringType );
+ _rPropertyContainer.registerMayBeVoidProperty( PROPERTY_CONTROLDEFAULT, PROPERTY_ID_CONTROLDEFAULT, nMayBeVoidAttr, &m_aControlDefault, rStringType );
+ _rPropertyContainer.registerProperty( PROPERTY_CONTROLMODEL, PROPERTY_ID_CONTROLMODEL, nBoundAttr, &m_xControlModel, ::getCppuType( &m_xControlModel ) );
+ _rPropertyContainer.registerProperty( PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN, nBoundAttr, &m_bHidden, ::getCppuType( &m_bHidden ) );
+ }
+
+ //------------------------------------------------------------------------------
+ bool OColumnSettings::isMine( const sal_Int32 _nPropertyHandle ) const
+ {
+ return ( _nPropertyHandle == PROPERTY_ID_ALIGN )
+ || ( _nPropertyHandle == PROPERTY_ID_NUMBERFORMAT )
+ || ( _nPropertyHandle == PROPERTY_ID_RELATIVEPOSITION )
+ || ( _nPropertyHandle == PROPERTY_ID_WIDTH )
+ || ( _nPropertyHandle == PROPERTY_ID_HELPTEXT )
+ || ( _nPropertyHandle == PROPERTY_ID_CONTROLDEFAULT )
+ || ( _nPropertyHandle == PROPERTY_ID_CONTROLMODEL )
+ || ( _nPropertyHandle == PROPERTY_ID_HIDDEN );
+ }
+
+ //------------------------------------------------------------------------------
+ sal_Bool OColumnSettings::isDefaulted() const
+ {
+ return !m_aAlignment.hasValue()
+ && !m_aWidth.hasValue()
+ && !m_aFormatKey.hasValue()
+ && !m_aRelativePosition.hasValue()
+ && !m_aHelpText.hasValue()
+ && !m_aControlDefault.hasValue()
+ && !m_bHidden;
+ }
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
diff --git a/dbaccess/source/core/api/datasettings.cxx b/dbaccess/source/core/api/datasettings.cxx
index dcca2c34d694..8a5be80c92a2 100644
--- a/dbaccess/source/core/api/datasettings.cxx
+++ b/dbaccess/source/core/api/datasettings.cxx
@@ -69,6 +69,8 @@
#include <com/sun/star/awt/FontWidth.hpp>
#endif
+#include <typeinfo.h>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
@@ -157,19 +159,25 @@ ODataSettings_Base::ODataSettings_Base()
//--------------------------------------------------------------------------
ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource)
+ :m_sFilter( _rSource.m_sFilter )
+ ,m_sHavingClause( _rSource.m_sHavingClause )
+ ,m_sGroupBy( _rSource.m_sGroupBy )
+ ,m_sOrder( _rSource.m_sOrder )
+ ,m_bApplyFilter( _rSource.m_bApplyFilter )
+ ,m_aFont( _rSource.m_aFont )
+ ,m_aRowHeight( _rSource.m_aRowHeight )
+ ,m_aTextColor( _rSource.m_aTextColor )
+ ,m_aTextLineColor( _rSource.m_aTextLineColor )
+ ,m_nFontEmphasis( _rSource.m_nFontEmphasis )
+ ,m_nFontRelief( _rSource.m_nFontRelief )
+{
+}
+
+// -----------------------------------------------------------------------------
+ODataSettings_Base::~ODataSettings_Base()
{
- m_sFilter = _rSource.m_sFilter;
- m_sHavingClause = _rSource.m_sHavingClause;
- m_sGroupBy = _rSource.m_sGroupBy;
- m_sOrder = _rSource.m_sOrder;
- m_bApplyFilter = _rSource.m_bApplyFilter;
- m_aFont = _rSource.m_aFont;
- m_aRowHeight = _rSource.m_aRowHeight;
- m_aTextColor = _rSource.m_aTextColor;
- m_aTextLineColor= _rSource.m_aTextLineColor;
- m_nFontEmphasis = _rSource.m_nFontEmphasis;
- m_nFontRelief = _rSource.m_nFontRelief;
}
+
// -----------------------------------------------------------------------------
void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
{
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 8d0eb5e6b265..fafdf0a97185 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -31,34 +31,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_DEFINITIONSETTINGS_HXX_
+#include "apitools.hxx"
+#include "dbastrings.hrc"
#include "definitioncolumn.hxx"
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
+#include "sdbcoretools.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
+#include <cppuhelper/typeprovider.hxx>
#include <tools/debug.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef DBACORE_SDBCORETOOLS_HXX
-#include "sdbcoretools.hxx"
-#endif
-
+#include <tools/diagnose_ex.h>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
@@ -79,7 +63,29 @@ using namespace dbaccess;
//============================================================
IMPLEMENT_FORWARD_XINTERFACE2(OTableColumnDescriptor,OColumn,TXChild)
-// com::sun::star::lang::XTypeProvider
+//------------------------------------------------------------------------------
+void OTableColumnDescriptor::impl_registerProperties( const bool _bActAsDescriptor )
+{
+ sal_Int32 nDefaultAttr = _bActAsDescriptor ? 0 : PropertyAttribute::READONLY;
+
+ registerProperty( PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, nDefaultAttr, &m_aTypeName, ::getCppuType( &m_aTypeName ) );
+ registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, nDefaultAttr, &m_aDescription, ::getCppuType( &m_aDescription ) );
+ registerProperty( PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, nDefaultAttr, &m_aDefaultValue, ::getCppuType( &m_aDefaultValue ) );
+
+ if ( _bActAsDescriptor )
+ registerProperty( PROPERTY_AUTOINCREMENTCREATION, PROPERTY_ID_AUTOINCREMENTCREATION, nDefaultAttr, &m_aAutoIncrementValue, ::getCppuType( &m_aAutoIncrementValue ) );
+
+ registerProperty( PROPERTY_TYPE, PROPERTY_ID_TYPE, nDefaultAttr, &m_nType, ::getCppuType( &m_nType ) );
+ registerProperty( PROPERTY_PRECISION, PROPERTY_ID_PRECISION, nDefaultAttr, &m_nPrecision, ::getCppuType( &m_nPrecision ) );
+ registerProperty( PROPERTY_SCALE, PROPERTY_ID_SCALE, nDefaultAttr, &m_nScale, ::getCppuType( &m_nScale ) );
+ registerProperty( PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, nDefaultAttr, &m_nIsNullable, ::getCppuType( &m_nIsNullable ) );
+ registerProperty( PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, nDefaultAttr, &m_bAutoIncrement, ::getCppuType( &m_bAutoIncrement ) );
+ registerProperty( PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, nDefaultAttr, &m_bRowVersion, ::getCppuType( &m_bRowVersion ) );
+ registerProperty( PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, nDefaultAttr, &m_bCurrency, ::getCppuType( &m_bCurrency ) );
+
+ OColumnSettings::registerProperties( *this );
+}
+
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OTableColumnDescriptor::getImplementationId() throw (RuntimeException)
{
@@ -116,28 +122,9 @@ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( )
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumnDescriptor::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(20)
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP1(AUTOINCREMENTCREATION,::rtl::OUString, MAYBEVOID);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- DECL_PROP0(DEFAULTVALUE, ::rtl::OUString );
- DECL_PROP0(DESCRIPTION, ::rtl::OUString );
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP0_BOOL(ISAUTOINCREMENT );
- DECL_PROP0_BOOL(ISCURRENCY );
- DECL_PROP0(ISNULLABLE, sal_Int32 );
- DECL_PROP0_BOOL(ISROWVERSION );
- DECL_PROP0(NAME, ::rtl::OUString );
- DECL_PROP0(PRECISION, sal_Int32 );
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP0(SCALE, sal_Int32 );
- DECL_PROP0(TYPE, sal_Int32 );
- DECL_PROP0(TYPENAME, ::rtl::OUString );
- DECL_PROP2(WIDTH, sal_Int32, BOUND, MAYBEVOID);
- END_PROPERTY_HELPER();
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
}
// cppu::OPropertySetHelper
@@ -148,181 +135,10 @@ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( )
}
//------------------------------------------------------------------------------
-void OTableColumnDescriptor::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
{
- switch (nHandle)
- {
- case PROPERTY_ID_TYPE:
- rValue <<= m_nType;
- break;
- case PROPERTY_ID_PRECISION:
- rValue <<= m_nPrecision;
- break;
- case PROPERTY_ID_SCALE:
- rValue <<= m_nScale;
- break;
- case PROPERTY_ID_ISNULLABLE:
- rValue <<= m_nIsNullable;
- break;
- case PROPERTY_ID_TYPENAME:
- rValue <<= m_aTypeName;
- break;
- case PROPERTY_ID_DESCRIPTION:
- rValue <<= m_aDescription;
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- rValue <<= m_aDefaultValue;
- break;
- case PROPERTY_ID_AUTOINCREMENTCREATION:
- rValue <<= m_aAutoIncrementValue;
- break;
- case PROPERTY_ID_ISAUTOINCREMENT:
- {
- sal_Bool bVal = m_bAutoIncrement;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- case PROPERTY_ID_ISCURRENCY:
- {
- sal_Bool bVal = m_bCurrency;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- case PROPERTY_ID_ISROWVERSION:
- {
- sal_Bool bVal = m_bRowVersion;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- case PROPERTY_ID_NAME:
- OColumn::getFastPropertyValue( rValue, nHandle );
- break;
- default:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- }
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OTableColumnDescriptor::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
- switch (nHandle)
- {
- case PROPERTY_ID_TYPE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nType);
- break;
- case PROPERTY_ID_PRECISION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nPrecision);
- break;
- case PROPERTY_ID_SCALE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nScale);
- break;
- case PROPERTY_ID_ISNULLABLE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nIsNullable);
- break;
- case PROPERTY_ID_TYPENAME:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTypeName);
- break;
- case PROPERTY_ID_DESCRIPTION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDescription);
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultValue);
- break;
- case PROPERTY_ID_AUTOINCREMENTCREATION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aAutoIncrementValue);
- break;
- case PROPERTY_ID_ISAUTOINCREMENT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAutoIncrement);
- break;
- case PROPERTY_ID_ISCURRENCY:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bCurrency);
- break;
- case PROPERTY_ID_ISROWVERSION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bRowVersion);
- break;
- case PROPERTY_ID_NAME:
- bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- default:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- }
- return bModified;
-}
-
-//------------------------------------------------------------------------------
-void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_TYPE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(TYPE) : invalid value !");
- rValue >>= m_nType;
- break;
- case PROPERTY_ID_PRECISION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(PRECISION) : invalid value !");
- rValue >>= m_nPrecision;
- break;
- case PROPERTY_ID_SCALE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(SCALE) : invalid value !");
- rValue >>= m_nScale;
- break;
- case PROPERTY_ID_ISNULLABLE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Int32* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISNULLABLE) : invalid value !");
- rValue >>= m_nIsNullable;
- break;
- case PROPERTY_ID_TYPENAME:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(TYPENAME) : invalid value !");
- rValue >>= m_aTypeName;
- break;
- case PROPERTY_ID_DESCRIPTION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(DESCRIPTION) : invalid value !");
- rValue >>= m_aDescription;
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(DEFAULTVALUE) : invalid value !");
- rValue >>= m_aDefaultValue;
- break;
- case PROPERTY_ID_AUTOINCREMENTCREATION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< rtl::OUString* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(AUTOINCREMENTVALUE) : invalid value !");
- rValue >>= m_aAutoIncrementValue;
- break;
- case PROPERTY_ID_ISAUTOINCREMENT:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Bool* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISAUTOINCREMENT) : invalid value !");
- m_bAutoIncrement = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_ISCURRENCY:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Bool* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISCURRENCY) : invalid value !");
- m_bCurrency = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_ISROWVERSION:
- OSL_ENSURE(rValue.getValueType().equals(::getCppuType(static_cast< sal_Bool* >(NULL))),
- "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISROWVERSION) : invalid value !");
- m_bRowVersion = ::comphelper::getBOOL(rValue);
- break;
- case PROPERTY_ID_NAME:
- OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- default:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- }
- ::dbaccess::notifyDataSourceModified(m_xParent,sal_True);
+ OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ ::dbaccess::notifyDataSourceModified( m_xParent, sal_True );
}
// -----------------------------------------------------------------------------
@@ -350,33 +166,64 @@ void SAL_CALL OTableColumnDescriptor::setParent( const Reference< XInterface >&
//= OTableColumn
//============================================================
DBG_NAME(OTableColumn);
-OTableColumn::OTableColumn(const ::rtl::OUString& _rName)
+
+// -------------------------------------------------------------------------
+OTableColumn::OTableColumn( const ::rtl::OUString& _rName )
+ :OTableColumnDescriptor( false )
{
DBG_CTOR(OTableColumn,NULL);
m_sName = _rName;
}
+
// -------------------------------------------------------------------------
OTableColumn::OTableColumn(const Reference<XPropertySet>& _xColumn)
+ :OTableColumnDescriptor( false )
{
DBG_CTOR(OTableColumn,NULL);
- m_aTypeName = (::comphelper::getString(_xColumn->getPropertyValue(PROPERTY_TYPENAME)));
- if(_xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE))
- m_aDefaultValue = (::comphelper::getString(_xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE)));
- m_nIsNullable = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_ISNULLABLE)));
- m_nPrecision = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_PRECISION)));
- m_nScale = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_SCALE)));
- m_nType = (::comphelper::getINT32(_xColumn->getPropertyValue(PROPERTY_TYPE)));
- m_bAutoIncrement = (::comphelper::getBOOL(_xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
- m_bRowVersion = (sal_False);
- m_bCurrency = (::comphelper::getBOOL(_xColumn->getPropertyValue(PROPERTY_ISCURRENCY)));
- _xColumn->getPropertyValue(PROPERTY_NAME) >>= m_sName;
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_TYPENAME ) >>= m_aTypeName );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= m_nIsNullable );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_PRECISION ) >>= m_nPrecision );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_SCALE ) >>= m_nScale );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency );
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName );
+ m_bRowVersion = sal_False;
+
+ Reference< XPropertySetInfo > xPSI( _xColumn->getPropertySetInfo(), UNO_SET_THROW );
+ if ( xPSI->hasPropertyByName( PROPERTY_DEFAULTVALUE ) )
+ OSL_VERIFY( _xColumn->getPropertyValue( PROPERTY_DEFAULTVALUE ) >>= m_aDefaultValue );
+
+ // if the source column also has column settings, copy those
+ struct ColumnSettingDescriptor
+ {
+ ::rtl::OUString sName;
+ sal_Int32 nHandle;
+ };
+ ColumnSettingDescriptor aProps[] =
+ {
+ { PROPERTY_WIDTH, PROPERTY_ID_WIDTH },
+ { PROPERTY_NUMBERFORMAT, PROPERTY_ID_NUMBERFORMAT },
+ { PROPERTY_RELATIVEPOSITION, PROPERTY_ID_RELATIVEPOSITION },
+ { PROPERTY_ALIGN, PROPERTY_ID_ALIGN },
+ { PROPERTY_HELPTEXT, PROPERTY_ID_HELPTEXT },
+ { PROPERTY_CONTROLDEFAULT, PROPERTY_ID_CONTROLDEFAULT },
+ { PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN }
+ };
+ for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i )
+ {
+ if ( xPSI->hasPropertyByName( aProps[i].sName ) )
+ OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( aProps[i].nHandle, _xColumn->getPropertyValue( aProps[i].sName ) );
+ }
}
+
// -----------------------------------------------------------------------------
OTableColumn::~OTableColumn()
{
DBG_DTOR(OTableColumn,NULL);
}
+
// com::sun::star::lang::XTypeProvider
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OTableColumn::getImplementationId() throw (RuntimeException)
@@ -420,27 +267,7 @@ Sequence< ::rtl::OUString > OTableColumn::getSupportedServiceNames( ) throw (Ru
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(19)
- DECL_PROP2(ALIGN, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet , BOUND);
- DECL_PROP1(DEFAULTVALUE, ::rtl::OUString, READONLY);
- DECL_PROP1(DESCRIPTION, ::rtl::OUString, READONLY);
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP2(WIDTH, sal_Int32, BOUND, MAYBEVOID);
- END_PROPERTY_HELPER();
+ return OTableColumnDescriptor::createArrayHelper();
}
//============================================================
@@ -448,29 +275,24 @@ Sequence< ::rtl::OUString > OTableColumn::getSupportedServiceNames( ) throw (Ru
//============================================================
DBG_NAME(OColumnWrapper);
//--------------------------------------------------------------------------
-OColumnWrapper::OColumnWrapper(const Reference< XPropertySet > & rCol)
- :m_xAggregate(rCol)
- ,m_nColTypeID(-1)
+OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bool _bNameIsReadOnly )
+ :OColumn( _bNameIsReadOnly )
+ ,m_xAggregate(rCol)
+ ,m_nColTypeID(-1)
{
DBG_CTOR(OColumnWrapper,NULL);
- // which type of aggregate property do we have
- if (m_nColTypeID == -1)
+ // which type of aggregate property do we have?
+ // we distingish the properties by the containment of optional properties
+ m_nColTypeID = 0;
+ if ( m_xAggregate.is() )
{
- // we distingish the properties by the containment of optional properties, these are:
- // Description 0x0001
- // Hidden 0x0002
- // IsRowVersion 0x0004
- m_nColTypeID = 0;
- if ( m_xAggregate.is() )
- {
- Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
+ Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
- m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
- }
+ m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
}
}
// -----------------------------------------------------------------------------
@@ -480,59 +302,65 @@ OColumnWrapper::~OColumnWrapper()
}
//------------------------------------------------------------------------------
+::rtl::OUString OColumnWrapper::impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const
+{
+ ::rtl::OUString sPropName;
+ sal_Int16 nAttributes( 0 );
+ const_cast< OColumnWrapper* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
+ OSL_ENSURE( sPropName.getLength(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
+ return sPropName;
+}
+
+//------------------------------------------------------------------------------
void OColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
- switch (nHandle)
+ // derived classes are free to either use the OPropertyContainer(Helper) mechanisms for properties,
+ // or to declare additional properties which are to be forwarded to the wrapped object. So we need
+ // to distinguish those cases.
+ if ( OColumn::isRegisteredProperty( nHandle ) )
{
- case PROPERTY_ID_NAME:
- rValue <<= m_sName;
- break;
- default:
- {
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OColumnWrapper*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = m_xAggregate->getPropertyValue(aPropName);
- }
+ OColumn::getFastPropertyValue( rValue, nHandle );
+ }
+ else
+ {
+ rValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
}
}
//------------------------------------------------------------------------------
-sal_Bool OColumnWrapper::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
+sal_Bool OColumnWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle,
+ const Any& rValue ) throw (IllegalArgumentException)
{
- // used for the name
- sal_Bool bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
-
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- getInfoHelper().fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- m_xAggregate->setPropertyValue(aPropName, rValue);
+ sal_Bool bModified( sal_False );
+ if ( OColumn::isRegisteredProperty( nHandle ) )
+ {
+ bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
+ }
+ else
+ {
+ getFastPropertyValue( rOldValue, nHandle );
+ if ( rOldValue != rValue )
+ {
+ rConvertedValue = rValue;
+ bModified = sal_True;
+ }
+ }
return bModified;
}
//------------------------------------------------------------------------------
-void OColumnWrapper::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
+void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
{
- OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ if ( OColumn::isRegisteredProperty( nHandle ) )
+ {
+ OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ }
+ else
+ {
+ m_xAggregate->setPropertyValue( impl_getPropertyNameFromHandle( nHandle ), rValue );
+ }
}
+
// -----------------------------------------------------------------------------
sal_Int64 SAL_CALL OColumnWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw(RuntimeException)
{
@@ -545,9 +373,20 @@ sal_Int64 SAL_CALL OColumnWrapper::getSomething( const Sequence< sal_Int8 >& aId
}
return nRet;
}
+
//============================================================
//= OTableColumnDescriptorWrapper
//============================================================
+//--------------------------------------------------------------------------
+OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference< XPropertySet >& _rCol, const bool _bPureWrap, const bool _bIsDescriptor )
+ :OColumnWrapper( _rCol, !_bIsDescriptor )
+ ,m_bPureWrap( _bPureWrap )
+ ,m_bIsDescriptor( _bIsDescriptor )
+{
+ // let the ColumnSettings register its properties
+ OColumnSettings::registerProperties( *this );
+}
+
// com::sun::star::lang::XTypeProvider
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OTableColumnDescriptorWrapper::getImplementationId() throw (RuntimeException)
@@ -594,61 +433,68 @@ sal_Int64 SAL_CALL OTableColumnDescriptorWrapper::getSomething( const Sequence<
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumnDescriptorWrapper::createArrayHelper( sal_Int32 nId ) const
{
- // BEGIN_PROPERTY_HELPER(17)
- sal_Int32 nPropertyCount = 16;
- // How many properties do we have?
+ const sal_Int32 nHaveAlways = 7;
+
// Which optional properties are contained?
+ sal_Int32 nHaveOptionally = 0;
if (nId & HAS_DESCRIPTION)
- ++nPropertyCount;
+ ++nHaveOptionally;
if (nId & HAS_DEFAULTVALUE)
- ++nPropertyCount;
+ ++nHaveOptionally;
if (nId & HAS_ROWVERSION)
- ++nPropertyCount;
+ ++nHaveOptionally;
if ( nId & HAS_AUTOINCREMENT_CREATION )
- ++nPropertyCount;
+ ++nHaveOptionally;
- Sequence< Property> aDescriptor(nPropertyCount);
- Property* pDesc = aDescriptor.getArray();
+ const sal_Int32 nPropertyCount( nHaveAlways + nHaveOptionally );
+ Sequence< Property > aTableDescProperties( nPropertyCount );
+ Property* pDesc = aTableDescProperties.getArray();
sal_Int32 nPos = 0;
- // Description, Defaultvalue, IsRowVersion
- DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- {
- DECL_PROP1(AUTOINCREMENTCREATION,::rtl::OUString, MAYBEVOID);
- }
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
- if (nId & HAS_DEFAULTVALUE)
- {
- DECL_PROP0(DEFAULTVALUE, ::rtl::OUString );
- }
+ DECL_PROP0_BOOL( ISAUTOINCREMENT );
+ DECL_PROP0_BOOL( ISCURRENCY );
+ DECL_PROP0( ISNULLABLE, sal_Int32 );
+ DECL_PROP0( PRECISION, sal_Int32 );
+ DECL_PROP0( SCALE, sal_Int32 );
+ DECL_PROP0( TYPE, sal_Int32 );
+ DECL_PROP0( TYPENAME, ::rtl::OUString );
- if (nId & HAS_DESCRIPTION)
- {
- DECL_PROP0(DESCRIPTION, ::rtl::OUString );
- }
+ if ( nId & HAS_AUTOINCREMENT_CREATION )
+ {
+ DECL_PROP1( AUTOINCREMENTCREATION, ::rtl::OUString, MAYBEVOID );
+ }
+ if ( nId & HAS_DEFAULTVALUE )
+ {
+ DECL_PROP0( DEFAULTVALUE, ::rtl::OUString );
+ }
+ if ( nId & HAS_DESCRIPTION )
+ {
+ DECL_PROP0( DESCRIPTION, ::rtl::OUString );
+ }
+ if ( nId & HAS_ROWVERSION )
+ {
+ DECL_PROP0_BOOL( ISROWVERSION );
+ }
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP0_BOOL(ISAUTOINCREMENT );
- DECL_PROP0_BOOL(ISCURRENCY );
- DECL_PROP0(ISNULLABLE, sal_Int32 );
+ OSL_ENSURE( nPos == nPropertyCount, "OTableColumnDescriptorWrapper::createArrayHelper: something went wrong!" );
- if (nId & HAS_ROWVERSION)
+ if ( !m_bIsDescriptor )
+ {
+ for ( Property* prop = aTableDescProperties.getArray();
+ prop != aTableDescProperties.getArray() + aTableDescProperties.getLength();
+ ++prop
+ )
{
- DECL_PROP0_BOOL(ISROWVERSION );
+ prop->Attributes |= PropertyAttribute::READONLY;
}
+ }
+
+ // finally also describe the properties which are maintained by our base class, in particular the OPropertyContainerHelper
+ Sequence< Property > aBaseProperties;
+ describeProperties( aBaseProperties );
- DECL_PROP0(NAME, ::rtl::OUString );
- DECL_PROP0(PRECISION, sal_Int32 );
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP0(SCALE, sal_Int32 );
- DECL_PROP0(TYPE, sal_Int32 );
- DECL_PROP0(TYPENAME, ::rtl::OUString );
- DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
- END_PROPERTY_HELPER();
+ Sequence< Property > aAllProperties( ::comphelper::concatSequences( aTableDescProperties, aBaseProperties ) );
+ return new ::cppu::OPropertyArrayHelper( aAllProperties, sal_False );
}
// cppu::OPropertySetHelper
@@ -663,75 +509,36 @@ void OTableColumnDescriptorWrapper::getFastPropertyValue( Any& rValue, sal_Int32
{
if ( m_bPureWrap )
{
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OTableColumnDescriptorWrapper*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = m_xAggregate->getPropertyValue(aPropName);
+ rValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
}
else
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::getFastPropertyValue( rValue, nHandle );
- break;
- default:
- {
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OTableColumnDescriptorWrapper*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = m_xAggregate->getPropertyValue(aPropName);
- }
- }
+ OColumnWrapper::getFastPropertyValue( rValue, nHandle );
}
}
//------------------------------------------------------------------------------
-sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (IllegalArgumentException)
+sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw (IllegalArgumentException)
{
sal_Bool bModified(sal_False);
if ( m_bPureWrap )
- bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- else
{
- switch (nHandle)
+ // do not delegate to OColumnWrapper: It would, for the properties which were registered with registerProperty,
+ // ask the OPropertyContainer base class, which is not what we want here.
+ // TODO: the whole "m_bPureWrap"-thingie is strange. We should have a dedicated class doing this wrapping,
+ // not a class which normally serves other purposes, and only sometimes does a "pure wrap". It makes the
+ // code unnecessarily hard to maintain, and error prone.
+ rOldValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
+ if ( rOldValue != rValue )
{
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
- break;
- default:
- bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
+ rConvertedValue = rValue;
+ bModified = sal_True;
}
}
+ else
+ {
+ bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
+ }
return bModified;
}
@@ -743,24 +550,12 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
throw (Exception)
{
if ( m_bPureWrap )
- OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ {
+ m_xAggregate->setPropertyValue( impl_getPropertyNameFromHandle( nHandle ), rValue );
+ }
else
{
- switch (nHandle)
- {
- case PROPERTY_ID_ALIGN:
- case PROPERTY_ID_NUMBERFORMAT:
- case PROPERTY_ID_RELATIVEPOSITION:
- case PROPERTY_ID_WIDTH:
- case PROPERTY_ID_HIDDEN:
- case PROPERTY_ID_CONTROLMODEL:
- case PROPERTY_ID_HELPTEXT:
- case PROPERTY_ID_CONTROLDEFAULT:
- OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- break;
- default:
- OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- }
+ OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
}
}
@@ -768,24 +563,23 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
//= OTableColumnWrapper
//============================================================
//--------------------------------------------------------------------------
-OTableColumnWrapper::OTableColumnWrapper(const Reference< XPropertySet >& rCol
- ,const Reference< XPropertySet >& _xColDefintion
- ,sal_Bool _bPureWrap)
- :OTableColumnDescriptorWrapper(rCol,_bPureWrap)
+OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefintion,
+ bool _bPureWrap )
+ :OTableColumnDescriptorWrapper( rCol, _bPureWrap, false )
{
- osl_incrementInterlockedCount(&m_refCount);
+ osl_incrementInterlockedCount( &m_refCount );
if ( _xColDefintion.is() )
{
try
{
- ::comphelper::copyProperties(_xColDefintion,this);
+ ::comphelper::copyProperties( _xColDefintion, this );
}
- catch(Exception&)
+ catch( const Exception& )
{
- OSL_ENSURE(sal_False, "OTableColumnWrapper::OTableColumnWrapper: caught an exception!");
+ DBG_UNHANDLED_EXCEPTION();
}
}
- osl_decrementInterlockedCount(&m_refCount);
+ osl_decrementInterlockedCount( &m_refCount );
}
//--------------------------------------------------------------------------
@@ -809,11 +603,12 @@ Sequence< sal_Int8 > OTableColumnWrapper::getImplementationId() throw (RuntimeEx
}
return pId->getImplementationId();
}
+
// ::com::sun::star::lang::XServiceInfo
//------------------------------------------------------------------------------
rtl::OUString OTableColumnWrapper::getImplementationName( ) throw (RuntimeException)
{
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnWrapper");
+ return rtl::OUString::createFromAscii( "com.sun.star.sdb.OTableColumnWrapper" );
}
//------------------------------------------------------------------------------
@@ -835,206 +630,6 @@ Sequence< ::rtl::OUString > OTableColumnWrapper::getSupportedServiceNames( ) th
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OTableColumnWrapper::createArrayHelper( sal_Int32 nId ) const
{
- // BEGIN_PROPERTY_HELPER(17)
- sal_Int32 nPropertyCount = 16;
- // How many properties do we have?
- // Which optional properties are contained?
- if (nId & HAS_DESCRIPTION)
- nPropertyCount++;
- if (nId & HAS_DEFAULTVALUE)
- nPropertyCount++;
- if (nId & HAS_ROWVERSION)
- nPropertyCount++;
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- ++nPropertyCount;
-
- Sequence< Property> aDescriptor(nPropertyCount);
- Property* pDesc = aDescriptor.getArray();
- sal_Int32 nPos = 0;
-
- // Description, Defaultvalue, IsRowVersion
- DECL_PROP2(ALIGN, sal_Int32, BOUND, MAYBEVOID);
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- {
- DECL_PROP1(AUTOINCREMENTCREATION,::rtl::OUString, MAYBEVOID);
- }
- DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet , BOUND);
- if (nId & HAS_DEFAULTVALUE)
- {
- DECL_PROP1(DEFAULTVALUE, ::rtl::OUString, READONLY);
- }
-
- if (nId & HAS_DESCRIPTION)
- {
- DECL_PROP1(DESCRIPTION, ::rtl::OUString, READONLY);
- }
-
- DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
- DECL_PROP1_BOOL(HIDDEN, BOUND);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
-
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
-
- if (nId & HAS_ROWVERSION)
- {
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- }
-
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- DECL_PROP2(WIDTH, sal_Int32, BOUND, MAYBEVOID);
- END_PROPERTY_HELPER();
-}
-
-//============================================================
-//= OIndexColumnWrapper
-//============================================================
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OIndexColumnWrapper::getImplementationId() throw (RuntimeException)
-{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// ::com::sun::star::lang::XServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OIndexColumnWrapper::getImplementationName( ) throw (RuntimeException)
-{
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OIndexColumnWrapper");
-}
-
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OIndexColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBCX_COLUMN;
- aSNS[1] = SERVICE_SDBCX_INDEXCOLUMN;
- return aSNS;
-}
-
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OIndexColumnWrapper::getInfoHelper()
-{
- return *static_cast< OPropertyArrayUsageHelper< OIndexColumnWrapper >* >(this)->getArrayHelper();
-}
-
-// comphelper::OPropertyArrayUsageHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OIndexColumnWrapper::createArrayHelper() const
-{
- BEGIN_PROPERTY_HELPER(9)
- DECL_PROP1_BOOL(ISASCENDING, READONLY);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- END_PROPERTY_HELPER();
-}
-
-//------------------------------------------------------------------------------
-void OIndexColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISASCENDING:
- {
- sal_Bool bVal = m_bAscending;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- default:
- OColumnWrapper::getFastPropertyValue( rValue, nHandle );
- }
-}
-
-//============================================================
-//= OKeyColumnWrapper
-//============================================================
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OKeyColumnWrapper::getImplementationId() throw (RuntimeException)
-{
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// ::com::sun::star::lang::XServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OKeyColumnWrapper::getImplementationName( ) throw (RuntimeException)
-{
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OIndexColumnWrapper");
+ return OTableColumnDescriptorWrapper::createArrayHelper( nId );
}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OKeyColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBCX_COLUMN;
- aSNS[1] = SERVICE_SDBCX_KEYCOLUMN;
- return aSNS;
-}
-
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OKeyColumnWrapper::getInfoHelper()
-{
- return *static_cast< OPropertyArrayUsageHelper< OKeyColumnWrapper >* >(this)->getArrayHelper();
-}
-
-// comphelper::OPropertyArrayUsageHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OKeyColumnWrapper::createArrayHelper() const
-{
- BEGIN_PROPERTY_HELPER(9)
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1(NAME, ::rtl::OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP1(RELATEDCOLUMN, ::rtl::OUString, READONLY);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
- END_PROPERTY_HELPER();
-}
-
-//------------------------------------------------------------------------------
-void OKeyColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_RELATEDCOLUMN:
- rValue <<= m_aRelatedColumn;
- break;
- default:
- OColumnWrapper::getFastPropertyValue( rValue, nHandle );
- }
-}
-
-
diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk
index 59d89fb9036f..f983db38b640 100644
--- a/dbaccess/source/core/api/makefile.mk
+++ b/dbaccess/source/core/api/makefile.mk
@@ -73,7 +73,8 @@ SLOFILES= \
$(SLO)$/tablecontainer.obj \
$(SLO)$/SingleSelectQueryComposer.obj \
$(SLO)$/HelperCollections.obj \
- $(SLO)$/datasettings.obj
+ $(SLO)$/datasettings.obj \
+ $(SLO)$/columnsettings.obj
# --- Targets ----------------------------------
diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx
index 761b27fc94ed..f2fd05cdf12c 100644
--- a/dbaccess/source/core/api/preparedstatement.cxx
+++ b/dbaccess/source/core/api/preparedstatement.cxx
@@ -30,39 +30,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_PREPAREDSTATEMENT_HXX_
-#include <preparedstatement.hxx>
-#endif
-#ifndef _DBA_COREAPI_RESULTSET_HXX_
-#include <resultset.hxx>
-#endif
-#ifndef _DBA_COREAPI_RESULTCOLUMN_HXX_
-#include <resultcolumn.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
+
#include "dbastrings.hrc"
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+
#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
+
+#include <comphelper/property.hxx>
#include <comphelper/sequence.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <preparedstatement.hxx>
+#include <resultcolumn.hxx>
+#include <resultset.hxx>
#include <tools/debug.hxx>
-#endif
+#include <tools/diagnose_ex.h>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
@@ -203,27 +185,23 @@ Reference< ::com::sun::star::container::XNameAccess > OPreparedStatement::getCol
{
try
{
- // get the metadata
- Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xAggregateAsSet, UNO_QUERY)->getMetaData();
- // do we have columns
- if ( xMetaData.is() )
+ Reference< XResultSetMetaDataSupplier > xSuppMeta( m_xAggregateAsSet, UNO_QUERY_THROW );
+ Reference< XResultSetMetaData > xMetaData( xSuppMeta->getMetaData(), UNO_SET_THROW );
+
+ Reference< XConnection > xConn( getConnection(), UNO_SET_THROW );
+ Reference< XDatabaseMetaData > xDBMeta( xConn->getMetaData(), UNO_SET_THROW );
+
+ for (sal_Int32 i = 0, nCount = xMetaData->getColumnCount(); i < nCount; ++i)
{
- Reference< XDatabaseMetaData > xDBMeta;
- Reference< XConnection > xConn( getConnection() );
- if ( xConn.is() )
- xDBMeta = xConn->getMetaData();
-
- for (sal_Int32 i = 0, nCount = xMetaData->getColumnCount(); i < nCount; ++i)
- {
- // retrieve the name of the column
- rtl::OUString aName = xMetaData->getColumnName(i + 1);
- OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
- m_pColumns->append(aName, pColumn);
- }
+ // retrieve the name of the column
+ rtl::OUString aName = xMetaData->getColumnName(i + 1);
+ OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
+ m_pColumns->append(aName, pColumn);
}
}
- catch (SQLException)
+ catch (const SQLException& )
{
+ DBG_UNHANDLED_EXCEPTION();
}
m_pColumns->setInitialized();
}
@@ -236,7 +214,7 @@ Reference< XResultSetMetaData > OPreparedStatement::getMetaData(void) throw( SQL
{
MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
- return Reference< XResultSetMetaDataSupplier >(m_xAggregateAsSet, UNO_QUERY)->getMetaData();
+ return Reference< XResultSetMetaDataSupplier >( m_xAggregateAsSet, UNO_QUERY_THROW )->getMetaData();
}
// XPreparedStatement
@@ -249,7 +227,7 @@ Reference< XResultSet > OPreparedStatement::executeQuery() throw( SQLException,
disposeResultSet();
Reference< XResultSet > xResultSet;
- Reference< XResultSet > xDrvResultSet = Reference< XPreparedStatement >(m_xAggregateAsSet, UNO_QUERY)->executeQuery();
+ Reference< XResultSet > xDrvResultSet = Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeQuery();
if (xDrvResultSet.is())
{
xResultSet = new OResultSet(xDrvResultSet, *this, m_pColumns->isCaseSensitive());
@@ -268,7 +246,7 @@ sal_Int32 OPreparedStatement::executeUpdate() throw( SQLException, RuntimeExcept
disposeResultSet();
- return Reference< XPreparedStatement >(m_xAggregateAsSet, UNO_QUERY)->executeUpdate();
+ return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeUpdate();
}
//------------------------------------------------------------------------------
@@ -278,7 +256,8 @@ sal_Bool OPreparedStatement::execute() throw( SQLException, RuntimeException )
::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
disposeResultSet();
- return Reference< XPreparedStatement >(m_xAggregateAsSet, UNO_QUERY)->execute();
+
+ return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->execute();
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx
index 4fb765148df9..33cc93b02994 100644
--- a/dbaccess/source/core/api/resultcolumn.cxx
+++ b/dbaccess/source/core/api/resultcolumn.cxx
@@ -82,13 +82,12 @@ using namespace dbaccess;
DBG_NAME(OResultColumn)
//--------------------------------------------------------------------------
-OResultColumn::OResultColumn(
- const Reference < XResultSetMetaData >& _xMetaData,
- sal_Int32 _nPos,
- const Reference< XDatabaseMetaData >& _rxDBMeta )
- :m_xMetaData(_xMetaData)
- ,m_xDBMetaData(_rxDBMeta)
- ,m_nPos(_nPos)
+OResultColumn::OResultColumn( const Reference < XResultSetMetaData >& _xMetaData, sal_Int32 _nPos,
+ const Reference< XDatabaseMetaData >& _rxDBMeta )
+ :OColumn( true )
+ ,m_xMetaData( _xMetaData )
+ ,m_xDBMetaData( _rxDBMeta )
+ ,m_nPos( _nPos )
{
DBG_CTOR(OResultColumn,NULL);
}
@@ -216,112 +215,95 @@ void OResultColumn::disposing()
}
//------------------------------------------------------------------------------
+namespace
+{
+ template< typename TYPE >
+ void obtain( Any& _out_rValue, ::boost::optional< TYPE > _rCache, const sal_Int32 _nPos, const Reference < XResultSetMetaData >& _rxResultMeta, TYPE (SAL_CALL XResultSetMetaData::*Getter)( sal_Int32 ) )
+ {
+ if ( !_rCache )
+ _rCache.reset( (_rxResultMeta.get()->*Getter)( _nPos ) );
+ _out_rValue <<= *_rCache;
+ }
+}
+
+//------------------------------------------------------------------------------
void OResultColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
try
{
- switch (nHandle)
+ if ( OColumn::isRegisteredProperty( nHandle ) )
{
- case PROPERTY_ID_ISROWVERSION:
- const_cast< OResultColumn* >( this )->impl_determineIsRowVersion_nothrow();
- rValue = m_aIsRowVersion;
- break;
- case PROPERTY_ID_TABLENAME:
- rValue <<= m_xMetaData->getTableName(m_nPos);
- break;
- case PROPERTY_ID_SCHEMANAME:
- rValue <<= m_xMetaData->getSchemaName(m_nPos);
- break;
- case PROPERTY_ID_CATALOGNAME:
- rValue <<= m_xMetaData->getCatalogName(m_nPos);
- break;
- case PROPERTY_ID_ISSIGNED:
- {
- if ( !m_isSigned )
- m_isSigned.reset( m_xMetaData->isSigned(m_nPos));
- rValue <<= *m_isSigned;
- } break;
- case PROPERTY_ID_ISCURRENCY:
- {
- if ( !m_isCurrency )
- m_isCurrency.reset( m_xMetaData->isCurrency(m_nPos));
- rValue <<= *m_isCurrency;
- } break;
- case PROPERTY_ID_ISSEARCHABLE:
- {
- if ( !m_bSearchable )
- m_bSearchable.reset( m_xMetaData->isSearchable(m_nPos));
- rValue <<= *m_bSearchable;
- } break;
- case PROPERTY_ID_ISCASESENSITIVE:
- {
- if ( !m_isCaseSensitive )
- m_isCaseSensitive.reset( m_xMetaData->isCaseSensitive(m_nPos));
- rValue <<= *m_isCaseSensitive;
- } break;
- case PROPERTY_ID_ISREADONLY:
- {
- if ( !m_isReadOnly )
- m_isReadOnly.reset( m_xMetaData->isReadOnly(m_nPos));
- rValue <<= *m_isReadOnly;
- } break;
- case PROPERTY_ID_ISWRITABLE:
- {
- if ( !m_isWritable )
- m_isWritable.reset( m_xMetaData->isWritable(m_nPos));
- rValue <<= *m_isWritable;
- } break;
- case PROPERTY_ID_ISDEFINITELYWRITABLE:
- {
- if ( !m_isDefinitelyWritable )
- m_isDefinitelyWritable.reset( m_xMetaData->isDefinitelyWritable(m_nPos));
- rValue <<= *m_isDefinitelyWritable;
- } break;
- case PROPERTY_ID_ISAUTOINCREMENT:
+ OColumn::getFastPropertyValue( rValue, nHandle );
+ }
+ else
+ {
+ switch (nHandle)
{
- 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:
- if ( !m_sColumnLabel )
- m_sColumnLabel.reset( m_xMetaData->getColumnLabel(m_nPos));
- rValue <<= *m_sColumnLabel;
- break;
- case PROPERTY_ID_DISPLAYSIZE:
- if ( !m_nColumnDisplaySize )
- m_nColumnDisplaySize.reset( m_xMetaData->getColumnDisplaySize(m_nPos));
- rValue <<= *m_nColumnDisplaySize;
- break;
- case PROPERTY_ID_TYPE:
- if ( !m_nColumnType )
- m_nColumnType.reset( m_xMetaData->getColumnType(m_nPos));
- rValue <<= *m_nColumnType;
- break;
- case PROPERTY_ID_PRECISION:
- if ( !m_nPrecision )
- m_nPrecision.reset( m_xMetaData->getPrecision(m_nPos));
- rValue <<= *m_nPrecision;
- break;
- case PROPERTY_ID_SCALE:
- if ( !m_nScale )
- m_nScale.reset( m_xMetaData->getScale(m_nPos));
- rValue <<= *m_nScale;
- break;
- case PROPERTY_ID_ISNULLABLE:
- 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);
- break;
- case PROPERTY_ID_NAME:
- OColumn::getFastPropertyValue( rValue, nHandle );
- break;
+ case PROPERTY_ID_ISROWVERSION:
+ const_cast< OResultColumn* >( this )->impl_determineIsRowVersion_nothrow();
+ rValue = m_aIsRowVersion;
+ break;
+ case PROPERTY_ID_TABLENAME:
+ rValue <<= m_xMetaData->getTableName(m_nPos);
+ break;
+ case PROPERTY_ID_SCHEMANAME:
+ rValue <<= m_xMetaData->getSchemaName(m_nPos);
+ break;
+ case PROPERTY_ID_CATALOGNAME:
+ rValue <<= m_xMetaData->getCatalogName(m_nPos);
+ break;
+ case PROPERTY_ID_ISSIGNED:
+ obtain( rValue, m_isSigned, m_nPos, m_xMetaData, &XResultSetMetaData::isSigned );
+ break;
+ case PROPERTY_ID_ISCURRENCY:
+ obtain( rValue, m_isCurrency, m_nPos, m_xMetaData, &XResultSetMetaData::isCurrency );
+ break;
+ case PROPERTY_ID_ISSEARCHABLE:
+ obtain( rValue, m_bSearchable, m_nPos, m_xMetaData, &XResultSetMetaData::isSearchable );
+ break;
+ case PROPERTY_ID_ISCASESENSITIVE:
+ obtain( rValue, m_isCaseSensitive, m_nPos, m_xMetaData, &XResultSetMetaData::isCaseSensitive );
+ break;
+ case PROPERTY_ID_ISREADONLY:
+ obtain( rValue, m_isReadOnly, m_nPos, m_xMetaData, &XResultSetMetaData::isReadOnly );
+ break;
+ case PROPERTY_ID_ISWRITABLE:
+ obtain( rValue, m_isWritable, m_nPos, m_xMetaData, &XResultSetMetaData::isWritable );
+ break;
+ case PROPERTY_ID_ISDEFINITELYWRITABLE:
+ obtain( rValue, m_isDefinitelyWritable, m_nPos, m_xMetaData, &XResultSetMetaData::isDefinitelyWritable );
+ break;
+ case PROPERTY_ID_ISAUTOINCREMENT:
+ obtain( rValue, m_isAutoIncrement, m_nPos, m_xMetaData, &XResultSetMetaData::isAutoIncrement );
+ break;
+ case PROPERTY_ID_SERVICENAME:
+ rValue <<= m_xMetaData->getColumnServiceName(m_nPos);
+ break;
+ case PROPERTY_ID_LABEL:
+ obtain( rValue, m_sColumnLabel, m_nPos, m_xMetaData, &XResultSetMetaData::getColumnLabel );
+ break;
+ case PROPERTY_ID_DISPLAYSIZE:
+ obtain( rValue, m_nColumnDisplaySize, m_nPos, m_xMetaData, &XResultSetMetaData::getColumnDisplaySize );
+ break;
+ case PROPERTY_ID_TYPE:
+ obtain( rValue, m_nColumnType, m_nPos, m_xMetaData, &XResultSetMetaData::getColumnType );
+ break;
+ case PROPERTY_ID_PRECISION:
+ obtain( rValue, m_nPrecision, m_nPos, m_xMetaData, &XResultSetMetaData::getPrecision );
+ break;
+ case PROPERTY_ID_SCALE:
+ obtain( rValue, m_nScale, m_nPos, m_xMetaData, &XResultSetMetaData::getScale );
+ break;
+ case PROPERTY_ID_ISNULLABLE:
+ obtain( rValue, m_isNullable, m_nPos, m_xMetaData, &XResultSetMetaData::isNullable );
+ break;
+ case PROPERTY_ID_TYPENAME:
+ rValue <<= m_xMetaData->getColumnTypeName(m_nPos);
+ break;
+ default:
+ OSL_ENSURE( false, "OResultColumn::getFastPropertyValue: unknown property handle!" );
+ break;
+ }
}
}
catch (SQLException& )
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index 9d2772a5f3ef..301038903b97 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -182,7 +182,7 @@ OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const
Reference<XPropertySet> xColumnDefintion;
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper(xProp,xColumnDefintion);
+ pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
return pReturn;
}
@@ -468,7 +468,7 @@ Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId()
Reference< XPropertySet > ODBTable::createColumnDescriptor()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" );
- return new OTableColumnDescriptor();
+ return new OTableColumnDescriptor( true );
}
// -----------------------------------------------------------------------------
sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames)
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index 452931848e5c..81ad98dfc97b 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
@@ -280,14 +280,14 @@ OColumn* OComponentDefinition::createColumn(const ::rtl::OUString& _rName) const
if ( aFind != rDefinition.end() )
{
aFind->second->addPropertyChangeListener(::rtl::OUString(),m_xColumnPropertyListener.getRef());
- return new OTableColumnWrapper( aFind->second, aFind->second, sal_True );
+ return new OTableColumnWrapper( aFind->second, aFind->second, true );
}
return new OTableColumn( _rName );
}
// -----------------------------------------------------------------------------
Reference< XPropertySet > OComponentDefinition::createColumnDescriptor()
{
- return new OTableColumnDescriptor();
+ return new OTableColumnDescriptor( true );
}
// -----------------------------------------------------------------------------
void OComponentDefinition::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
@@ -307,7 +307,7 @@ void OComponentDefinition::columnAppended( const Reference< XPropertySet >& _rxS
::rtl::OUString sName;
_rxSourceDescriptor->getPropertyValue( PROPERTY_NAME ) >>= sName;
- Reference<XPropertySet> xColDesc = new OTableColumnDescriptor();
+ Reference<XPropertySet> xColDesc = new OTableColumnDescriptor( true );
::comphelper::copyProperties( _rxSourceDescriptor, xColDesc );
getDefinition().insert( sName, xColDesc );
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index dd5be7a90ced..8b050effc894 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -426,7 +426,7 @@ void ODatabaseModelImpl::impl_construct_nothrow()
Property aProperty(
::rtl::OUString::createFromAscii( pSettings->AsciiName ),
-1,
- ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ),
+ pSettings->ValueType,
PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID
);
xSettingsSet->insert( makeAny( aProperty ) );
@@ -1130,8 +1130,9 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "ParameterNameSubstitution", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AddIndexAppendix", makeAny( (sal_Bool)sal_True ) ),
AsciiPropertyValue( "IgnoreDriverPrivileges", makeAny( (sal_Bool)sal_True ) ),
- AsciiPropertyValue( "ImplicitCatalogRestriction", Any( ) ),
- AsciiPropertyValue( "ImplicitSchemaRestriction", Any( ) ),
+ AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
+ AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
+ AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
// known SDB level settings
AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ),
@@ -1148,7 +1149,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( (sal_Bool)sal_True ) ),
AsciiPropertyValue( "EscapeDateTime", makeAny( (sal_Bool)sal_True ) ),
- AsciiPropertyValue( NULL, Any() )
+ AsciiPropertyValue()
};
return aKnownSettings;
}
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index 5a5de5782c52..dd194829bb51 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -104,13 +104,32 @@ struct AsciiPropertyValue
// note: the canonic member order would be AsciiName / DefaultValue, but
// this crashes on unxlngi6.pro, since there's a bug which somehow results in
// getDefaultDataSourceSettings returning corrupted Any instances then.
- ::com::sun::star::uno::Any DefaultValue;
- const sal_Char* AsciiName;
+ ::com::sun::star::uno::Any DefaultValue;
+ const sal_Char* AsciiName;
+ const ::com::sun::star::uno::Type& ValueType;
+
+ AsciiPropertyValue()
+ :DefaultValue( )
+ ,AsciiName( NULL )
+ ,ValueType( ::cppu::UnoType< ::cppu::UnoVoidType >::get() )
+ {
+ }
AsciiPropertyValue( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rDefaultValue )
:DefaultValue( _rDefaultValue )
,AsciiName( _pAsciiName )
+ ,ValueType( _rDefaultValue.getValueType() )
+ {
+ OSL_ENSURE( ValueType.getTypeClass() != ::com::sun::star::uno::TypeClass_VOID,
+ "AsciiPropertyValue::AsciiPropertyValue: NULL values not allowed here, use the other CTOR for this!" );
+ }
+ AsciiPropertyValue( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Type& _rValeType )
+ :DefaultValue()
+ ,AsciiName( _pAsciiName )
+ ,ValueType( _rValeType )
{
+ OSL_ENSURE( ValueType.getTypeClass() != ::com::sun::star::uno::TypeClass_VOID,
+ "AsciiPropertyValue::AsciiPropertyValue: VOID property values not supported!" );
}
};
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 00dca6ea51c0..f04e39906503 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -61,10 +61,13 @@
#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
@@ -842,8 +845,16 @@ void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const
// -----------------------------------------------------------------------------
Reference< XStorage > ODatabaseDocument::impl_createStorageFor_throw( const ::rtl::OUString& _rURL ) const
{
+ Reference < ::com::sun::star::ucb::XSimpleFileAccess > xTempAccess;
+ m_pImpl->m_aContext.createComponent( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ,xTempAccess);
+ Reference< io::XStream > xStream = xTempAccess->openFileReadWrite( _rURL );
+ Reference< io::XTruncate > xTruncate(xStream,UNO_QUERY);
+ if ( xTruncate.is() )
+ {
+ xTruncate->truncate();
+ }
Sequence<Any> aParam(2);
- aParam[0] <<= _rURL;
+ aParam[0] <<= xStream;
aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE;
Reference< XSingleServiceFactory > xStorageFactory( m_pImpl->createStorageFactory(), UNO_SET_THROW );
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index 01a3b65b5c8a..e293e9693e51 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -727,23 +727,16 @@ void ODefinitionContainer::addObjectListener(const Reference< XContent >& _xNewO
{
xProp->addPropertyChangeListener(PROPERTY_NAME, this);
xProp->addVetoableChangeListener(PROPERTY_NAME, this);
- //::rtl::OUString sTitle(RTL_CONSTASCII_USTRINGPARAM( "Title" ));
- //xProp->addPropertyChangeListener(sTitle, this);
- //xProp->addVetoableChangeListener(sTitle, this);
- } // if ( xProp.is() )
+ }
}
// -----------------------------------------------------------------------------
void ODefinitionContainer::removeObjectListener(const Reference< XContent >& _xNewObject)
{
- OSL_ENSURE(_xNewObject.is(),"ODefinitionContainer::addObjectListener: Object is null!");
Reference<XPropertySet> xProp(_xNewObject,UNO_QUERY);
if ( xProp.is() )
{
xProp->removePropertyChangeListener(PROPERTY_NAME, this);
xProp->removeVetoableChangeListener(PROPERTY_NAME, this);
- //::rtl::OUString sTitle(RTL_CONSTASCII_USTRINGPARAM( "Title" ));
- //xProp->removePropertyChangeListener(sTitle, this);
- //xProp->removeVetoableChangeListener(sTitle, this);
}
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/inc/column.hxx b/dbaccess/source/core/inc/column.hxx
index bd1f2665da3a..b35ecebb3066 100644
--- a/dbaccess/source/core/inc/column.hxx
+++ b/dbaccess/source/core/inc/column.hxx
@@ -31,92 +31,40 @@
#ifndef _DBA_COREAPI_COLUMN_HXX_
#define _DBA_COREAPI_COLUMN_HXX_
-#include <hash_map>
+#include "columnsettings.hxx"
-#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
-#include <com/sun/star/container/XNamed.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_WRAPPEDTARGETEXCEPTION_HPP_
-#include <com/sun/star/lang/WrappedTargetException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
+#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
-#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_IOEXCEPTION_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/io/IOException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
-#include <com/sun/star/io/XObjectOutputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectInputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbcx/XAppend.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
#include <com/sun/star/sdbcx/XDrop.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#endif
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
-#ifndef _CPPUHELPER_COMPBASE3_HXX_
-#include <cppuhelper/compbase3.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE1_HXX_
-#include <cppuhelper/implbase1.hxx>
-#endif
-#ifndef _CPPUHELPER_COMPBASE4_HXX_
-#include <cppuhelper/compbase4.hxx>
-#endif
-#ifndef _CPPUHELPER_PROPSHLP_HXX
-#include <cppuhelper/propshlp.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+#include <comphelper/broadcasthelper.hxx>
#include <comphelper/proparrhlp.hxx>
-#endif
-#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/stl_types.hxx>
#include <connectivity/CommonTools.hxx>
-#endif
-#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
-#include <comphelper/broadcasthelper.hxx>
-#endif
-#ifndef CONNECTIVITY_COLUMNSHELPER_HXX
-#include <connectivity/TColumnsHelper.hxx>
-#endif
-#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
#include <connectivity/FValue.hxx>
-#endif
-#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+#include <connectivity/TColumnsHelper.hxx>
#include <connectivity/sdbcx/IRefreshable.hxx>
-#endif
-#ifndef _COMPHELPER_STLTYPES_HXX_
-#include <comphelper/stl_types.hxx>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
-#include <com/sun/star/container/XChild.hpp>
-#endif
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <osl/diagnose.h>
+
+#include <hash_map>
namespace dbaccess
{
@@ -131,16 +79,18 @@ namespace dbaccess
//------------------------------------------------------------
class OColumn :public comphelper::OBaseMutex
,public OColumnBase
- ,public ::cppu::OPropertySetHelper
-
+ ,public ::comphelper::OPropertyContainer
+ ,public IPropertyContainer // convenience for the derived class which also derive from OColumnSettings
{
friend class OColumns;
protected:
+ // <properties>
::rtl::OUString m_sName;
+ // </properties>
protected:
- OColumn();
+ OColumn( const bool _bNameIsReadOnly );
public:
virtual ~OColumn();
@@ -157,23 +107,6 @@ namespace dbaccess
// com::sun::star::beans::XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // ::cppu::OPropertySetHelper
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
-
// com::sun::star::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
@@ -190,57 +123,13 @@ namespace dbaccess
virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setName( const ::rtl::OUString& _rName ) throw(::com::sun::star::uno::RuntimeException);
- virtual void fireValueChange(const ::connectivity::ORowSetValue& _rOldValue);
+ virtual void fireValueChange( const ::connectivity::ORowSetValue& _rOldValue );
protected:
- using ::cppu::OPropertySetHelper::getFastPropertyValue;
- };
-
- //************************************************************
- // OColumnSettings
- //************************************************************
- class OColumnSettings
- {
- // <properties>
- ::com::sun::star::uno::Any m_aWidth; // sal_Int32 or void
- ::com::sun::star::uno::Any m_aFormatKey; // sal_Int32 or void
- ::com::sun::star::uno::Any m_aRelativePosition; // sal_Int32 or void
- ::com::sun::star::uno::Any m_aAlignment; // sal_Int32 (::com::sun::star::awt::TextAlign) or void
- ::com::sun::star::uno::Any m_aHelpText; // the description of the column which is visible in the helptext of the column
- ::com::sun::star::uno::Any m_aControlDefault; // the default value which should be displayed as by a control when moving to a new row
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
- m_xControlModel;
-
- sal_Bool m_bHidden;
- // </properties>
-
- // Setting of values
- public:
- OColumnSettings();
- virtual ~OColumnSettings();
-
- sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
- void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
-
- // com::sun::star::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
-
- public:
-
- /** check if the persistent settings have their default value
- */
- sal_Bool isDefaulted() const;
+ // IPropertyContainer
+ virtual void registerProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void* _pPointerToMember, const ::com::sun::star::uno::Type& _rMemberType );
+ virtual void registerMayBeVoidProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, ::com::sun::star::uno::Any* _pPointerToMember, const ::com::sun::star::uno::Type& _rExpectedType );
+ virtual void registerPropertyNoMember( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const ::com::sun::star::uno::Type& _rType, const void* _pInitialValue );
};
//============================================================
diff --git a/dbaccess/source/core/inc/columnsettings.hxx b/dbaccess/source/core/inc/columnsettings.hxx
new file mode 100644
index 000000000000..a6abc3642f2a
--- /dev/null
+++ b/dbaccess/source/core/inc/columnsettings.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+* 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 COLUMNSETTINGS_HXX
+#define COLUMNSETTINGS_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+/** === end UNO includes === **/
+
+//........................................................................
+namespace dbaccess
+{
+//........................................................................
+
+ // TODO: move the following to comphelper/propertycontainerhelper.hxx
+ class IPropertyContainer
+ {
+ public:
+ virtual void registerProperty(
+ const ::rtl::OUString& _rName,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes,
+ void* _pPointerToMember,
+ const ::com::sun::star::uno::Type& _rMemberType
+ ) = 0;
+
+ virtual void registerMayBeVoidProperty(
+ const ::rtl::OUString& _rName,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes,
+ ::com::sun::star::uno::Any* _pPointerToMember,
+ const ::com::sun::star::uno::Type& _rExpectedType
+ ) = 0;
+
+ virtual void registerPropertyNoMember(
+ const ::rtl::OUString& _rName,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes,
+ const ::com::sun::star::uno::Type& _rType,
+ const void* _pInitialValue
+ ) = 0;
+ };
+
+ //====================================================================
+ //= OColumnSettings
+ //====================================================================
+ class OColumnSettings
+ {
+ // <properties>
+ ::com::sun::star::uno::Any m_aWidth; // sal_Int32 or void
+ ::com::sun::star::uno::Any m_aFormatKey; // sal_Int32 or void
+ ::com::sun::star::uno::Any m_aRelativePosition; // sal_Int32 or void
+ ::com::sun::star::uno::Any m_aAlignment; // sal_Int32 (::com::sun::star::awt::TextAlign) or void
+ ::com::sun::star::uno::Any m_aHelpText; // the description of the column which is visible in the helptext of the column
+ ::com::sun::star::uno::Any m_aControlDefault; // the default value which should be displayed as by a control when moving to a new row
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xControlModel;
+ sal_Bool m_bHidden;
+ // </properties>
+
+ protected:
+ virtual ~OColumnSettings();
+
+ public:
+ OColumnSettings();
+
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ protected:
+ void registerProperties( IPropertyContainer& _rPropertyContainer );
+
+ /** determines whether the property with the given handle is handled by the class
+ */
+ bool isMine( const sal_Int32 _nPropertyHandle ) const;
+
+ public:
+ /** check if the persistent settings have their default value
+ */
+ sal_Bool isDefaulted() const;
+ };
+
+//........................................................................
+} // namespace dbaccess
+//........................................................................
+
+#endif // COLUMNSETTINGS_HXX
diff --git a/dbaccess/source/core/inc/datasettings.hxx b/dbaccess/source/core/inc/datasettings.hxx
index be4b137f4977..993881c4e9f6 100644
--- a/dbaccess/source/core/inc/datasettings.hxx
+++ b/dbaccess/source/core/inc/datasettings.hxx
@@ -81,6 +81,7 @@ public:
protected:
ODataSettings_Base();
ODataSettings_Base(const ODataSettings_Base& _rSource);
+ ~ODataSettings_Base();
};
//==========================================================================
//= ODataSettings - a base class which implements the property handling
diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx
index 5d9a3a7ae3b2..85800355ddfa 100644
--- a/dbaccess/source/core/inc/definitioncolumn.hxx
+++ b/dbaccess/source/core/inc/definitioncolumn.hxx
@@ -30,30 +30,17 @@
#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_
#define _DBACORE_DEFINITIONCOLUMN_HXX_
-#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include "apitools.hxx"
+#include "column.hxx"
+#include "columnsettings.hxx"
+
#include <com/sun/star/sdbc/DataType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
#include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _DBA_COREAPI_COLUMN_HXX_
-#include "column.hxx"
-#endif
-#ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+
#include <comphelper/IdPropArrayHelper.hxx>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
-#endif
namespace dbaccess
@@ -79,24 +66,31 @@ namespace dbaccess
sal_Int32 m_nPrecision;
sal_Int32 m_nScale;
sal_Int32 m_nIsNullable;
- sal_Bool m_bAutoIncrement : 1;
- sal_Bool m_bRowVersion : 1;
- sal_Bool m_bCurrency : 1;
+ sal_Bool m_bAutoIncrement;
+ sal_Bool m_bRowVersion;
+ sal_Bool m_bCurrency;
// </properties>
+
public:
- OTableColumnDescriptor():m_nType(::com::sun::star::sdbc::DataType::SQLNULL)
- ,m_nPrecision(0)
- ,m_nScale(0)
- ,m_nIsNullable(::com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN)
- ,m_bAutoIncrement(sal_False)
- ,m_bRowVersion(sal_False)
- ,m_bCurrency(sal_False){}
+ OTableColumnDescriptor( const bool _bActAsDescriptor )
+ :OColumn( !_bActAsDescriptor )
+ ,m_nType( ::com::sun::star::sdbc::DataType::SQLNULL )
+ ,m_nPrecision( 0 )
+ ,m_nScale( 0 )
+ ,m_nIsNullable( ::com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN )
+ ,m_bAutoIncrement( sal_False )
+ ,m_bRowVersion( sal_False )
+ ,m_bCurrency( sal_False )
+ {
+ impl_registerProperties( _bActAsDescriptor );
+ }
DECLARE_XINTERFACE( )
- // com::sun::star::lang::XTypeProvider
+
+ // com::sun::star::lang::XTypeProvider
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::lang::XServiceInfo
+ // ::com::sun::star::lang::XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
@@ -104,41 +98,28 @@ namespace dbaccess
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
- // ::comphelper::OPropertyArrayUsageHelper
+ // ::comphelper::OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
- // ::cppu::OPropertySetHelper
+ // ::cppu::OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
protected:
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ void impl_registerProperties( const bool _bActAsDescriptor );
+
protected:
using OColumn::getFastPropertyValue;
};
- /**
- * describes a column of an existing table. The informations for the column are
- * retrieved in a generic way using the meta data of a connection.
+ /** describes a column of a table or query
*/
- class OTableColumn : public OTableColumnDescriptor,
- public ::comphelper::OPropertyArrayUsageHelper < OTableColumn >
+ class OTableColumn :public OTableColumnDescriptor
+ ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumn >
{
friend class ODBTable;
@@ -164,7 +145,7 @@ namespace dbaccess
* describes all properties for a columns of a table. Only the view parts are provided
* directly, all the other parts are derived from a driver implementation
*/
- class OColumnWrapper : public OColumn
+ class OColumnWrapper :public OColumn
{
protected:
// definition which is provided by a driver!
@@ -174,7 +155,7 @@ namespace dbaccess
sal_Int32 m_nColTypeID;
protected:
- OColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol);
+ OColumnWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rCol, const bool _bNameIsReadOnly );
virtual ~OColumnWrapper();
public:
@@ -195,8 +176,9 @@ namespace dbaccess
throw (::com::sun::star::uno::Exception);
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
- // Helper
-// sal_Int32 getColumnTypeID() const {return m_nColTypeID;}
+
+ protected:
+ ::rtl::OUString impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const;
protected:
using OColumn::getFastPropertyValue;
@@ -205,14 +187,16 @@ namespace dbaccess
/**
* provides the properties for description. A descriptor could be used to create a new table column.
*/
- class OTableColumnDescriptorWrapper : public OColumnWrapper,
- public OColumnSettings,
- public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
+ class OTableColumnDescriptorWrapper :public OColumnWrapper
+ ,public OColumnSettings
+ ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
{
- sal_Bool m_bPureWrap;
+ const bool m_bPureWrap;
+ const bool m_bIsDescriptor;
+
public:
- OTableColumnDescriptorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,sal_Bool _bPureWrap = sal_False)
- :OColumnWrapper(rCol),m_bPureWrap(_bPureWrap){}
+ OTableColumnDescriptorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,
+ const bool _bPureWrap, const bool _bIsDescriptor );
// com::sun::star::lang::XTypeProvider
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
@@ -254,15 +238,16 @@ namespace dbaccess
* describes all properties for a columns of a table. Only the view parts are provided
* directly, all the other parts are derived from a driver implementation
*/
- class OTableColumnWrapper : public OTableColumnDescriptorWrapper,
- public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
+ class OTableColumnWrapper :public OTableColumnDescriptorWrapper
+ ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
{
protected:
~OTableColumnWrapper();
+
public:
- OTableColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rColDefintion
- ,sal_Bool _bPureWrap = sal_False);
+ OTableColumnWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rColDefintion,
+ const bool _bPureWrap );
// ::com::sun::star::lang::XTypeProvider
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
@@ -275,76 +260,6 @@ namespace dbaccess
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
};
-
- /**
- * describes all properties for a columns of an index.
- */
- class OIndexColumnWrapper : public OColumnWrapper,
- public ::comphelper::OPropertyArrayUsageHelper < OIndexColumnWrapper >
- {
- protected:
- // <properties>
- sal_Bool m_bAscending;
- // </properties>
-
- public:
- OIndexColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol )
- :OColumnWrapper(rCol) {}
-
- // com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
-
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
-
- protected:
- using OColumnWrapper::getFastPropertyValue;
- };
-
- /**
- * describes all properties for a columns of an key column.
- */
- class OKeyColumnWrapper : public OColumnWrapper,
- public ::comphelper::OPropertyArrayUsageHelper < OKeyColumnWrapper >
- {
- protected:
- // <properties>
- rtl::OUString m_aRelatedColumn;
- // </properties>
-
- public:
- OKeyColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol)
- :OColumnWrapper(rCol) {}
-
- // com::sun::star::lang::XTypeProvider
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
-
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
-
- protected:
- using OColumnWrapper::getFastPropertyValue;
- };
}
#endif // _DBACORE_DEFINITIONCOLUMN_HXX_
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index cd16eb68a5ee..b6aff3db3240 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -584,7 +584,8 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
{
xChartData->setData(uno::Sequence< uno::Sequence<double> >());
xChartData->setColumnDescriptions(uno::Sequence< ::rtl::OUString >());
- m_xInternal->deleteSequence(0);
+ if ( m_xInternal->hasDataByRangeRepresentation(::rtl::OUString::valueOf(sal_Int32(0))) )
+ m_xInternal->deleteSequence(0);
}
uno::Sequence< ::rtl::OUString > aColumns;
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index ddfb583f65c9..f82839664973 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -32,187 +32,72 @@
#include "precompiled_dbaccess.hxx"
-#ifndef _SBA_BWRCTRLR_HXX
+
+#include "browserids.hxx"
#include "brwctrlr.hxx"
-#endif
-#ifndef _SBX_BRWVIEW_HXX
#include "brwview.hxx"
-#endif
-#ifndef _OSL_MUTEX_HXX_ //autogen wg. MutexGuard
-#include <osl/mutex.hxx>
-#endif
-#ifndef _SFXAPP_HXX //autogen wg. SFX_APP
-#include <sfx2/app.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UNO_TYPECLASS_HPP_
-#include <com/sun/star/uno/TypeClass.hpp>
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
+#include "dbu_brw.hrc"
+#include "dbustrings.hrc"
+#include "queryfilter.hxx"
+#include "queryorder.hxx"
#include "sqlmessage.hxx"
-#endif
-#ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
-#include <com/sun/star/form/XFormController.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
-#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROWSETLISTENER_HPP_
-#include <com/sun/star/sdbc/XRowSetListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
-#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
-#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XSQLERRORBROADCASTER_HPP_
-#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
-#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
-#include <com/sun/star/form/XLoadable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
-#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+
+/** === begin UNO includes === **/
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/form/FormButtonType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XCHANGELISTENER_HPP_
-#include <com/sun/star/form/XChangeListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_FORMSUBMITENCODING_HPP_
#include <com/sun/star/form/FormSubmitEncoding.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_FORMSUBMITMETHOD_HPP_
#include <com/sun/star/form/FormSubmitMethod.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XSUBMITLISTENER_HPP_
-#include <com/sun/star/form/XSubmitListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XRESET_HPP_
-#include <com/sun/star/form/XReset.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XSUBMIT_HPP_
-#include <com/sun/star/form/XSubmit.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XAPPROVEACTIONBROADCASTER_HPP_
#include <com/sun/star/form/XApproveActionBroadcaster.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XCHANGEBROADCASTER_HPP_
+#include <com/sun/star/form/XBoundControl.hpp>
#include <com/sun/star/form/XChangeBroadcaster.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XRESETLISTENER_HPP_
-#include <com/sun/star/form/XResetListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
-#include <com/sun/star/util/XCancellable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XDATABASEPARAMETERBROADCASTER_HPP_
+#include <com/sun/star/form/XChangeListener.hpp>
#include <com/sun/star/form/XDatabaseParameterBroadcaster.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XBOUNDCONTROL_HPP_
-#include <com/sun/star/form/XBoundControl.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
-#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
-#include <com/sun/star/container/XNamed.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/form/XResetListener.hpp>
+#include <com/sun/star/form/XSubmit.hpp>
+#include <com/sun/star/form/XSubmitListener.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/ErrorCondition.hpp>
+#include <com/sun/star/sdb/ParametersRequest.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
+#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
-#include <cppuhelper/exc_hlp.hxx>
-#endif
-#ifndef _SV_MSGBOX_HXX //autogen
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef _FMSEARCH_HXX
-#include <svx/fmsearch.hxx>
-#endif
-#ifndef _SV_WAITOBJ_HXX
-#include <vcl/waitobj.hxx>
-#endif
-#ifndef _TOOLS_COLOR_HXX
-#include <tools/color.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-#include <cppuhelper/implbase2.hxx>
-#endif
-#ifndef _DBU_BRW_HRC_
-#include "dbu_brw.hrc"
-#endif
-#ifndef _SFX_HRC
-#include <sfx2/sfx.hrc>
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
-#include "browserids.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
-#include "dbustrings.hrc"
-#endif
-#ifndef _COMPHELPER_INTERACTION_HXX_
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
#include <comphelper/interaction.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <comphelper/sequence.hxx>
#include <connectivity/dbexception.hxx>
-#endif
-#ifndef CONNECTIVITY_SQLERROR_HXX
+#include <connectivity/dbtools.hxx>
#include <connectivity/sqlerror.hxx>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
-#include <comphelper/extract.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XINTERACTIONSUPPLYPARAMETERS_HPP_
-#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_
-#include <com/sun/star/sdb/ParametersRequest.hpp>
-#endif
-#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#endif
-#ifndef INCLUDED_COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#endif
-#ifndef INCLUDED_COM_SUN_STAR_SDB_ERRORCONDITION_HPP
-#include <com/sun/star/sdb/ErrorCondition.hpp>
-#endif
-#ifndef DBAUI_QUERYFILTER_HXX
-#include "queryfilter.hxx"
-#endif
-#ifndef DBAUI_QUERYORDER_HXX
-#include "queryorder.hxx"
-#endif
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/mutex.hxx>
#include <rtl/logfile.hxx>
-
-#include <svx/svxdlg.hxx> //CHINA001
-//#include <svx/fmresids.hrc> //CHINA001
+#include <sfx2/app.hxx>
+#include <sfx2/sfx.hrc>
+#include <svx/fmsearch.hxx>
+#include <svx/svxdlg.hxx>
+#include <tools/color.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
+#include <vcl/waitobj.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
@@ -280,12 +165,12 @@ void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyVal
//==============================================================================
-// a helper class implementing a ::com::sun::star::form::XFormController, will be aggregated by SbaXDataBrowserController
-// (we can't derive from ::com::sun::star::form::XFormController as it's base class is ::com::sun::star::awt::XTabController and the ::com::sun::star::awt::XTabController::getModel collides
-// with the ::com::sun::star::frame::XController::getModel implemented in our base class SbaXDataBrowserController)
+// a helper class implementing a runtime::XFormController, will be aggregated by SbaXDataBrowserController
+// (we can't derive from XFormController as it's base class is XTabController and the XTabController::getModel collides
+// with the XController::getModel implemented in our base class SbaXDataBrowserController)
class SbaXDataBrowserController::FormControllerImpl
- : public ::cppu::WeakAggImplHelper2< ::com::sun::star::form::XFormController,
- ::com::sun::star::frame::XFrameActionListener>
+ : public ::cppu::WeakAggImplHelper2< ::com::sun::star::form::runtime::XFormController,
+ ::com::sun::star::frame::XFrameActionListener >
{
friend class SbaXDataBrowserController;
::cppu::OInterfaceContainerHelper m_aActivateListeners;
@@ -294,12 +179,68 @@ class SbaXDataBrowserController::FormControllerImpl
public:
FormControllerImpl(SbaXDataBrowserController* pOwner);
- // ::com::sun::star::form::XFormController
+ // XFormController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > SAL_CALL getFormOperations() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getCurrentControl(void) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener > & l) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener > & l) throw( ::com::sun::star::uno::RuntimeException );
-
- // ::com::sun::star::awt::XTabController
+ virtual void SAL_CALL addChildController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _ChildController ) throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext >& _context ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _interactionHandler ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChild, base of XFormController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ // XComponent, base of XFormController
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess, base of XFormController
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess, base of XIndexAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess, base of XElementAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifyBroadcaster, base of XFormController
+ virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XConfirmDeleteBroadcaster, base of XFormController
+ virtual void SAL_CALL addConfirmDeleteListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeConfirmDeleteListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSQLErrorBroadcaster, base of XFormController
+ virtual void SAL_CALL addSQLErrorListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSQLErrorListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XRowSetApproveBroadcaster, base of XFormController
+ virtual void SAL_CALL addRowSetApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRowSetApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDatabaseParameterBroadcaster2, base of XFormController
+ virtual void SAL_CALL addDatabaseParameterListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeDatabaseParameterListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDatabaseParameterBroadcaster, base of XDatabaseParameterBroadcaster2
+ virtual void SAL_CALL addParameterListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeParameterListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModeSelector, base of XFormController
+ virtual void SAL_CALL setMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getMode( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTabController, base of XFormController
virtual void SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > & Model) throw( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > & _Container) throw( ::com::sun::star::uno::RuntimeException );
@@ -310,10 +251,10 @@ public:
virtual void SAL_CALL activateFirst(void) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL activateLast(void) throw( ::com::sun::star::uno::RuntimeException );
- // ::com::sun::star::frame::XFrameActionListener
+ // XFrameActionListener
virtual void SAL_CALL frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
- // ::com::sun::star::lang::XEventListener
+ // XEventListener
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
protected:
@@ -340,6 +281,13 @@ SbaXDataBrowserController::FormControllerImpl::~FormControllerImpl()
}
//------------------------------------------------------------------
+Reference< runtime::XFormOperations > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getFormOperations() throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::getFormOperations: not supported!" );
+ return NULL;
+}
+
+//------------------------------------------------------------------
Reference< ::com::sun::star::awt::XControl > SbaXDataBrowserController::FormControllerImpl::getCurrentControl(void) throw( RuntimeException )
{
return m_pOwner->getBrowserView() ? m_pOwner->getBrowserView()->getGridControl() : Reference< ::com::sun::star::awt::XControl > ();
@@ -358,6 +306,202 @@ void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeActivateListe
}
//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addChildController( const Reference< runtime::XFormController >& /*_ChildController*/ ) throw( RuntimeException, IllegalArgumentException )
+{
+ // not supported
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+}
+
+//------------------------------------------------------------------
+Reference< runtime::XFormControllerContext > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getContext() throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::getContext: no support!!" );
+ return NULL;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setContext( const Reference< runtime::XFormControllerContext >& /*_context*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::setContext: no support!!" );
+}
+
+//------------------------------------------------------------------
+Reference< XInteractionHandler > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getInteractionHandler() throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::getInteractionHandler: no support!!" );
+ return NULL;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setInteractionHandler( const Reference< XInteractionHandler >& /*_interactionHandler*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::setInteractionHandler: no support!!" );
+}
+
+//------------------------------------------------------------------
+Reference< XInterface > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getParent( ) throw (RuntimeException)
+{
+ // don't have any parent form controllers
+ return NULL;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setParent( const Reference< XInterface >& /*Parent*/ ) throw (NoSupportException, RuntimeException)
+{
+ throw NoSupportException( ::rtl::OUString(), *this );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::dispose( ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::dispose: no, you do *not* want to do this!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addEventListener( const Reference< XEventListener >& /*xListener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addEventListener: no support!!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeEventListener( const Reference< XEventListener >& /*aListener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeEventListener: no support!!" );
+}
+
+//------------------------------------------------------------------
+::sal_Int32 SAL_CALL SbaXDataBrowserController::FormControllerImpl::getCount( ) throw (RuntimeException)
+{
+ // no sub controllers, never
+ return 0;
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL SbaXDataBrowserController::FormControllerImpl::getByIndex( ::sal_Int32 /*Index*/ ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ // no sub controllers, never
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+}
+
+//------------------------------------------------------------------
+Type SAL_CALL SbaXDataBrowserController::FormControllerImpl::getElementType( ) throw (RuntimeException)
+{
+ return ::cppu::UnoType< runtime::XFormController >::get();
+}
+
+//------------------------------------------------------------------
+::sal_Bool SAL_CALL SbaXDataBrowserController::FormControllerImpl::hasElements( ) throw (RuntimeException)
+{
+ // no sub controllers, never
+ return false;
+}
+
+//------------------------------------------------------------------
+Reference< XEnumeration > SAL_CALL SbaXDataBrowserController::FormControllerImpl::createEnumeration( ) throw (RuntimeException)
+{
+ return new ::comphelper::OEnumerationByIndex( this );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addModifyListener( const Reference< XModifyListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addModifyListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeModifyListener( const Reference< XModifyListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeModifyListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener( const Reference< XConfirmDeleteListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addConfirmDeleteListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener( const Reference< XConfirmDeleteListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeConfirmDeleteListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener( const Reference< XSQLErrorListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addSQLErrorListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener( const Reference< XSQLErrorListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeSQLErrorListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener( const Reference< XRowSetApproveListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addRowSetApproveListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeRowSetApproveListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addDatabaseParameterListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeDatabaseParameterListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::addParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::addParameterListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::removeParameterListener( const Reference< XDatabaseParameterListener >& /*_Listener*/ ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SbaXDataBrowserController::FormControllerImpl::removeParameterListener: no support!" );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setMode( const ::rtl::OUString& _rMode ) throw (NoSupportException, RuntimeException)
+{
+ if ( !supportsMode( _rMode ) )
+ throw NoSupportException();
+}
+
+//------------------------------------------------------------------
+::rtl::OUString SAL_CALL SbaXDataBrowserController::FormControllerImpl::getMode( ) throw (RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
+}
+
+//------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL SbaXDataBrowserController::FormControllerImpl::getSupportedModes( ) throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aModes(1);
+ aModes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
+ return aModes;
+}
+
+//------------------------------------------------------------------
+::sal_Bool SAL_CALL SbaXDataBrowserController::FormControllerImpl::supportsMode( const ::rtl::OUString& aMode ) throw (RuntimeException)
+{
+ return aMode.compareToAscii( "DataMode" ) == 0;
+}
+
+//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController::FormControllerImpl::setModel(const Reference< ::com::sun::star::awt::XTabControllerModel > & /*Model*/) throw( RuntimeException )
{
OSL_ENSURE(sal_False, "SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model !");
@@ -465,19 +609,12 @@ Sequence< sal_Int8 > SAL_CALL SbaXDataBrowserController::getImplementationId( )
//------------------------------------------------------------------
Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) throw (RuntimeException)
{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::queryInterface" );
// check for our additional interfaces
Any aRet = SbaXDataBrowserController_Base::queryInterface(_rType);
- // check for the base controllers interfaces
+ // check for our aggregate (implementing the XFormController)
if (!aRet.hasValue())
- {
- // check for our aggregate (implementing the XFormController)
- if (!aRet.hasValue())
- {
- aRet = m_xFormControllerImpl->queryAggregation(_rType);
- }
- }
+ aRet = m_xFormControllerImpl->queryAggregation(_rType);
// no more to offer
return aRet;
@@ -1206,16 +1343,6 @@ sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( Runtim
// -----------------------------------------------------------------------
void SbaXDataBrowserController::disposing()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::disposing" );
- // and dispose the aggregate
- if (m_xFormControllerImpl.is())
- {
- Reference< XComponent > xAggComp;
- m_xFormControllerImpl->queryAggregation(::getCppuType(&xAggComp)) >>= xAggComp;
- if (xAggComp.is())
- xAggComp->dispose();
- }
-
// the base class
SbaXDataBrowserController_Base::OGenericUnoController::disposing();
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 01475f549a14..da1b0968f2e9 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -43,9 +43,6 @@
#ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
#include <com/sun/star/form/XGridColumnFactory.hpp>
#endif
-#ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
-#include <com/sun/star/form/XFormController.hpp>
-#endif
#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
#include <com/sun/star/form/XLoadable.hpp>
#endif
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 4d9e81bc1f83..8c7f94a2ac39 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -1667,8 +1667,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
::rtl::OUString sDefault;
if (pDefault)
{
- if ( pDefault->GetSavedValue() != pDefault->GetText() )
- sDefault = pDefault->GetText();
+ sDefault = pDefault->GetText();
}
else if (pBoolDefault)
{
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 28a9b83fca35..dd7e736240ec 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -34,93 +34,41 @@
#include "DbAdminImpl.hxx"
#include "dsmeta.hxx"
-#ifndef _SFXPOOLITEM_HXX
-#include <svtools/poolitem.hxx>
-#endif
-#ifndef _SFXITEMPOOL_HXX
-#include <svtools/itempool.hxx>
-#endif
-#ifndef _SFXSTRITEM_HXX
-#include <svtools/stritem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _SVTOOLS_LOGINDLG_HXX_
-#include <svtools/logindlg.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#include <connectivity/DriversConfig.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
-#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_
-#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_
-#include <com/sun/star/sdbc/XDriver.hpp>
-#endif
-#ifndef DBAUI_DRIVERSETTINGS_HXX
#include "DriverSettings.hxx"
-#endif
-#ifndef _DBAUI_PROPERTYSETITEM_HXX_
-#include "propertysetitem.hxx"
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef DBAUI_ITEMSETHELPER_HXX
#include "IItemSetHelper.hxx"
-#endif
-#ifndef _DBU_DLG_HRC_
+#include "UITools.hxx"
#include "dbu_dlg.hrc"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef _VCL_STDTEXT_HXX
-#include <vcl/stdtext.hxx>
-#endif
-#ifndef _SV_MSGBOX_HXX
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef _SV_WAITOBJ_HXX
-#include <vcl/waitobj.hxx>
-#endif
-#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_
-#include <typelib/typedescription.hxx>
-#endif
-
-#ifndef _OSL_FILE_HXX_
-#include <osl/file.hxx>
-#endif
-#ifndef _DBAUI_STRINGLISTITEM_HXX_
-#include "stringlistitem.hxx"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
+#include "dsitems.hxx"
+#include "dsnItem.hxx"
#include "moduledbu.hxx"
-#endif
-#ifndef DBAUI_TOOLS_HXX
-#include "UITools.hxx"
-#endif
-#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
+#include "optionalboolitem.hxx"
+#include "propertysetitem.hxx"
+#include "stringlistitem.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#endif
-#include "dsnItem.hxx"
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbc/XDriverAccess.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#include <connectivity/DriversConfig.hxx>
+#include <connectivity/dbexception.hxx>
+#include <osl/file.hxx>
+#include <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <svtools/itempool.hxx>
+#include <svtools/logindlg.hxx>
+#include <svtools/poolitem.hxx>
+#include <svtools/stritem.hxx>
+#include <typelib/typedescription.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/stdtext.hxx>
+#include <vcl/waitobj.hxx>
#include <algorithm>
#include <functional>
@@ -231,6 +179,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_AS_BEFORE_CORRNAME, INFO_AS_BEFORE_CORRELATION_NAME ) );
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CHECK_REQUIRED_FIELDS, INFO_FORMS_CHECK_REQUIRED_FIELDS ) );
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_ESCAPE_DATETIME, INFO_ESCAPE_DATETIME ) );
+ m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_PRIMARY_KEY_SUPPORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrimaryKeySupport" ) ) ) );
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_PARAMETERNAMESUBST, INFO_PARAMETERNAMESUBST));
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_IGNOREDRIVER_PRIV, INFO_IGNOREDRIVER_PRIV));
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_BOOLEANCOMPARISON, PROPERTY_BOOLEANCOMPARISONMODE));
@@ -909,14 +858,36 @@ Any ODbDataSourceAdministrationHelper::implTranslateProperty(const SfxPoolItem*
{
// translate the SfxPoolItem
Any aValue;
- if (_pItem->ISA(SfxStringItem))
- aValue <<= ::rtl::OUString(PTR_CAST(SfxStringItem, _pItem)->GetValue().GetBuffer());
- else if (_pItem->ISA(SfxBoolItem))
- aValue <<= PTR_CAST(SfxBoolItem, _pItem)->GetValue();
- else if (_pItem->ISA(SfxInt32Item))
- aValue <<= PTR_CAST(SfxInt32Item, _pItem)->GetValue();
- else if (_pItem->ISA(OStringListItem))
- aValue <<= PTR_CAST(OStringListItem, _pItem)->getList();
+
+ const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, _pItem );
+ const SfxBoolItem* pBoolItem = PTR_CAST( SfxBoolItem, _pItem );
+ const OptionalBoolItem* pOptBoolItem = PTR_CAST( OptionalBoolItem, _pItem );
+ const SfxInt32Item* pInt32Item = PTR_CAST( SfxInt32Item, _pItem );
+ const OStringListItem* pStringListItem = PTR_CAST( OStringListItem, _pItem );
+
+ if ( pStringItem )
+ {
+ aValue <<= ::rtl::OUString( pStringItem->GetValue().GetBuffer() );
+ }
+ else if ( pBoolItem )
+ {
+ aValue <<= pBoolItem->GetValue();
+ }
+ else if ( pOptBoolItem )
+ {
+ if ( !pOptBoolItem->HasValue() )
+ aValue.clear();
+ else
+ aValue <<= (sal_Bool)pOptBoolItem->GetValue();
+ }
+ else if ( pInt32Item )
+ {
+ aValue <<= pInt32Item->GetValue();
+ }
+ else if ( pStringListItem )
+ {
+ aValue <<= pStringListItem->getList();
+ }
else
{
DBG_ERROR("ODbDataSourceAdministrationHelper::implTranslateProperty: unsupported item type!");
@@ -957,15 +928,14 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty(const Reference< X
//-------------------------------------------------------------------------
void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue )
{
- USHORT nId = (USHORT)_nId;
- switch (_rValue.getValueType().getTypeClass())
+ switch ( _rValue.getValueType().getTypeClass() )
{
case TypeClass_STRING:
- if ( implCheckItemType( _rSet, nId, SfxStringItem::StaticType() ) )
+ if ( implCheckItemType( _rSet, _nId, SfxStringItem::StaticType() ) )
{
::rtl::OUString sValue;
_rValue >>= sValue;
- _rSet.Put(SfxStringItem(nId, sValue.getStr()));
+ _rSet.Put(SfxStringItem(_nId, sValue.getStr()));
}
else {
DBG_ERROR(
@@ -978,11 +948,24 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
break;
case TypeClass_BOOLEAN:
- if ( implCheckItemType( _rSet, nId, SfxBoolItem::StaticType() ) )
+ if ( implCheckItemType( _rSet, _nId, SfxBoolItem::StaticType() ) )
{
sal_Bool bVal = sal_False;
_rValue >>= bVal;
- _rSet.Put(SfxBoolItem(nId, bVal));
+ _rSet.Put(SfxBoolItem(_nId, bVal));
+ }
+ else if ( implCheckItemType( _rSet, _nId, OptionalBoolItem::StaticType() ) )
+ {
+ OptionalBoolItem aItem( _nId );
+ if ( _rValue.hasValue() )
+ {
+ sal_Bool bValue = sal_False;
+ _rValue >>= bValue;
+ aItem.SetValue( bValue );
+ }
+ else
+ aItem.ClearValue();
+ _rSet.Put( aItem );
}
else {
DBG_ERROR(
@@ -995,11 +978,11 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
break;
case TypeClass_LONG:
- if ( implCheckItemType( _rSet, nId, SfxInt32Item::StaticType() ) )
+ if ( implCheckItemType( _rSet, _nId, SfxInt32Item::StaticType() ) )
{
sal_Int32 nValue = 0;
_rValue >>= nValue;
- _rSet.Put( SfxInt32Item( nId, nValue ) );
+ _rSet.Put( SfxInt32Item( _nId, nValue ) );
}
else {
DBG_ERROR(
@@ -1012,7 +995,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
break;
case TypeClass_SEQUENCE:
- if ( implCheckItemType( _rSet, nId, OStringListItem::StaticType() ) )
+ if ( implCheckItemType( _rSet, _nId, OStringListItem::StaticType() ) )
{
// determine the element type
TypeDescription aTD(_rValue.getValueType());
@@ -1027,7 +1010,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
{
Sequence< ::rtl::OUString > aStringList;
_rValue >>= aStringList;
- _rSet.Put(OStringListItem(nId, aStringList));
+ _rSet.Put(OStringListItem(_nId, aStringList));
}
break;
default:
@@ -1045,7 +1028,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
break;
case TypeClass_VOID:
- _rSet.ClearItem(nId);
+ _rSet.ClearItem(_nId);
break;
default:
diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx
index cf5d2edd65fc..4977658daeac 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -32,13 +32,13 @@
#include "precompiled_dbaccess.hxx"
#include "DriverSettings.hxx"
-#include "dsitems.hxx"
-#include "datasourceui.hxx"
-#include <connectivity/DriversConfig.hxx>
+#include "dsmeta.hxx"
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <connectivity/DriversConfig.hxx>
+
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::NamedValue;
@@ -47,34 +47,23 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
{
// 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[] =
+ DataSourceMetaData aMeta( _sURLPrefix );
+ const FeatureSet& rFeatures( aMeta.getFeatureSet() );
+ for ( FeatureSet::const_iterator feature = rFeatures.begin();
+ feature != rFeatures.end();
+ ++feature
+ )
{
- DSID_SQL92CHECK,
- DSID_APPEND_TABLE_ALIAS,
- DSID_AS_BEFORE_CORRNAME,
- DSID_ENABLEOUTERJOIN,
- DSID_IGNOREDRIVER_PRIV,
- DSID_PARAMETERNAMESUBST,
- DSID_SUPPRESSVERSIONCL,
- DSID_CATALOG,
- DSID_SCHEMA,
- DSID_INDEXAPPENDIX,
- DSID_CHECK_REQUIRED_FIELDS,
- DSID_AUTORETRIEVEENABLED,
- DSID_AUTOINCREMENTVALUE,
- DSID_AUTORETRIEVEVALUE,
- DSID_BOOLEANCOMPARISON,
- DSID_ESCAPE_DATETIME,
- 0
- };
- for ( const USHORT* pGenericKnowSetting = nGenericKnownSettings; *pGenericKnowSetting; ++pGenericKnowSetting )
- if ( aDSUI.hasSetting( *pGenericKnowSetting ) )
- _out_rDetailsIds.push_back( *pGenericKnowSetting );
+ _out_rDetailsIds.push_back( *feature );
+ }
// the rest is configuration-based
+ // TODO: that's not really true: *everything* is configuration-based nowadays, even the FeatureSet obtained
+ // from the DataSourceMetaData has been initialized from the configuration. So in fact, we could consolidate
+ // the two blocks.
+ // The best approach would be to extend the FeatureSet to contain *all* known data source features, not only
+ // the ones from the "Advanced settings" UI.
+
::connectivity::DriversConfig aDriverConfig(_xFactory);
const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
#if OSL_DEBUG_LEVEL > 0
@@ -117,7 +106,11 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
,TProperties(0,::rtl::OUString())
};
// TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper.
- // We should not duplicate it here.
+ // Another mapping (which is also duplicated in ODbDataSourceAdministrationHelper) exists in dsmeta.cxx. We should
+ // consolidate those three places into one.
+ // However, care has to be taken: We need to distinguish between "features" and "properties" of a data source (resp. driver).
+ // That is, a driver can support a certain property, but not allow to change it in the UI, which means it would
+ // not have the respective "feature".
for ( TProperties* pProps = aProps; pProps->first; ++pProps )
{
if ( aProperties.has(pProps->second) )
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index c67d34311147..fd2afb804827 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -31,70 +31,31 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBAUI_ADMINPAGES_HXX_
#include "adminpages.hxx"
-#endif
-#ifndef _DBAUI_DBADMIN_HRC_
#include "dbadmin.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
+#include "dbadmin.hxx"
#include "dbu_dlg.hrc"
-#endif
-#ifndef _SFXSTRITEM_HXX
-#include <svtools/stritem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef _DBAUI_DBADMIN_HXX_
-#include "dbadmin.hxx"
-#endif
-#ifndef _SV_MSGBOX_HXX
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
-#include "sqlmessage.hxx"
-#endif
-#ifndef _SV_ACCEL_HXX
-#include <vcl/accel.hxx>
-#endif
-#include <algorithm>
-#include <stdlib.h>
-#ifndef _OSL_FILE_HXX_
-#include <osl/file.hxx>
-#endif
-#ifndef _DBAUI_DSSELECT_HXX_
+#include "dsitems.hxx"
#include "dsselect.hxx"
-#endif
-#ifndef _DBAUI_ODBC_CONFIG_HXX_
-#include "odbcconfig.hxx"
-#endif
-#ifndef _DBAUI_LOCALRESACCESS_HXX_
#include "localresaccess.hxx"
-#endif
-#ifndef _SV_FIELD_HXX
+#include "odbcconfig.hxx"
+#include "optionalboolitem.hxx"
+#include "sqlmessage.hxx"
+
+#include <osl/file.hxx>
+#include <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <svtools/stritem.hxx>
+#include <vcl/accel.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
#include <vcl/field.hxx>
-#endif
-#ifndef _SV_LSTBOX_HXX
#include <vcl/lstbox.hxx>
-#endif
-#ifndef _SV_EDIT_HXX
-#include <vcl/edit.hxx>
-#endif
-#ifndef _SV_BUTTON_HXX
-#include <vcl/button.hxx>
-#endif
-
+#include <vcl/msgbox.hxx>
+#include <algorithm>
+#include <stdlib.h>
//.........................................................................
namespace dbaui
@@ -256,7 +217,16 @@ namespace dbaui
if ( _bRevertValue )
bValue = !bValue;
- _rSet.Put( SfxBoolItem( _nID, bValue ) );
+ if ( _pCheckBox->IsTriStateEnabled() )
+ {
+ OptionalBoolItem aValue( _nID );
+ if ( _pCheckBox->GetState() != STATE_DONTKNOW )
+ aValue.SetValue( bValue );
+ _rSet.Put( aValue );
+ }
+ else
+ _rSet.Put( SfxBoolItem( _nID, bValue ) );
+
_bChangedSomething = sal_True;
}
}
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 7f0b5ee16515..de429d1ea4b2 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -37,8 +37,7 @@
#include "dsitems.hxx"
#include "DbAdminImpl.hxx"
#include "DriverSettings.hxx"
-#include "datasourceui.hxx"
-
+#include "optionalboolitem.hxx"
#include "dbu_resource.hrc"
#include "dbu_dlg.hrc"
#include "dbadmin.hrc"
@@ -98,15 +97,16 @@ namespace dbaui
,m_pCheckRequiredFields( NULL )
,m_pIgnoreCurrency(NULL)
,m_pEscapeDateTime(NULL)
+ ,m_pPrimaryKeySupport(NULL)
,m_pBooleanComparisonModeLabel( NULL )
,m_pBooleanComparisonMode( NULL )
,m_aControlDependencies()
,m_aBooleanSettings()
- ,m_aSupported( _rDSMeta.getAdvancedSettingsSupport() )
+ ,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) )
{
impl_initBooleanSettings();
- DataSourceUI aDSUI( _rDSMeta );
+ const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() );
// create all the check boxes for the boolean settings
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
@@ -114,11 +114,16 @@ namespace dbaui
)
{
USHORT nItemId = setting->nItemId;
- if ( aDSUI.hasSetting( nItemId ) )
+ if ( rFeatures.has( nItemId ) )
{
- USHORT nID = setting->nControlResId;
- (*setting->ppControl) = new CheckBox( this, ModuleRes( nID ) );
+ USHORT nResourceId = setting->nControlResId;
+ (*setting->ppControl) = new CheckBox( this, ModuleRes( nResourceId ) );
(*setting->ppControl)->SetClickHdl( getControlModifiedLink() );
+
+ // check whether this must be a tristate check box
+ const SfxPoolItem& rItem = _rCoreAttrs.Get( nItemId );
+ if ( rItem.ISA( OptionalBoolItem ) )
+ (*setting->ppControl)->EnableTriState( TRUE );
}
}
@@ -148,7 +153,7 @@ namespace dbaui
}
// create the controls for the boolean comparison mode
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
m_pBooleanComparisonModeLabel = new FixedText( this, ModuleRes( FT_BOOLEANCOMPARISON ) );
m_pBooleanComparisonMode = new ListBox( this, ModuleRes( LB_BOOLEANCOMPARISON ) );
@@ -185,6 +190,7 @@ namespace dbaui
DELETEZ( m_pCheckRequiredFields );
DELETEZ( m_pIgnoreCurrency );
DELETEZ( m_pEscapeDateTime );
+ DELETEZ( m_pPrimaryKeySupport );
DELETEZ( m_pBooleanComparisonModeLabel );
DELETEZ( m_pBooleanComparisonMode );
}
@@ -210,13 +216,12 @@ namespace dbaui
{ &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false },
{ &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false },
{ &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false },
+ { &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false },
{ NULL, 0, 0, false }
};
for ( const BooleanSettingDesc* pCopy = aSettings; pCopy->nItemId != 0; ++pCopy )
{
- USHORT nID = pCopy->nItemId;
- (void) nID;
m_aBooleanSettings.push_back( *pCopy );
}
}
@@ -224,7 +229,7 @@ namespace dbaui
// -----------------------------------------------------------------------
void SpecialSettingsPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
_rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) );
}
@@ -244,7 +249,7 @@ namespace dbaui
}
}
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
_rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) );
}
@@ -270,16 +275,35 @@ namespace dbaui
if ( !*setting->ppControl )
continue;
- SFX_ITEMSET_GET( _rSet, pItem, SfxBoolItem, setting->nItemId, sal_True );
- bool bValue = pItem->GetValue();
- if ( setting->bInvertedDisplay )
- bValue = !bValue;
+ ::boost::optional< bool > aValue;
- (*setting->ppControl)->Check( bValue );
+ SFX_ITEMSET_GET( _rSet, pItem, SfxPoolItem, setting->nItemId, sal_True );
+ if ( pItem->ISA( SfxBoolItem ) )
+ {
+ aValue.reset( PTR_CAST( SfxBoolItem, pItem )->GetValue() );
+ }
+ else if ( pItem->ISA( OptionalBoolItem ) )
+ {
+ aValue = PTR_CAST( OptionalBoolItem, pItem )->GetFullValue();
+ }
+ else
+ DBG_ERROR( "SpecialSettingsPage::implInitControls: unknown boolean item type!" );
+
+ if ( !aValue )
+ {
+ (*setting->ppControl)->SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ BOOL bValue = *aValue;
+ if ( setting->bInvertedDisplay )
+ bValue = !bValue;
+ (*setting->ppControl)->Check( bValue );
+ }
}
// the non-boolean items
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
SFX_ITEMSET_GET( _rSet, pBooleanComparison, SfxInt32Item, DSID_BOOLEANCOMPARISON, sal_True );
m_pBooleanComparisonMode->SelectEntryPos( static_cast< USHORT >( pBooleanComparison->GetValue() ) );
@@ -305,7 +329,7 @@ namespace dbaui
}
// the non-boolean items
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
if ( m_pBooleanComparisonMode->GetSelectEntryPos() != m_pBooleanComparisonMode->GetSavedValue() )
{
@@ -420,14 +444,14 @@ namespace dbaui
const ::rtl::OUString eType = m_pImpl->getDatasourceType(*_pItems);
DataSourceMetaData aMeta( eType );
- const AdvancedSettingsSupport& rAdvancedSupport( aMeta.getAdvancedSettingsSupport() );
+ const FeatureSet& rFeatures( aMeta.getFeatureSet() );
// auto-generated values?
- if ( rAdvancedSupport.bGeneratedValues )
+ if ( rFeatures.supportsGeneratedValues() )
AddTabPage( PAGE_GENERATED_VALUES, String( ModuleRes( STR_GENERATED_VALUE ) ), ODriversSettings::CreateGeneratedValuesPage, NULL );
// any "special settings"?
- if ( rAdvancedSupport.supportsAnySpecialSetting() )
+ if ( rFeatures.supportsAnySpecialSetting() )
AddTabPage( PAGE_ADVANCED_SETTINGS_SPECIAL, String( ModuleRes( STR_DS_BEHAVIOUR ) ), ODriversSettings::CreateSpecialSettingsPage, NULL );
// remove the reset button - it's meaning is much too ambiguous in this dialog
@@ -446,8 +470,8 @@ namespace dbaui
bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL )
{
DataSourceMetaData aMeta( _sURL );
- const AdvancedSettingsSupport& rSupport( aMeta.getAdvancedSettingsSupport() );
- if ( rSupport.bGeneratedValues || rSupport.supportsAnySpecialSetting() )
+ const FeatureSet& rFeatures( aMeta.getFeatureSet() );
+ if ( rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting() )
return true;
return false;
}
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc
index 9617df464bd3..2ecc8f53b839 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hrc
+++ b/dbaccess/source/ui/dlg/advancedsettings.hrc
@@ -64,6 +64,7 @@
#define CB_CHECK_REQUIRED 13
#define CB_IGNORECURRENCY 14
#define CB_ESCAPE_DATETIME 15
+#define CB_PRIMARY_KEY_SUPPORT 16
#define ET_AUTOINCREMENTVALUE 1
#define ET_RETRIEVE_AUTO 2
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index 78a572d7fb0f..8145db32c4e2 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -74,6 +74,7 @@ namespace dbaui
CheckBox* m_pCheckRequiredFields;
CheckBox* m_pIgnoreCurrency;
CheckBox* m_pEscapeDateTime;
+ CheckBox* m_pPrimaryKeySupport;
FixedText* m_pBooleanComparisonModeLabel;
ListBox* m_pBooleanComparisonMode;
@@ -83,8 +84,7 @@ namespace dbaui
BooleanSettingDescs m_aBooleanSettings;
- AdvancedSettingsSupport
- m_aSupported;
+ bool m_bHasBooleanComparisonMode;
public:
virtual BOOL FillItemSet ( SfxItemSet& _rCoreAttrs );
diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src
index acb5fbb81656..dc06146402d7 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.src
+++ b/dbaccess/source/ui/dlg/advancedsettings.src
@@ -206,7 +206,18 @@
Size = MAP_APPFONT ( ADVANCED_PAGE_X -12 , CHECKBOX_HEIGHT ) ; \
TabStop = TRUE ; \
HelpId = HID_DSADMIN_ESCAPE_DATETIME; \
- Text [ en-US ] = "Use ODBC conformant date/time literals"; \
+ Text [ en-US ] = "Use ODBC conformant date/time literals"; \
+ };
+
+
+#define AUTO_PRIMARY_KEY_SUPPORT(AUTO_Y) \
+ CheckBox CB_PRIMARY_KEY_SUPPORT \
+ { \
+ Pos = MAP_APPFONT ( 6 , AUTO_Y ) ; \
+ Size = MAP_APPFONT ( ADVANCED_PAGE_X - 12 , CHECKBOX_HEIGHT ) ; \
+ TabStop = TRUE ; \
+ HelpId = HID_DSADMIN_PRIMARY_KEY_SUPPORT; \
+ Text [ en-US ] = "Supports primary keys"; \
};
@@ -321,8 +332,9 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL
AUTO_DOSLINEENDS( 11*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 10*CHECKBOX_HEIGHT + RELATED_CONTROLS )
AUTO_CHECKREQUIRED( 12*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 11*CHECKBOX_HEIGHT + RELATED_CONTROLS )
AUTO_IGNORECURRENCY( 13*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 12*CHECKBOX_HEIGHT + RELATED_CONTROLS )
- AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS )
- AUTO_BOOLEANCOMPARISON( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 13*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 )
+ AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS )
+ AUTO_PRIMARY_KEY_SUPPORT( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS )
+ AUTO_BOOLEANCOMPARISON( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 )
};
//-------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/datasourceui.cxx b/dbaccess/source/ui/dlg/datasourceui.cxx
deleted file mode 100644
index f0a56e8dec83..000000000000
--- a/dbaccess/source/ui/dlg/datasourceui.cxx
+++ /dev/null
@@ -1,99 +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: datasourceui.cxx,v $
- * $Revision: 1.5.68.1 $
- *
- * 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 "datasourceui.hxx"
-#include "dsmeta.hxx"
-#include "dsitems.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- /** === end UNO using === **/
-
- //====================================================================
- //= DataSourceUI
- //====================================================================
- //--------------------------------------------------------------------
- DataSourceUI::DataSourceUI( const DataSourceMetaData& _rDSMeta )
- :m_aDSMeta( _rDSMeta )
- {
- }
-
- //--------------------------------------------------------------------
- DataSourceUI::~DataSourceUI()
- {
- }
-
- //--------------------------------------------------------------------
- bool DataSourceUI::hasSetting( const USHORT _nItemId ) const
- {
- const AdvancedSettingsSupport& rAdvancedSupport( m_aDSMeta.getAdvancedSettingsSupport() );
-
- switch ( _nItemId )
- {
- case DSID_SQL92CHECK: return rAdvancedSupport.bUseSQL92NamingConstraints;
- case DSID_APPEND_TABLE_ALIAS: return rAdvancedSupport.bAppendTableAliasInSelect;
- case DSID_AS_BEFORE_CORRNAME: return rAdvancedSupport.bUseKeywordAsBeforeAlias;
- case DSID_ENABLEOUTERJOIN: return rAdvancedSupport.bUseBracketedOuterJoinSyntax;
- case DSID_IGNOREDRIVER_PRIV: return rAdvancedSupport.bIgnoreDriverPrivileges;
- case DSID_PARAMETERNAMESUBST: return rAdvancedSupport.bParameterNameSubstitution;
- case DSID_SUPPRESSVERSIONCL: return rAdvancedSupport.bDisplayVersionColumns;
- case DSID_CATALOG: return rAdvancedSupport.bUseCatalogInSelect;
- case DSID_SCHEMA: return rAdvancedSupport.bUseSchemaInSelect;
- case DSID_INDEXAPPENDIX: return rAdvancedSupport.bUseIndexDirectionKeyword;
- case DSID_DOSLINEENDS: return rAdvancedSupport.bUseDOSLineEnds;
- case DSID_BOOLEANCOMPARISON: return rAdvancedSupport.bBooleanComparisonMode;
- case DSID_CHECK_REQUIRED_FIELDS:return rAdvancedSupport.bFormsCheckRequiredFields;
- case DSID_AUTORETRIEVEENABLED: return rAdvancedSupport.bGeneratedValues;
- case DSID_AUTOINCREMENTVALUE: return rAdvancedSupport.bGeneratedValues;
- case DSID_AUTORETRIEVEVALUE: return rAdvancedSupport.bGeneratedValues;
- case DSID_IGNORECURRENCY: return rAdvancedSupport.bIgnoreCurrency;
- case DSID_ESCAPE_DATETIME: return rAdvancedSupport.bEscapeDateTime;
- }
-
- OSL_ENSURE( false, "DataSourceUI::hasSetting: this item id is currently not supported!" );
- // Support for *all* items is a medium-term goal only.
- return false;
- }
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
diff --git a/dbaccess/source/ui/dlg/datasourceui.hxx b/dbaccess/source/ui/dlg/datasourceui.hxx
deleted file mode 100644
index 4ea63439c0d5..000000000000
--- a/dbaccess/source/ui/dlg/datasourceui.hxx
+++ /dev/null
@@ -1,80 +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: datasourceui.hxx,v $
- * $Revision: 1.3.68.1 $
- *
- * 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_DATASOURCEUI_HXX
-#define DBACCESS_DATASOURCEUI_HXX
-
-#include "dsntypes.hxx"
-#include "dsmeta.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-#include <boost/shared_ptr.hpp>
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- //====================================================================
- //= DataSourceUI
- //====================================================================
- /** encapsulates information about available UI features of a data source type
- */
- class DataSourceUI
- {
- public:
- DataSourceUI( const DataSourceMetaData& _rDSMeta );
- ~DataSourceUI();
-
- /** returns whether the data source's UI contains the specified setting
-
- Note that at the moment, not all items are supported by this method. In particular, use
- it for the following only
- <ul><li>All items which refer to advanced settings (see AdvancedSettingsSupport)</li>
- </ul>
-
- A complete support of *all* items is a medium-term goal.
-
- @param _nItemId
- the UI's item ID for the setting in question. See dsitems.hxx.
- */
- bool hasSetting( const USHORT _nItemId ) const;
-
- private:
- DataSourceMetaData m_aDSMeta;
- };
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-#endif // DBACCESS_DATASOURCEUI_HXX
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 7aa91ef8ce2c..ccb904994c23 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -31,58 +31,26 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#include "dsnItem.hxx"
-#ifndef _DBAUI_DBADMIN_HXX_
-#include "dbadmin.hxx"
-#endif
-#ifndef _DBAUI_DBADMIN_HRC_
+#include "ConnectionPage.hxx"
+#include "DbAdminImpl.hxx"
+#include "DriverSettings.hxx"
+#include "adminpages.hxx"
#include "dbadmin.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
+#include "dbadmin.hxx"
#include "dbu_dlg.hrc"
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef _SFXSTRITEM_HXX
-#include <svtools/stritem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _SV_MSGBOX_HXX
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef _DBAUI_ADMINPAGES_HXX_
-#include "adminpages.hxx"
-#endif
-#ifndef _DBAUI_LOCALRESACCESS_HXX_
+#include "dsitems.hxx"
+#include "dsnItem.hxx"
#include "localresaccess.hxx"
-#endif
-#ifndef _DBAUI_STRINGLISTITEM_HXX_
-#include "stringlistitem.hxx"
-#endif
-#ifndef _DBAUI_PROPERTYSETITEM_HXX_
+#include "optionalboolitem.hxx"
#include "propertysetitem.hxx"
-#endif
-#ifndef _UNOTOOLS_CONFIGNODE_HXX_
+#include "stringlistitem.hxx"
+
+#include <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <svtools/stritem.hxx>
#include <unotools/confignode.hxx>
-#endif
-#ifndef DBAUI_CONNECTIONPAGE_HXX
-#include "ConnectionPage.hxx"
-#endif
-#ifndef DBAUI_DRIVERSETTINGS_HXX
-#include "DriverSettings.hxx"
-#endif
-#ifndef _DBAUI_DBADMINIMPL_HXX_
-#include "DbAdminImpl.hxx"
-#endif
+#include <vcl/msgbox.hxx>
//.........................................................................
namespace dbaui
@@ -449,8 +417,9 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
*pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, sal_True);
*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 SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True);
*pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String());
+ *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT );
// create the pool
static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] =
@@ -510,7 +479,8 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
{0,0},
{0,0},
{0,0},
- {0,0}, /* for Escape DateTime*/
+ {0,0},
+ {0,0},
{0,0},
{0,0}
};
diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk
index ca2098778f06..2ec59f3d7840 100644
--- a/dbaccess/source/ui/dlg/makefile.mk
+++ b/dbaccess/source/ui/dlg/makefile.mk
@@ -124,13 +124,13 @@ EXCEPTIONSFILES= \
$(SLO)$/DriverSettings.obj \
$(SLO)$/odbcconfig.obj \
$(SLO)$/advancedsettings.obj \
- $(SLO)$/datasourceui.obj \
$(SLO)$/textconnectionsettings.obj
SLOFILES= \
$(EXCEPTIONSFILES) \
$(SLO)$/dlgsize.obj \
- $(SLO)$/dlgattr.obj
+ $(SLO)$/dlgattr.obj \
+ $(SLO)$/optionalboolitem.obj
.IF "$(WINDOWS_VISTA_PSDK)"!="" && "$(PROF_EDITION)"==""
DISABLE_ADO=TRUE
diff --git a/dbaccess/source/ui/dlg/optionalboolitem.cxx b/dbaccess/source/ui/dlg/optionalboolitem.cxx
new file mode 100644
index 000000000000..9964e393061c
--- /dev/null
+++ b/dbaccess/source/ui/dlg/optionalboolitem.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+* 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 "optionalboolitem.hxx"
+
+//........................................................................
+namespace dbaui
+{
+//........................................................................
+
+ //====================================================================
+ //= OptionalBoolItem
+ //====================================================================
+ TYPEINIT1( OptionalBoolItem, SfxPoolItem );
+ //--------------------------------------------------------------------
+ OptionalBoolItem::OptionalBoolItem( sal_Int16 _nWhich )
+ :SfxPoolItem( _nWhich )
+ ,m_aValue()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ OptionalBoolItem::OptionalBoolItem( const OptionalBoolItem& _rSource )
+ :SfxPoolItem( _rSource )
+ ,m_aValue( _rSource.m_aValue )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ int OptionalBoolItem::operator==( const SfxPoolItem& _rItem ) const
+ {
+ const OptionalBoolItem* pCompare = PTR_CAST( OptionalBoolItem, &_rItem );
+ if ( !pCompare )
+ return 0;
+
+ if ( m_aValue == pCompare->m_aValue )
+ return 1;
+
+ return 0;
+ }
+
+ //--------------------------------------------------------------------
+ SfxPoolItem* OptionalBoolItem::Clone( SfxItemPool* /*_pPool*/ ) const
+ {
+ return new OptionalBoolItem( *this );
+ }
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
diff --git a/dbaccess/source/ui/dlg/optionalboolitem.hxx b/dbaccess/source/ui/dlg/optionalboolitem.hxx
new file mode 100644
index 000000000000..0a1fc397e0b6
--- /dev/null
+++ b/dbaccess/source/ui/dlg/optionalboolitem.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+* 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_OPTIONALBOOLITEM_HXX
+#define DBACCESS_OPTIONALBOOLITEM_HXX
+
+#include <svtools/poolitem.hxx>
+
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace dbaui
+{
+//........................................................................
+
+ //====================================================================
+ //= OptionalBoolItem
+ //====================================================================
+ class OptionalBoolItem : public SfxPoolItem
+ {
+ ::boost::optional< bool > m_aValue;
+
+ public:
+ TYPEINFO();
+ OptionalBoolItem( sal_Int16 nWhich );
+ OptionalBoolItem( const OptionalBoolItem& _rSource );
+
+ virtual int operator==( const SfxPoolItem& _rItem ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* _pPool = NULL ) const;
+
+ bool HasValue() const { return !!m_aValue; }
+ void ClearValue() { m_aValue.reset(); }
+ bool GetValue() const { return *m_aValue; }
+ void SetValue( const bool _bValue ) { m_aValue.reset( _bValue ); }
+
+ const ::boost::optional< bool >&
+ GetFullValue() const { return m_aValue; }
+ };
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
+
+#endif // DBACCESS_OPTIONALBOOLITEM_HXX
diff --git a/dbaccess/source/ui/dlg/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
index a0d95aca810b..20a6f4d83a8e 100644
--- a/dbaccess/source/ui/dlg/dsitems.hxx
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -31,6 +31,8 @@
#ifndef _DBAUI_DATASOURCEITEMS_HXX_
#define _DBAUI_DATASOURCEITEMS_HXX_
+typedef sal_Int32 ItemID;
+
//========================================================================
//= item ids for the data source administration dialog
@@ -92,6 +94,7 @@
#define DSID_CONN_SOCKET 56
#define DSID_ESCAPE_DATETIME 57
#define DSID_NAMED_PIPE 58
+#define DSID_PRIMARY_KEY_SUPPORT 59
// don't forget to adjust DSID_LAST_ITEM_ID below!
@@ -99,7 +102,7 @@
//= item range. Adjust this if you introduce new items above
#define DSID_FIRST_ITEM_ID DSID_NAME
-#define DSID_LAST_ITEM_ID DSID_NAMED_PIPE
+#define DSID_LAST_ITEM_ID DSID_PRIMARY_KEY_SUPPORT
#endif // _DBAUI_DATASOURCEITEMS_HXX_
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 62ad79e80a67..1052ec7c536c 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -32,6 +32,7 @@
#define DBACCESS_DSMETA_HXX
#include "dsntypes.hxx"
+#include "dsitems.hxx"
/** === begin UNO includes === **/
/** === end UNO includes === **/
@@ -56,7 +57,7 @@ namespace dbaui
//====================================================================
//= DataSourceMetaData
//====================================================================
- struct AdvancedSettingsSupport;
+ class FeatureSet;
class DataSourceMetaData_Impl;
/** encapsulates meta data for a data source
@@ -74,7 +75,7 @@ namespace dbaui
~DataSourceMetaData();
/// returns a struct describing this data source type's support for our known advanced settings
- const AdvancedSettingsSupport& getAdvancedSettingsSupport() const;
+ const FeatureSet& getFeatureSet() const;
/// determines whether or not the data source requires authentication
AuthenticationMode getAuthentication() const;
@@ -86,77 +87,56 @@ namespace dbaui
};
//====================================================================
- //= AdvancedSettingsSupport
+ //= FeatureSet
//====================================================================
- /// struct taking flags for the supported advanced settings
- struct AdvancedSettingsSupport
+ /** can be used to ask for (UI) support for certain advanced features
+ */
+ class FeatureSet
{
- // auto-generated values
- bool bGeneratedValues;
- // various settings as found on the "Special Settings" page in the UI
- bool bUseSQL92NamingConstraints;
- bool bAppendTableAliasInSelect;
- bool bUseKeywordAsBeforeAlias;
- bool bUseBracketedOuterJoinSyntax;
- bool bIgnoreDriverPrivileges;
- bool bParameterNameSubstitution;
- bool bDisplayVersionColumns;
- bool bUseCatalogInSelect;
- bool bUseSchemaInSelect;
- bool bUseIndexDirectionKeyword;
- bool bUseDOSLineEnds;
- bool bBooleanComparisonMode;
- bool bFormsCheckRequiredFields;
- bool bIgnoreCurrency;
- bool bEscapeDateTime;
-
- // Note: If you extend this list, you need to adjust the ctor (of course)
- // and (maybe) the implementation of supportsAnySpecialSetting
-
- AdvancedSettingsSupport()
- :bGeneratedValues ( true )
- ,bUseSQL92NamingConstraints ( true )
- ,bAppendTableAliasInSelect ( true )
- ,bUseKeywordAsBeforeAlias ( true )
- ,bUseBracketedOuterJoinSyntax ( true )
- ,bIgnoreDriverPrivileges ( true )
- ,bParameterNameSubstitution ( true )
- ,bDisplayVersionColumns ( true )
- ,bUseCatalogInSelect ( true )
- ,bUseSchemaInSelect ( true )
- ,bUseIndexDirectionKeyword ( true )
- ,bUseDOSLineEnds ( true )
- ,bBooleanComparisonMode ( true )
- ,bFormsCheckRequiredFields ( true )
- ,bIgnoreCurrency ( false )
- ,bEscapeDateTime ( false )
- {
- }
-
- /** determines whether there is support for any of the settings found on the "Special Settings"
- UI
- */
- inline bool supportsAnySpecialSetting() const;
+ public:
+ typedef ::std::set< ItemID >::const_iterator const_iterator;
+
+ public:
+ inline FeatureSet() { }
+
+ inline void put( const ItemID _id ) { m_aContent.insert( _id ); }
+ inline bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); }
+
+ inline bool supportsAnySpecialSetting() const;
+ inline bool supportsGeneratedValues() const;
+
+ inline const_iterator begin() const { return m_aContent.begin(); }
+ inline const_iterator end() const { return m_aContent.end(); }
+
+ private:
+ ::std::set< ItemID > m_aContent;
};
//--------------------------------------------------------------------
- inline bool AdvancedSettingsSupport::supportsAnySpecialSetting() const
+ inline bool FeatureSet::supportsGeneratedValues() const
+ {
+ return has( DSID_AUTORETRIEVEENABLED );
+ }
+
+ //--------------------------------------------------------------------
+ inline bool FeatureSet::supportsAnySpecialSetting() const
{
- return ( bUseSQL92NamingConstraints == true )
- || ( bAppendTableAliasInSelect == true )
- || ( bUseKeywordAsBeforeAlias == true )
- || ( bUseBracketedOuterJoinSyntax == true )
- || ( bIgnoreDriverPrivileges == true )
- || ( bParameterNameSubstitution == true )
- || ( bDisplayVersionColumns == true )
- || ( bUseCatalogInSelect == true )
- || ( bUseSchemaInSelect == true )
- || ( bUseIndexDirectionKeyword == true )
- || ( bUseDOSLineEnds == true )
- || ( bBooleanComparisonMode == true )
- || ( bFormsCheckRequiredFields == true )
- || ( bIgnoreCurrency == true )
- || ( bEscapeDateTime == true )
+ return has( DSID_SQL92CHECK )
+ || has( DSID_APPEND_TABLE_ALIAS )
+ || has( DSID_AS_BEFORE_CORRNAME )
+ || has( DSID_ENABLEOUTERJOIN )
+ || has( DSID_IGNOREDRIVER_PRIV )
+ || has( DSID_PARAMETERNAMESUBST )
+ || has( DSID_SUPPRESSVERSIONCL )
+ || has( DSID_CATALOG )
+ || has( DSID_SCHEMA )
+ || has( DSID_INDEXAPPENDIX )
+ || has( DSID_DOSLINEENDS )
+ || has( DSID_BOOLEANCOMPARISON )
+ || has( DSID_CHECK_REQUIRED_FIELDS )
+ || has( DSID_IGNORECURRENCY )
+ || has( DSID_ESCAPE_DATETIME )
+ || has( DSID_PRIMARY_KEY_SUPPORT )
;
}
diff --git a/dbaccess/source/ui/inc/exsrcbrw.hxx b/dbaccess/source/ui/inc/exsrcbrw.hxx
index f8c8dc54688b..d4783560732a 100644
--- a/dbaccess/source/ui/inc/exsrcbrw.hxx
+++ b/dbaccess/source/ui/inc/exsrcbrw.hxx
@@ -31,18 +31,11 @@
#ifndef _SBA_EXTCTRLR_HXX
#define _SBA_EXTCTRLR_HXX
-#ifndef _SBA_BWRCTRLR_HXX
#include "brwctrlr.hxx"
-#endif
-#ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
-#include <com/sun/star/form/XFormController.hpp>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
+
#include <comphelper/uno3.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
-#endif
+
//==============================================================================
//= SbaExternalSourceBrowser
//==============================================================================
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 1feb51cf49a9..82fa7b7ec2bf 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -63,6 +63,7 @@
#include <comphelper/extract.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
+#include <connectivity/dbmetadata.hxx>
#include <rtl/logfile.hxx>
#include <rtl/ustrbuf.hxx>
@@ -1381,23 +1382,12 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
// -----------------------------------------------------------------------------
bool OCopyTableWizard::supportsPrimaryKey( const Reference< XConnection >& _rxConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsPrimaryKey" );
OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsPrimaryKey: invalid connection!" );
+ if ( !_rxConnection.is() )
+ return false;
- bool bSupports( false );
- if ( _rxConnection.is() )
- {
- try
- {
- Reference< XDatabaseMetaData > xMetaData( _rxConnection->getMetaData(), UNO_QUERY_THROW );
- bSupports = xMetaData->supportsCoreSQLGrammar();
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return bSupports;
+ ::dbtools::DatabaseMetaData aMetaData( _rxConnection );
+ return aMetaData.supportsPrimaryKeys();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index f758f529f66f..6f348742afd4 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -47,32 +47,6 @@ namespace dbaui
using namespace ::com::sun::star;
/** === end UNO using === **/
- struct InitAdvanced : public AdvancedSettingsSupport
- {
- enum Special { All, AllButIgnoreCurrency, None };
-
- InitAdvanced( Special _eType )
- :AdvancedSettingsSupport()
- {
- bGeneratedValues = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseSQL92NamingConstraints = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bAppendTableAliasInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseKeywordAsBeforeAlias = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseBracketedOuterJoinSyntax = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bIgnoreDriverPrivileges = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bParameterNameSubstitution = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bDisplayVersionColumns = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseCatalogInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseSchemaInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseIndexDirectionKeyword = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseDOSLineEnds = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bBooleanComparisonMode = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bFormsCheckRequiredFields = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bIgnoreCurrency = ( _eType == All );
- bEscapeDateTime = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- }
- };
-
struct FeatureSupport
{
// authentication mode of the data source
@@ -89,98 +63,75 @@ namespace dbaui
}
};
+ struct FeatureMapping
+ {
+ /// one of the items from dsitems.hxx
+ ItemID nItemID;
+ const sal_Char* pAsciiFeatureName;
+ };
+
//====================================================================
//= global tables
//====================================================================
//--------------------------------------------------------------------
- static const AdvancedSettingsSupport& getAdvancedSettingsSupport( const ::rtl::OUString& _sURL )
+ static const FeatureMapping* lcl_getFeatureMappings()
{
- DECLARE_STL_USTRINGACCESS_MAP( AdvancedSettingsSupport, AdvancedSupport);
- static AdvancedSupport s_aSupport;
- if ( s_aSupport.empty() )
+ static const FeatureMapping s_aMappings[] = {
+ { DSID_AUTORETRIEVEENABLED, "GeneratedValues" },
+ { DSID_AUTOINCREMENTVALUE, "GeneratedValues" },
+ { DSID_AUTORETRIEVEVALUE, "GeneratedValues" },
+ { DSID_SQL92CHECK, "UseSQL92NamingConstraints" },
+ { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" },
+ { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" },
+ { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" },
+ { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" },
+ { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" },
+ { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" },
+ { DSID_CATALOG, "UseCatalogInSelect" },
+ { DSID_SCHEMA, "UseSchemaInSelect" },
+ { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" },
+ { DSID_DOSLINEENDS, "UseDOSLineEnds" },
+ { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" },
+ { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" },
+ { DSID_IGNORECURRENCY, "IgnoreCurrency" },
+ { DSID_ESCAPE_DATETIME, "EscapeDateTime" },
+ { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
+ { 0, NULL }
+ };
+ return s_aMappings;
+ }
+
+ //--------------------------------------------------------------------
+ static const FeatureSet& lcl_getFeatureSet( const ::rtl::OUString _rURL )
+ {
+ typedef ::std::map< ::rtl::OUString, FeatureSet, ::comphelper::UStringLess > FeatureSets;
+ static FeatureSets s_aFeatureSets;
+ if ( s_aFeatureSets.empty() )
{
- ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessServiceFactory());
- const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
- const ::rtl::OUString* pIter = aURLs.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
- for(;pIter != pEnd;++pIter)
+ ::connectivity::DriversConfig aDriverConfig( ::comphelper::getProcessServiceFactory() );
+ const uno::Sequence< ::rtl::OUString > aPatterns = aDriverConfig.getURLs();
+ for ( const ::rtl::OUString* pattern = aPatterns.getConstArray();
+ pattern != aPatterns.getConstArray() + aPatterns.getLength();
+ ++pattern
+ )
{
- InitAdvanced aInit(InitAdvanced::None);
- const uno::Sequence< beans::NamedValue> aProperties = aDriverConfig.getFeatures(*pIter).getNamedValues();
- const beans::NamedValue* pPropertiesIter = aProperties.getConstArray();
- const beans::NamedValue* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
- for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ FeatureSet aCurrentSet;
+ const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( *pattern ).getNamedValues() );
+
+ const FeatureMapping* pFeatureMapping = lcl_getFeatureMappings();
+ while ( pFeatureMapping->pAsciiFeatureName )
{
- if ( pPropertiesIter->Name.equalsAscii("GeneratedValues") )
- {
- pPropertiesIter->Value >>= aInit.bGeneratedValues;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseSQL92NamingConstraints") )
- {
- pPropertiesIter->Value >>= aInit.bUseSQL92NamingConstraints;
- }
- else if ( pPropertiesIter->Name.equalsAscii("AppendTableAliasInSelect") )
- {
- pPropertiesIter->Value >>= aInit.bAppendTableAliasInSelect;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseKeywordAsBeforeAlias") )
- {
- pPropertiesIter->Value >>= aInit.bUseKeywordAsBeforeAlias;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseBracketedOuterJoinSyntax") )
- {
- pPropertiesIter->Value >>= aInit.bUseBracketedOuterJoinSyntax;
- }
- else if ( pPropertiesIter->Name.equalsAscii("IgnoreDriverPrivileges") )
- {
- pPropertiesIter->Value >>= aInit.bIgnoreDriverPrivileges;
- }
- else if ( pPropertiesIter->Name.equalsAscii("ParameterNameSubstitution") )
- {
- pPropertiesIter->Value >>= aInit.bParameterNameSubstitution;
- }
- else if ( pPropertiesIter->Name.equalsAscii("DisplayVersionColumns") )
- {
- pPropertiesIter->Value >>= aInit.bDisplayVersionColumns;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseCatalogInSelect") )
- {
- pPropertiesIter->Value >>= aInit.bUseCatalogInSelect;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseSchemaInSelect") )
- {
- pPropertiesIter->Value >>= aInit.bUseSchemaInSelect;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseIndexDirectionKeyword") )
- {
- pPropertiesIter->Value >>= aInit.bUseIndexDirectionKeyword;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseDOSLineEnds") )
- {
- pPropertiesIter->Value >>= aInit.bUseDOSLineEnds;
- }
- else if ( pPropertiesIter->Name.equalsAscii("BooleanComparisonMode") )
- {
- pPropertiesIter->Value >>= aInit.bBooleanComparisonMode;
- }
- else if ( pPropertiesIter->Name.equalsAscii("FormsCheckRequiredFields") )
- {
- pPropertiesIter->Value >>= aInit.bFormsCheckRequiredFields;
- }
- else if ( pPropertiesIter->Name.equalsAscii("IgnoreCurrency") )
- {
- pPropertiesIter->Value >>= aInit.bIgnoreCurrency;
- }
- else if ( pPropertiesIter->Name.equalsAscii("EscapeDateTime") )
- {
- pPropertiesIter->Value >>= aInit.bEscapeDateTime;
- }
- } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
- s_aSupport.insert(AdvancedSupport::value_type(*pIter,aInit));
+ if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) )
+ aCurrentSet.put( pFeatureMapping->nItemID );
+ ++pFeatureMapping;
+ }
+
+ s_aFeatureSets[ *pattern ] = aCurrentSet;
}
- } // if ( s_aSupport.empty() )
- OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
- return s_aSupport[ _sURL ];
+ }
+
+ OSL_ENSURE( s_aFeatureSets.find( _rURL ) != s_aFeatureSets.end(), "invalid URL/pattern!" );
+ return s_aFeatureSets[ _rURL ];
}
//--------------------------------------------------------------------
@@ -208,8 +159,8 @@ namespace dbaui
aInit = AuthPwd;
}
s_aSupport.insert(Supported::value_type(*pIter,aInit));
- } // for(;pIter != pEnd;++pIter)
- } // if ( s_aSupport.empty() )
+ }
+ }
OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
return s_aSupport[ _sURL ].eAuthentication;
}
@@ -249,9 +200,9 @@ namespace dbaui
}
//--------------------------------------------------------------------
- const AdvancedSettingsSupport& DataSourceMetaData::getAdvancedSettingsSupport() const
+ const FeatureSet& DataSourceMetaData::getFeatureSet() const
{
- return ::dbaui::getAdvancedSettingsSupport( m_pImpl->getType() );
+ return lcl_getFeatureSet( m_pImpl->getType() );
}
//--------------------------------------------------------------------
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 9694d285c511..347a19ca60ad 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -1534,19 +1534,8 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ )
return sal_False;
OTableController& rController = GetView()->getController();
- try
- {
- Reference<XConnection> xCon = rController.getConnection();
-
- Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>();
- if(!xMetaData.is() || !xMetaData->supportsCoreSQLGrammar())
- return sal_False; // no primary keys allowed
-
- }
- catch(SQLException&)
- {
- OSL_ASSERT(!"supportsCoreSQLGrammar");
- }
+ if ( !rController.getSdbMetaData().supportsPrimaryKeys() )
+ return sal_False;
Reference<XPropertySet> xTable = rController.getTable();
//////////////////////////////////////////////////////////////
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index c447c002a830..98f57b61fbdc 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -30,143 +30,62 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBUI_TABLECONTROLLER_HXX
-#include "TableController.hxx"
-#endif
-#ifndef _DBAU_REGHELPER_HXX_
+#include "FieldDescriptions.hxx"
+#include "TEditControl.hxx"
+#include "TableController.hxx"
+#include "TableDesignView.hxx"
+#include "TableRow.hxx"
+#include "TypeInfo.hxx"
+#include "UITools.hxx"
+#include "browserids.hxx"
#include "dbu_reghelper.hxx"
-#endif
-#ifndef _STRING_HXX
-#include <tools/string.hxx>
-#endif
-#include <tools/diagnose_ex.h>
-#ifndef _SFXSIDS_HRC
-#include <sfx2/sfxsids.hrc>
-#endif
-#ifndef _DBU_TBL_HRC_
#include "dbu_tbl.hrc"
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
-#include "browserids.hxx"
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX
#include "defaultobjectnamecheck.hxx"
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
-#include <comphelper/extract.hxx>
-#endif
-#ifndef DBAUI_DLGSAVE_HXX
#include "dlgsave.hxx"
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include "dsmeta.hxx"
+#include "indexdialog.hxx"
+#include "sqlmessage.hxx"
+
+/** === begin UNO includes === **/
#include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
-#include <com/sun/star/sdbcx/XDrop.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_
-#include <com/sun/star/sdbcx/XAlterTable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
-#include <com/sun/star/sdbcx/XAppend.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XTitleChangeListener.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XDrop.hpp>
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
-#endif
-#include <com/sun/star/frame/XTitleChangeListener.hpp>
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UI_XEXECUTABLEDIALOG_HPP_
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#endif
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
-#ifndef _COMPHELPER_STREAMSECTION_HXX_
+/** === end UNO includes === **/
+
+#include <comphelper/extract.hxx>
#include <comphelper/streamsection.hxx>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#endif
-#ifndef DBAUI_TABLEDESIGNVIEW_HXX
-#include "TableDesignView.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
-#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef DBAUI_FIELDDESCRIPTIONS_HXX
-#include "FieldDescriptions.hxx"
-#endif
-#ifndef DBAUI_TABLEROW_HXX
-#include "TableRow.hxx"
-#endif
-#ifndef DBAUI_TYPEINFO_HXX
-#include "TypeInfo.hxx"
-#endif
-#ifndef DBAUI_TABLEEDITORCONTROL_HXX
-#include "TEditControl.hxx"
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
-#include "sqlmessage.hxx"
-#endif
-#ifndef _SV_MSGBOX_HXX
+#include <comphelper/types.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <connectivity/dbmetadata.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <tools/diagnose_ex.h>
+#include <tools/string.hxx>
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _DBAUI_INDEXDIALOG_HXX_
-#include "indexdialog.hxx"
-#endif
-#ifndef DBAUI_TOOLS_HXX
-#include "UITools.hxx"
-#endif
-#ifndef DBAUI_TOOLS_HXX
-#include "UITools.hxx"
-#endif
-#include <boost/mem_fn.hpp>
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
-#include <cppuhelper/exc_hlp.hxx>
-#endif
-#include "dsmeta.hxx"
+#include <boost/mem_fn.hpp>
#include <boost/bind.hpp>
+
#include <algorithm>
#include <functional>
@@ -1089,7 +1008,8 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::
{
sal_Bool bOk = sal_True;
sal_Bool bFoundPKey = sal_False;
- Reference< XDatabaseMetaData> xMetaData = getMetaData( );
+ Reference< XDatabaseMetaData > xMetaData = getMetaData( );
+ DatabaseMetaData aMetaData( getConnection() );
::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True);
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_vRowList.begin();
@@ -1115,39 +1035,38 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::
}
}
}
- if(!bFoundPKey)
+ if ( _bNew && !bFoundPKey && aMetaData.supportsPrimaryKeys() )
{
- if(_bNew && xMetaData.is() && xMetaData->supportsCoreSQLGrammar())
- {
- String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
- String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
- OSQLMessageBox aBox(getView(), sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
+ String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
+ String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
+ OSQLMessageBox aBox(getView(), sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
- INT16 nReturn = aBox.Execute();
-
- if (nReturn == RET_YES)
- {
- ::boost::shared_ptr<OTableRow> pNewRow(new OTableRow());
- TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
+ switch ( aBox.Execute() )
+ {
+ case RET_YES:
+ {
+ ::boost::shared_ptr<OTableRow> pNewRow(new OTableRow());
+ TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
+ if ( !pTypeInfo.get() )
+ break;
- if ( pTypeInfo.get() )
- {
- pNewRow->SetFieldType( pTypeInfo );
- OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
+ pNewRow->SetFieldType( pTypeInfo );
+ OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
- pActFieldDescr->SetAutoIncrement(sal_False); // #95927# pTypeInfo->bAutoIncrement
- pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
+ pActFieldDescr->SetAutoIncrement(sal_False); // #95927# pTypeInfo->bAutoIncrement
+ pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
- pActFieldDescr->SetName( createUniqueName(::rtl::OUString::createFromAscii("ID") ));
- pActFieldDescr->SetPrimaryKey( sal_True );
- m_vRowList.insert(m_vRowList.begin(),pNewRow);
+ pActFieldDescr->SetName( createUniqueName(::rtl::OUString::createFromAscii("ID") ));
+ pActFieldDescr->SetPrimaryKey( sal_True );
+ m_vRowList.insert(m_vRowList.begin(),pNewRow);
- static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->Invalidate();
- static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->RowInserted(0);
- } // if ( pTypeInfo.get() )
- }
- else if (nReturn == RET_CANCEL)
- bOk = sal_False;
+ static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->Invalidate();
+ static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->RowInserted(0);
+ }
+ break;
+ case RET_CANCEL:
+ bOk = sal_False;
+ break;
}
}
return bOk;