Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
21 :
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>
27 :
28 : namespace dbaccess
29 : {
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;
43 :
44 : typedef connectivity::sdbcx::OCollection OPrivateColumns_Base;
45 228 : class OPrivateColumns : public OPrivateColumns_Base
46 : {
47 : ::rtl::Reference< ::connectivity::OSQLColumns> m_aColumns;
48 : protected:
49 : virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) SAL_OVERRIDE;
50 0 : virtual void impl_refresh() throw(RuntimeException) SAL_OVERRIDE {}
51 0 : virtual Reference< XPropertySet > createDescriptor() SAL_OVERRIDE
52 : {
53 0 : return NULL;
54 : }
55 : public:
56 : OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
57 : bool _bCase,
58 : ::cppu::OWeakObject& _rParent,
59 : ::osl::Mutex& _rMutex,
60 : const ::std::vector< OUString> &_rVector,
61 : bool _bUseAsIndex = false
62 : );
63 :
64 : /** creates a columns instance as above, but taking the names from the columns itself
65 : */
66 : static OPrivateColumns* createWithIntrinsicNames(
67 : const ::rtl::Reference< ::connectivity::OSQLColumns >& _rColumns,
68 : bool _bCase,
69 : ::cppu::OWeakObject& _rParent,
70 : ::osl::Mutex& _rMutex
71 : );
72 :
73 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
74 : };
75 : typedef connectivity::sdbcx::OCollection OPrivateTables_BASE;
76 :
77 : // OPrivateTables
78 158 : class OPrivateTables : public OPrivateTables_BASE
79 : {
80 : OSQLTables m_aTables;
81 : protected:
82 : virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) SAL_OVERRIDE;
83 0 : virtual void impl_refresh() throw(RuntimeException) SAL_OVERRIDE {}
84 0 : virtual Reference< XPropertySet > createDescriptor() SAL_OVERRIDE
85 : {
86 0 : return NULL;
87 : }
88 : public:
89 79 : OPrivateTables( const OSQLTables& _rTables,
90 : bool _bCase,
91 : ::cppu::OWeakObject& _rParent,
92 : ::osl::Mutex& _rMutex,
93 : const ::std::vector< OUString> &_rVector
94 : ) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
95 79 : ,m_aTables(_rTables)
96 : {
97 79 : }
98 79 : virtual void SAL_CALL disposing() SAL_OVERRIDE
99 : {
100 79 : clear_NoDispose();
101 : // we're not owner of the objects we're holding, instead the object we got in our ctor is
102 : // So we're not allowed to dispose our elements.
103 79 : m_aTables.clear();
104 79 : OPrivateTables_BASE::disposing();
105 79 : }
106 : };
107 : }
108 : #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|