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