merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / sdbcx / VKeyColumn.cxx
blob1b01ed07301eacf4c2ba8fde59dce17c420dba4a
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: VKeyColumn.cxx,v $
10 * $Revision: 1.13 $
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/VKeyColumn.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 using namespace cppu;
41 // -----------------------------------------------------------------------------
42 ::rtl::OUString SAL_CALL OKeyColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
44 if(isNew())
45 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumnDescription");
46 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumn");
48 // -----------------------------------------------------------------------------
49 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OKeyColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
51 ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
52 if(isNew())
53 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumnDescription");
54 else
55 aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumn");
57 return aSupported;
59 // -----------------------------------------------------------------------------
60 sal_Bool SAL_CALL OKeyColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
62 Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
63 const ::rtl::OUString* pSupported = aSupported.getConstArray();
64 const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
65 for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
68 return pSupported != pEnd;
70 // -------------------------------------------------------------------------
71 OKeyColumn::OKeyColumn(sal_Bool _bCase) : OColumn(_bCase)
73 construct();
75 // -------------------------------------------------------------------------
76 OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn,
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_ReferencedColumn(_ReferencedColumn)
101 construct();
103 // -------------------------------------------------------------------------
104 OKeyColumn::~OKeyColumn()
107 // -----------------------------------------------------------------------------
108 ::cppu::IPropertyArrayHelper* OKeyColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
110 return doCreateArrayHelper();
112 // -----------------------------------------------------------------------------
113 ::cppu::IPropertyArrayHelper& SAL_CALL OKeyColumn::getInfoHelper()
115 return *OKeyColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
117 // -------------------------------------------------------------------------
118 void OKeyColumn::construct()
120 sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
121 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
123 // -----------------------------------------------------------------------------