diff options
Diffstat (limited to 'dbaccess/source/core/inc')
-rw-r--r-- | dbaccess/source/core/inc/ContainerMediator.hxx | 17 | ||||
-rw-r--r-- | dbaccess/source/core/inc/ContentHelper.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/inc/PropertyForward.hxx | 36 | ||||
-rw-r--r-- | dbaccess/source/core/inc/column.hxx | 187 | ||||
-rw-r--r-- | dbaccess/source/core/inc/columnsettings.hxx | 108 | ||||
-rw-r--r-- | dbaccess/source/core/inc/datasettings.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/core/inc/definitioncolumn.hxx | 279 | ||||
-rw-r--r-- | dbaccess/source/core/inc/querycontainer.hxx | 2 |
8 files changed, 297 insertions, 335 deletions
diff --git a/dbaccess/source/core/inc/ContainerMediator.hxx b/dbaccess/source/core/inc/ContainerMediator.hxx index af2076f3e0f9..0b129d5465f0 100644 --- a/dbaccess/source/core/inc/ContainerMediator.hxx +++ b/dbaccess/source/core/inc/ContainerMediator.hxx @@ -112,23 +112,12 @@ namespace dbaccess */ void impl_cleanup_nothrow(); - /** retrieves the settings object to initialize a container element - - Normally, this object will simply retrieve the object with the given name from our settings - container. Hiowever, for columns, there's a fallback in case this settings object does - not yet exist: Then, we check if the given destination object refers to a table column, via its - TableName and RealName property. If so, this table column is used as initialization object. - - @param _rName - the name of the destination object in its container - @param _rxDestination - the destination object to initialize + /** initializes the properties of the given object from its counterpart in our settings container */ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - impl_getSettingsForInitialization_nothrow( + void impl_initSettings_nothrow( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDestination - ) const; + ); }; //........................................................................ } // namespace dbaccess diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx index 227110bd324d..d9d000435ec4 100644 --- a/dbaccess/source/core/inc/ContentHelper.hxx +++ b/dbaccess/source/core/inc/ContentHelper.hxx @@ -236,6 +236,8 @@ namespace dbaccess getPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties ); + const ::comphelper::ComponentContext& getContext() const { return m_aContext; } + inline TContentPtr getImpl() const { return m_pImpl; } protected: diff --git a/dbaccess/source/core/inc/PropertyForward.hxx b/dbaccess/source/core/inc/PropertyForward.hxx index a4adbb59ef47..1e5cd6f0d4d0 100644 --- a/dbaccess/source/core/inc/PropertyForward.hxx +++ b/dbaccess/source/core/inc/PropertyForward.hxx @@ -55,24 +55,31 @@ namespace dbaccess { //........................................................................ + + // =================================================================== + // = OPropertyForward + // =================================================================== typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener > OPropertyForward_Base; - class OPropertyForward : public ::comphelper::OBaseMutex + class OPropertyForward :public ::comphelper::OBaseMutex ,public OPropertyForward_Base { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSource; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xDest; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> m_xDestInfo; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xDestContainer; - ::rtl::OUString m_sName; - sal_Bool m_bInInsert; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSource; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDest; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xDestInfo; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xDestContainer; + ::rtl::OUString m_sName; + sal_Bool m_bInInsert; + protected: virtual ~OPropertyForward(); + public: - OPropertyForward(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xSource - ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xDestContainer - ,const ::rtl::OUString& _sName - ,const ::std::vector< ::rtl::OUString>& _aPropertyList = ::std::vector< ::rtl::OUString>()); + OPropertyForward( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xSource, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xDestContainer, + const ::rtl::OUString& _sName, + const ::std::vector< ::rtl::OUString >& _aPropertyList + ); // ::com::sun::star::beans::XPropertyChangeListener virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); @@ -80,10 +87,11 @@ namespace dbaccess // ::com::sun::star::lang::XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException); - inline void setName(const ::rtl::OUString& _sName) { m_sName = _sName; } - void setDefinition(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xDest); - inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getDefinition() const { return m_xDest;} + inline void setName( const ::rtl::OUString& _sName ) { m_sName = _sName; } + void setDefinition( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDest); + inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDefinition() const { return m_xDest; } }; + //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/inc/column.hxx b/dbaccess/source/core/inc/column.hxx index bd1f2665da3a..ab4fcb211e6a 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/compbase2.hxx> +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/propshlp.hxx> +#include <osl/diagnose.h> + +#include <hash_map> namespace dbaccess { @@ -124,23 +72,25 @@ namespace dbaccess //************************************************************ // OColumn //************************************************************ - typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::container::XNamed, - ::com::sun::star::lang::XUnoTunnel > OColumnBase; + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::container::XNamed + > OColumnBase; //------------------------------------------------------------ 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,27 +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(); - // cppu::OComponentHelper virtual void SAL_CALL disposing(void); @@ -190,57 +119,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..22d119d6c429 --- /dev/null +++ b/dbaccess/source/core/inc/columnsettings.hxx @@ -0,0 +1,108 @@ +/************************************************************************* +* 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(); + + protected: + void registerProperties( IPropertyContainer& _rPropertyContainer ); + + /** determines whether the property with the given handle is handled by the class + */ + static bool isColumnSettingProperty( const sal_Int32 _nPropertyHandle ); + static bool isDefaulted( const sal_Int32 _nPropertyHandle, const ::com::sun::star::uno::Any& _rPropertyValue ); + + public: + /** check if the persistent settings have their default value + */ + static bool hasDefaultSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn ); + }; + +//........................................................................ +} // 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..c5151e6bffd5 100644 --- a/dbaccess/source/core/inc/definitioncolumn.hxx +++ b/dbaccess/source/core/inc/definitioncolumn.hxx @@ -30,36 +30,26 @@ #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 { typedef ::cppu::ImplHelper1< ::com::sun::star::container::XChild > TXChild; + // ========================================================================= + //= OTableColumnDescriptor + // ========================================================================= /** * provides the properties for description. A descriptor could be used to create a new table column. */ @@ -68,7 +58,9 @@ namespace dbaccess ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor > ,public TXChild { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; + const bool m_bActAsDescriptor; + protected: // <properties> rtl::OUString m_aTypeName; @@ -79,24 +71,32 @@ 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_bActAsDescriptor( _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(); + } 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,67 +104,100 @@ 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); - - protected: - using OColumn::getFastPropertyValue; + private: + void impl_registerProperties(); }; - /** - * 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. + // ========================================================================= + // = OTableColumn + // ========================================================================= + class OTableColumn; + typedef ::comphelper::OPropertyArrayUsageHelper < OTableColumn > OTableColumn_PBase; + /** describes a column of a table */ - class OTableColumn : public OTableColumnDescriptor, - public ::comphelper::OPropertyArrayUsageHelper < OTableColumn > + class OTableColumn :public OTableColumnDescriptor + ,public OTableColumn_PBase { - friend class ODBTable; - protected: virtual ~OTableColumn(); + public: OTableColumn(const ::rtl::OUString& _rName); - OTableColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn); - // com::sun::star::lang::XTypeProvider + // XTypeProvider virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); - // ::com::sun::star::lang::XServiceInfo + // 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); - // ::comphelper::OPropertyArrayUsageHelper + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + }; + + // ========================================================================= + // = OQueryColumn + // ========================================================================= + class OQueryColumn; + typedef ::comphelper::OPropertyArrayUsageHelper< OQueryColumn > OQueryColumn_PBase; + /** a column of a Query, with additional information obtained from parsing the query statement + */ + class OQueryColumn :public OTableColumnDescriptor + ,public OQueryColumn_PBase + { + // <properties> + ::rtl::OUString m_sCatalogName; + ::rtl::OUString m_sSchemaName; + ::rtl::OUString m_sTableName; + ::rtl::OUString m_sRealName; + // </properties> + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xOriginalTableColumn; + + protected: + ~OQueryColumn(); + + public: + OQueryColumn( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxParserColumn, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + + // *Property* 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; + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + impl_determineOriginalTableColumn( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + ); + + using ::cppu::OPropertySetHelper::getFastPropertyValue; }; + // ========================================================================= + // = OColumnWrapper + // ========================================================================= /** * 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 +207,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,24 +228,30 @@ 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; }; + // ========================================================================= + // = OTableColumnDescriptorWrapper + // ========================================================================= /** * 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); @@ -243,26 +282,26 @@ namespace dbaccess 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); - - protected: using OColumnWrapper::getFastPropertyValue; }; + // ========================================================================= + // = OTableColumnWrapper + // ========================================================================= /** * 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 +314,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/inc/querycontainer.hxx b/dbaccess/source/core/inc/querycontainer.hxx index ac3d61bac8d1..6d8b523ec84c 100644 --- a/dbaccess/source/core/inc/querycontainer.hxx +++ b/dbaccess/source/core/inc/querycontainer.hxx @@ -180,7 +180,7 @@ namespace dbaccess ); DECLARE_XINTERFACE( ) - // ::com::sun::star::lang::XServiceInfo + DECLARE_XTYPEPROVIDER( ) DECLARE_SERVICE_INFO(); // ::com::sun::star::container::XContainerListener |