merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / core / api / HelperCollections.hxx
blob901c1bf9dc85fc17322fd55409a082bc52974cd2
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: HelperCollections.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
30 #ifndef DBA_HELPERCOLLECTIONS_HXX
31 #define DBA_HELPERCOLLECTIONS_HXX
33 #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
34 #include "connectivity/sdbcx/VCollection.hxx"
35 #endif
36 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
37 #include <connectivity/dbtools.hxx>
38 #endif
39 #ifndef _DBHELPER_DBCONVERSION_HXX_
40 #include <connectivity/dbconversion.hxx>
41 #endif
42 #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
43 #include <connectivity/PColumn.hxx>
44 #endif
45 #ifndef _VOS_REF_HXX_
46 #include <vos/ref.hxx>
47 #endif
49 namespace dbaccess
51 using namespace dbtools;
52 using namespace comphelper;
53 using namespace connectivity;
54 using namespace ::com::sun::star::uno;
55 using namespace ::com::sun::star::beans;
56 using namespace ::com::sun::star::sdbc;
57 using namespace ::com::sun::star::sdb;
58 using namespace ::com::sun::star::sdbcx;
59 using namespace ::com::sun::star::container;
60 using namespace ::com::sun::star::lang;
61 using namespace ::com::sun::star::script;
62 using namespace ::cppu;
63 using namespace ::osl;
64 // -----------------------------------------------------------------------------
65 typedef connectivity::sdbcx::OCollection OPrivateColumns_Base;
66 class OPrivateColumns : public OPrivateColumns_Base
68 ::vos::ORef< ::connectivity::OSQLColumns> m_aColumns;
69 protected:
70 virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
71 virtual void impl_refresh() throw(RuntimeException) {}
72 virtual Reference< XPropertySet > createDescriptor()
74 return NULL;
76 public:
77 OPrivateColumns(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns,
78 sal_Bool _bCase,
79 ::cppu::OWeakObject& _rParent,
80 ::osl::Mutex& _rMutex,
81 const ::std::vector< ::rtl::OUString> &_rVector,
82 sal_Bool _bUseAsIndex = sal_False
85 /** creates a columns instance as above, but taking the names from the columns itself
87 static OPrivateColumns* createWithIntrinsicNames(
88 const ::vos::ORef< ::connectivity::OSQLColumns >& _rColumns,
89 sal_Bool _bCase,
90 ::cppu::OWeakObject& _rParent,
91 ::osl::Mutex& _rMutex
94 virtual void SAL_CALL disposing(void);
96 typedef connectivity::sdbcx::OCollection OPrivateTables_BASE;
98 //==========================================================================
99 //= OPrivateTables
100 //==========================================================================
101 class OPrivateTables : public OPrivateTables_BASE
103 OSQLTables m_aTables;
104 protected:
105 virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
106 virtual void impl_refresh() throw(RuntimeException) {}
107 virtual Reference< XPropertySet > createDescriptor()
109 return NULL;
111 public:
112 OPrivateTables( const OSQLTables& _rTables,
113 sal_Bool _bCase,
114 ::cppu::OWeakObject& _rParent,
115 ::osl::Mutex& _rMutex,
116 const ::std::vector< ::rtl::OUString> &_rVector
117 ) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
118 ,m_aTables(_rTables)
121 virtual void SAL_CALL disposing(void)
123 clear_NoDispose();
124 // we're not owner of the objects we're holding, instead the object we got in our ctor is
125 // So we're not allowed to dispose our elements.
126 m_aTables.clear();
127 OPrivateTables_BASE::disposing();
131 #endif // DBA_HELPERCOLLECTIONS_HXX