1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _CONNECTIVITY_SDBCX_KEY_HXX_ 25 #define _CONNECTIVITY_SDBCX_KEY_HXX_ 26 27 28 #include <comphelper/IdPropArrayHelper.hxx> 29 #include "connectivity/CommonTools.hxx" 30 #include <comphelper/broadcasthelper.hxx> 31 #include "connectivity/sdbcx/VTypeDef.hxx" 32 #include <com/sun/star/container/XNamed.hpp> 33 #include "connectivity/sdbcx/IRefreshable.hxx" 34 #include "connectivity/sdbcx/VDescriptor.hxx" 35 #include "connectivity/dbtoolsdllapi.hxx" 36 #include <cppuhelper/implbase1.hxx> 37 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> 38 #include <boost/shared_ptr.hpp> 39 40 namespace connectivity 41 { 42 namespace sdbcx 43 { 44 45 struct OOO_DLLPUBLIC_DBTOOLS KeyProperties 46 { 47 ::std::vector< ::rtl::OUString> m_aKeyColumnNames; 48 ::rtl::OUString m_ReferencedTable; 49 sal_Int32 m_Type; 50 sal_Int32 m_UpdateRule; 51 sal_Int32 m_DeleteRule; KeyPropertiesconnectivity::sdbcx::KeyProperties52 KeyProperties(const ::rtl::OUString& _ReferencedTable, 53 sal_Int32 _Type, 54 sal_Int32 _UpdateRule, 55 sal_Int32 _DeleteRule) 56 :m_ReferencedTable(_ReferencedTable), 57 m_Type(_Type), 58 m_UpdateRule(_UpdateRule), 59 m_DeleteRule(_DeleteRule) 60 {} KeyPropertiesconnectivity::sdbcx::KeyProperties61 KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){} 62 }; 63 typedef ::boost::shared_ptr< KeyProperties > TKeyProperties; 64 typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OKey_BASE; 65 class OCollection; 66 67 class OOO_DLLPUBLIC_DBTOOLS OKey : 68 public comphelper::OBaseMutex, 69 public ODescriptor_BASE, 70 public IRefreshableColumns, 71 public ::comphelper::OIdPropertyArrayUsageHelper<OKey>, 72 public ODescriptor, 73 public OKey_BASE 74 { 75 protected: 76 TKeyProperties m_aProps; 77 OCollection* m_pColumns; 78 79 using ODescriptor_BASE::rBHelper; 80 // OPropertyArrayUsageHelper 81 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; 82 // OPropertySetHelper 83 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 84 public: 85 OKey(sal_Bool _bCase); 86 OKey(const ::rtl::OUString& _Name,const TKeyProperties& _rProps,sal_Bool _bCase); 87 /*OKey( const ::rtl::OUString& _Name, 88 const ::rtl::OUString& _ReferencedTable, 89 sal_Int32 _Type, 90 sal_Int32 _UpdateRule, 91 sal_Int32 _DeleteRule, 92 sal_Bool _bCase);*/ 93 94 virtual ~OKey( ); 95 96 DECLARE_SERVICE_INFO(); 97 //XInterface 98 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 99 virtual void SAL_CALL acquire() throw(); 100 virtual void SAL_CALL release() throw(); 101 //XTypeProvider 102 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 103 // ODescriptor 104 virtual void construct(); 105 106 // ::cppu::OComponentHelper 107 virtual void SAL_CALL disposing(); 108 // XPropertySet 109 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 110 // XColumnsSupplier 111 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); 112 113 // XNamed 114 virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); 115 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 116 // XDataDescriptorFactory 117 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); 118 }; 119 } 120 } 121 122 #endif // _CONNECTIVITY_SDBCX_KEY_HXX_ 123 124 125