1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <dbase/DColumns.hxx>
21 #include <dbase/DTable.hxx>
22 #include <connectivity/sdbcx/VColumn.hxx>
24 using namespace connectivity::dbase
;
25 using namespace connectivity
;
26 using namespace ::com::sun::star::uno
;
27 using namespace ::com::sun::star::beans
;
28 using namespace ::com::sun::star::lang
;
29 using namespace ::com::sun::star::sdbcx
;
30 using namespace ::com::sun::star::sdbc
;
31 using namespace ::com::sun::star::container
;
33 sdbcx::ObjectType
ODbaseColumns::createObject(const OUString
& _rName
)
35 ODbaseTable
* pTable
= static_cast<ODbaseTable
*>(m_pTable
);
37 const ::rtl::Reference
<OSQLColumns
>& aCols
= pTable
->getTableColumns();
38 OSQLColumns::const_iterator aIter
= find(aCols
->begin(),aCols
->end(),_rName
,::comphelper::UStringMixEqual(isCaseSensitive()));
40 sdbcx::ObjectType xRet
;
41 if(aIter
!= aCols
->end())
42 xRet
= sdbcx::ObjectType(*aIter
,UNO_QUERY
);
47 void ODbaseColumns::impl_refresh()
49 m_pTable
->refreshColumns();
52 Reference
< XPropertySet
> ODbaseColumns::createDescriptor()
54 return new sdbcx::OColumn(isCaseSensitive());
59 sdbcx::ObjectType
ODbaseColumns::appendObject( const OUString
& _rForName
, const Reference
< XPropertySet
>& descriptor
)
61 if ( m_pTable
->isNew() )
62 return cloneDescriptor( descriptor
);
64 m_pTable
->addColumn( descriptor
);
65 return createObject( _rForName
);
70 void ODbaseColumns::dropObject(sal_Int32 _nPos
, const OUString
& /*_sElementName*/)
72 if(!m_pTable
->isNew())
73 m_pTable
->dropColumn(_nPos
);
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */