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/VIndexColumn.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 // -----------------------------------------------------------------------------
getImplementationName()34 ::rtl::OUString SAL_CALL OIndexColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
35 {
36 if(isNew())
37 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumnDescriptor");
38 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumn");
39 }
40 // -----------------------------------------------------------------------------
getSupportedServiceNames()41 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OIndexColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
42 {
43 ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
44 if(isNew())
45 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumnDescriptor");
46 else
47 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumn");
48
49 return aSupported;
50 }
51 // -----------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)52 sal_Bool SAL_CALL OIndexColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
53 {
54 Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
55 const ::rtl::OUString* pSupported = aSupported.getConstArray();
56 const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
57 for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
58 ;
59
60 return pSupported != pEnd;
61 }
62 // -----------------------------------------------------------------------------
OIndexColumn(sal_Bool _bCase)63 OIndexColumn::OIndexColumn(sal_Bool _bCase) : OColumn(_bCase), m_IsAscending(sal_True)
64 {
65 construct();
66 }
67
68 // -------------------------------------------------------------------------
OIndexColumn(sal_Bool _IsAscending,const::rtl::OUString & _Name,const::rtl::OUString & _TypeName,const::rtl::OUString & _DefaultValue,sal_Int32 _IsNullable,sal_Int32 _Precision,sal_Int32 _Scale,sal_Int32 _Type,sal_Bool _IsAutoIncrement,sal_Bool _IsRowVersion,sal_Bool _IsCurrency,sal_Bool _bCase)69 OIndexColumn::OIndexColumn( sal_Bool _IsAscending,
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_IsAscending(_IsAscending)
94 {
95 construct();
96 }
97 // -----------------------------------------------------------------------------
createArrayHelper(sal_Int32) const98 ::cppu::IPropertyArrayHelper* OIndexColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
99 {
100 return doCreateArrayHelper();
101 }
102 // -----------------------------------------------------------------------------
getInfoHelper()103 ::cppu::IPropertyArrayHelper& SAL_CALL OIndexColumn::getInfoHelper()
104 {
105 return *OIndexColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
106 }
107 // -------------------------------------------------------------------------
construct()108 void OIndexColumn::construct()
109 {
110 sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
111 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType());
112 }
113 // -----------------------------------------------------------------------------
114
115
116
117