Branch libreoffice-5-0-4
[LibreOffice.git] / include / connectivity / PColumn.hxx
blobe5b4c73db2d5c5e6b554c10db91b25ddf64e1347
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 INCLUDED_CONNECTIVITY_PCOLUMN_HXX
20 #define INCLUDED_CONNECTIVITY_PCOLUMN_HXX
22 #include <sal/config.h>
24 #include <map>
26 #include <connectivity/dbtoolsdllapi.hxx>
27 #include <connectivity/sdbcx/VColumn.hxx>
28 #include <connectivity/CommonTools.hxx>
29 #include <rtl/ref.hxx>
30 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
31 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <comphelper/proparrhlp.hxx>
35 namespace connectivity
37 namespace parse
39 class OParseColumn;
41 typedef sdbcx::OColumn OParseColumn_BASE;
42 typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
44 class OOO_DLLPUBLIC_DBTOOLS OParseColumn :
45 public OParseColumn_BASE, public OParseColumn_PROP
47 OUString m_aRealName;
48 OUString m_sLabel;
49 bool m_bFunction;
50 bool m_bDbasePrecisionChanged;
51 bool m_bAggregateFunction;
52 bool m_bIsSearchable;
54 protected:
55 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
56 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
58 virtual ~OParseColumn();
59 public:
60 OParseColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn, bool _bCase);
61 OParseColumn(const OUString& _Name,
62 const OUString& _TypeName,
63 const OUString& _DefaultValue,
64 const OUString& _Description,
65 sal_Int32 _IsNullable,
66 sal_Int32 _Precision,
67 sal_Int32 _Scale,
68 sal_Int32 _Type,
69 bool _IsAutoIncrement,
70 bool _IsCurrency,
71 bool _bCase,
72 const OUString& _CatalogName,
73 const OUString& _SchemaName,
74 const OUString& _TableName);
76 virtual void construct() SAL_OVERRIDE;
78 void setRealName(const OUString& _rName) { m_aRealName = _rName; }
79 void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; }
80 void setTableName(const OUString& _rName) { m_TableName = _rName; }
81 void setFunction(bool _bFunction) { m_bFunction = _bFunction; }
82 void setAggregateFunction(bool _bFunction) { m_bAggregateFunction = _bFunction; }
83 void setIsSearchable( bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
84 void setDbasePrecisionChanged(bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }
86 const OUString& getRealName() const { return m_aRealName; }
87 const OUString& getLabel() const { return m_sLabel; }
88 const OUString& getTableName() const { return m_TableName; }
89 bool getFunction() const { return m_bFunction; }
90 bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; }
92 public:
93 /** creates a collection of OParseColumn, as described by a result set meta data instance.
95 static ::rtl::Reference< OSQLColumns >
96 createColumnsForResultSet(
97 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
98 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
99 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns
102 typedef std::map<OUString, int> StringMap;
103 /** creates a single OParseColumn, as described by a result set meta data instance.
104 The column names are unique.
106 static OParseColumn*
107 createColumnForResultSet(
108 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
109 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
110 sal_Int32 _nColumnPos,
111 StringMap& _rColumns
114 private:
115 using OParseColumn_BASE::createArrayHelper;
118 class OOrderColumn;
120 typedef sdbcx::OColumn OOrderColumn_BASE;
121 typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
123 class OOO_DLLPUBLIC_DBTOOLS OOrderColumn :
124 public OOrderColumn_BASE, public OOrderColumn_PROP
126 const bool m_bAscending;
128 protected:
129 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
130 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
132 virtual ~OOrderColumn();
133 public:
134 OOrderColumn(
135 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
136 const OUString& i_rOriginatingTableName,
137 bool _bCase,
138 bool _bAscending
141 OOrderColumn(
142 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
143 bool _bCase,
144 bool _bAscending
147 virtual void construct() SAL_OVERRIDE;
149 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 private:
151 using OOrderColumn_BASE::createArrayHelper;
156 #endif // INCLUDED_CONNECTIVITY_PCOLUMN_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */