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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_connectivity.hxx" 26 #include "connectivity/sdbcx/VKeyColumn.hxx" 27 #include "TConnection.hxx" 28 29 using namespace connectivity; 30 using namespace connectivity::sdbcx; 31 using namespace ::com::sun::star::beans; 32 using namespace ::com::sun::star::uno; 33 using namespace cppu; 34 // ----------------------------------------------------------------------------- 35 ::rtl::OUString SAL_CALL OKeyColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) 36 { 37 if(isNew()) 38 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumnDescription"); 39 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumn"); 40 } 41 // ----------------------------------------------------------------------------- 42 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OKeyColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) 43 { 44 ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); 45 if(isNew()) 46 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumnDescription"); 47 else 48 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumn"); 49 50 return aSupported; 51 } 52 // ----------------------------------------------------------------------------- 53 sal_Bool SAL_CALL OKeyColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) 54 { 55 Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); 56 const ::rtl::OUString* pSupported = aSupported.getConstArray(); 57 const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); 58 for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) 59 ; 60 61 return pSupported != pEnd; 62 } 63 // ------------------------------------------------------------------------- 64 OKeyColumn::OKeyColumn(sal_Bool _bCase) : OColumn(_bCase) 65 { 66 construct(); 67 } 68 // ------------------------------------------------------------------------- 69 OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, 70 const ::rtl::OUString& _Name, 71 const ::rtl::OUString& _TypeName, 72 const ::rtl::OUString& _DefaultValue, 73 sal_Int32 _IsNullable, 74 sal_Int32 _Precision, 75 sal_Int32 _Scale, 76 sal_Int32 _Type, 77 sal_Bool _IsAutoIncrement, 78 sal_Bool _IsRowVersion, 79 sal_Bool _IsCurrency, 80 sal_Bool _bCase 81 ) : OColumn(_Name, 82 _TypeName, 83 _DefaultValue, 84 ::rtl::OUString(), 85 _IsNullable, 86 _Precision, 87 _Scale, 88 _Type, 89 _IsAutoIncrement, 90 _IsRowVersion, 91 _IsCurrency, 92 _bCase) 93 , m_ReferencedColumn(_ReferencedColumn) 94 { 95 construct(); 96 } 97 // ------------------------------------------------------------------------- 98 OKeyColumn::~OKeyColumn() 99 { 100 } 101 // ----------------------------------------------------------------------------- 102 ::cppu::IPropertyArrayHelper* OKeyColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const 103 { 104 return doCreateArrayHelper(); 105 } 106 // ----------------------------------------------------------------------------- 107 ::cppu::IPropertyArrayHelper& SAL_CALL OKeyColumn::getInfoHelper() 108 { 109 return *OKeyColumn_PROP::getArrayHelper(isNew() ? 1 : 0); 110 } 111 // ------------------------------------------------------------------------- 112 void OKeyColumn::construct() 113 { 114 sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; 115 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); 116 } 117 // ----------------------------------------------------------------------------- 118 119 120 121 122