1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_connectivity.hxx" 30 #include "connectivity/sdbcx/VIndexColumn.hxx" 31 #include "TConnection.hxx" 32 33 using namespace connectivity; 34 using namespace connectivity::sdbcx; 35 using namespace ::com::sun::star::beans; 36 using namespace ::com::sun::star::uno; 37 // ----------------------------------------------------------------------------- 38 ::rtl::OUString SAL_CALL OIndexColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) 39 { 40 if(isNew()) 41 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumnDescription"); 42 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndex"); 43 } 44 // ----------------------------------------------------------------------------- 45 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OIndexColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) 46 { 47 ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); 48 if(isNew()) 49 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexDescription"); 50 else 51 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Index"); 52 53 return aSupported; 54 } 55 // ----------------------------------------------------------------------------- 56 sal_Bool SAL_CALL OIndexColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) 57 { 58 Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); 59 const ::rtl::OUString* pSupported = aSupported.getConstArray(); 60 const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); 61 for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) 62 ; 63 64 return pSupported != pEnd; 65 } 66 // ----------------------------------------------------------------------------- 67 OIndexColumn::OIndexColumn(sal_Bool _bCase) : OColumn(_bCase), m_IsAscending(sal_True) 68 { 69 construct(); 70 } 71 72 // ------------------------------------------------------------------------- 73 OIndexColumn::OIndexColumn( sal_Bool _IsAscending, 74 const ::rtl::OUString& _Name, 75 const ::rtl::OUString& _TypeName, 76 const ::rtl::OUString& _DefaultValue, 77 sal_Int32 _IsNullable, 78 sal_Int32 _Precision, 79 sal_Int32 _Scale, 80 sal_Int32 _Type, 81 sal_Bool _IsAutoIncrement, 82 sal_Bool _IsRowVersion, 83 sal_Bool _IsCurrency, 84 sal_Bool _bCase 85 ) : OColumn(_Name, 86 _TypeName, 87 _DefaultValue, 88 ::rtl::OUString(), 89 _IsNullable, 90 _Precision, 91 _Scale, 92 _Type, 93 _IsAutoIncrement, 94 _IsRowVersion, 95 _IsCurrency, 96 _bCase) 97 , m_IsAscending(_IsAscending) 98 { 99 construct(); 100 } 101 // ----------------------------------------------------------------------------- 102 ::cppu::IPropertyArrayHelper* OIndexColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const 103 { 104 return doCreateArrayHelper(); 105 } 106 // ----------------------------------------------------------------------------- 107 ::cppu::IPropertyArrayHelper& SAL_CALL OIndexColumn::getInfoHelper() 108 { 109 return *OIndexColumn_PROP::getArrayHelper(isNew() ? 1 : 0); 110 } 111 // ------------------------------------------------------------------------- 112 void OIndexColumn::construct() 113 { 114 sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; 115 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType()); 116 } 117 // ----------------------------------------------------------------------------- 118 119 120 121