Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dbaccess / source / core / api / HelperCollections.hxx
blobc48a8b13ec8e25ba10de5edf116fa811d3ca1475
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef DBA_HELPERCOLLECTIONS_HXX
20 #define DBA_HELPERCOLLECTIONS_HXX
22 #include "connectivity/sdbcx/VCollection.hxx"
23 #include <connectivity/dbtools.hxx>
24 #include <connectivity/dbconversion.hxx>
25 #include <connectivity/PColumn.hxx>
26 #include <rtl/ref.hxx>
28 namespace dbaccess
30 using namespace dbtools;
31 using namespace comphelper;
32 using namespace connectivity;
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::beans;
35 using namespace ::com::sun::star::sdbc;
36 using namespace ::com::sun::star::sdb;
37 using namespace ::com::sun::star::sdbcx;
38 using namespace ::com::sun::star::container;
39 using namespace ::com::sun::star::lang;
40 using namespace ::com::sun::star::script;
41 using namespace ::cppu;
42 using namespace ::osl;
44 typedef connectivity::sdbcx::OCollection OPrivateColumns_Base;
45 class OPrivateColumns : public OPrivateColumns_Base
47 ::rtl::Reference< ::connectivity::OSQLColumns> m_aColumns;
48 protected:
49 virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
50 virtual void impl_refresh() throw(RuntimeException) {}
51 virtual Reference< XPropertySet > createDescriptor()
53 return NULL;
55 public:
56 OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
57 sal_Bool _bCase,
58 ::cppu::OWeakObject& _rParent,
59 ::osl::Mutex& _rMutex,
60 const ::std::vector< ::rtl::OUString> &_rVector,
61 sal_Bool _bUseAsIndex = sal_False
64 /** creates a columns instance as above, but taking the names from the columns itself
66 static OPrivateColumns* createWithIntrinsicNames(
67 const ::rtl::Reference< ::connectivity::OSQLColumns >& _rColumns,
68 sal_Bool _bCase,
69 ::cppu::OWeakObject& _rParent,
70 ::osl::Mutex& _rMutex
73 virtual void SAL_CALL disposing(void);
75 typedef connectivity::sdbcx::OCollection OPrivateTables_BASE;
77 //==========================================================================
78 //= OPrivateTables
79 //==========================================================================
80 class OPrivateTables : public OPrivateTables_BASE
82 OSQLTables m_aTables;
83 protected:
84 virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
85 virtual void impl_refresh() throw(RuntimeException) {}
86 virtual Reference< XPropertySet > createDescriptor()
88 return NULL;
90 public:
91 OPrivateTables( const OSQLTables& _rTables,
92 sal_Bool _bCase,
93 ::cppu::OWeakObject& _rParent,
94 ::osl::Mutex& _rMutex,
95 const ::std::vector< ::rtl::OUString> &_rVector
96 ) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
97 ,m_aTables(_rTables)
100 virtual void SAL_CALL disposing(void)
102 clear_NoDispose();
103 // we're not owner of the objects we're holding, instead the object we got in our ctor is
104 // So we're not allowed to dispose our elements.
105 m_aTables.clear();
106 OPrivateTables_BASE::disposing();
110 #endif // DBA_HELPERCOLLECTIONS_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */