Bump for 3.6-28
[LibreOffice.git] / connectivity / source / sdbcx / VKeyColumn.cxx
blobb0d933c235c1286a620eb6ef179d9c81fd4f5df1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "connectivity/sdbcx/VKeyColumn.hxx"
30 #include "TConnection.hxx"
32 using namespace connectivity;
33 using namespace connectivity::sdbcx;
34 using namespace ::com::sun::star::beans;
35 using namespace ::com::sun::star::uno;
36 using namespace cppu;
37 // -----------------------------------------------------------------------------
38 ::rtl::OUString SAL_CALL OKeyColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
40 if(isNew())
41 return ::rtl::OUString("com.sun.star.sdbcx.VKeyColumnDescription");
42 return ::rtl::OUString("com.sun.star.sdbcx.VKeyColumn");
44 // -----------------------------------------------------------------------------
45 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OKeyColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
47 ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
48 if(isNew())
49 aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.KeyColumnDescription");
50 else
51 aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.KeyColumn");
53 return aSupported;
55 // -----------------------------------------------------------------------------
56 sal_Bool SAL_CALL OKeyColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
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)
64 return pSupported != pEnd;
66 // -------------------------------------------------------------------------
67 OKeyColumn::OKeyColumn(sal_Bool _bCase) : OColumn(_bCase)
69 construct();
71 // -------------------------------------------------------------------------
72 OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn,
73 const ::rtl::OUString& _Name,
74 const ::rtl::OUString& _TypeName,
75 const ::rtl::OUString& _DefaultValue,
76 sal_Int32 _IsNullable,
77 sal_Int32 _Precision,
78 sal_Int32 _Scale,
79 sal_Int32 _Type,
80 sal_Bool _IsAutoIncrement,
81 sal_Bool _IsRowVersion,
82 sal_Bool _IsCurrency,
83 sal_Bool _bCase
84 ) : OColumn(_Name,
85 _TypeName,
86 _DefaultValue,
87 ::rtl::OUString(),
88 _IsNullable,
89 _Precision,
90 _Scale,
91 _Type,
92 _IsAutoIncrement,
93 _IsRowVersion,
94 _IsCurrency,
95 _bCase)
96 , m_ReferencedColumn(_ReferencedColumn)
98 construct();
100 // -------------------------------------------------------------------------
101 OKeyColumn::~OKeyColumn()
104 // -----------------------------------------------------------------------------
105 ::cppu::IPropertyArrayHelper* OKeyColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
107 return doCreateArrayHelper();
109 // -----------------------------------------------------------------------------
110 ::cppu::IPropertyArrayHelper& SAL_CALL OKeyColumn::getInfoHelper()
112 return *OKeyColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
114 // -------------------------------------------------------------------------
115 void OKeyColumn::construct()
117 sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
118 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
120 // -----------------------------------------------------------------------------
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */