build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / dbaccess / source / core / inc / TableDeco.hxx
blob9b818fd38bfd77de9654f6ad1b7091b90a833e4e
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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
23 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
24 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
25 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
26 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
27 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
28 #include <com/sun/star/sdbcx/XRename.hpp>
29 #include <com/sun/star/sdbcx/XAlterTable.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/sdbc/XRow.hpp>
32 #include <com/sun/star/sdbc/XConnection.hpp>
33 #include <cppuhelper/compbase.hxx>
34 #include <cppuhelper/implbase5.hxx>
35 #include "apitools.hxx"
36 #include "datasettings.hxx"
37 #include "column.hxx"
39 #include <connectivity/CommonTools.hxx>
40 #include <connectivity/sdbcx/IRefreshable.hxx>
41 #include <comphelper/IdPropArrayHelper.hxx>
43 namespace dbaccess
45 typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier,
46 css::sdbcx::XKeysSupplier,
47 css::container::XNamed,
48 css::lang::XServiceInfo,
49 css::sdbcx::XDataDescriptorFactory,
50 css::sdbcx::XIndexesSupplier,
51 css::sdbcx::XRename,
52 css::lang::XUnoTunnel,
53 css::sdbcx::XAlterTable> OTableDescriptor_BASE;
54 // OTables
55 class ODBTableDecorator;
56 typedef ::comphelper::OIdPropertyArrayUsageHelper< ODBTableDecorator > ODBTableDecorator_PROP;
58 class ODBTableDecorator :public cppu::BaseMutex
59 ,public OTableDescriptor_BASE
60 ,public ODataSettings //ODataSettings_Base
61 ,public IColumnFactory
62 ,public ::connectivity::sdbcx::IRefreshableColumns
63 ,public ODBTableDecorator_PROP
65 void fillPrivileges() const;
66 protected:
67 css::uno::Reference< css::container::XContainerListener > m_xColumnMediator;
68 css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xTable;
69 css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions;
70 css::uno::Reference< css::sdbc::XConnection > m_xConnection;
71 css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
72 css::uno::Reference< css::util::XNumberFormatsSupplier > m_xNumberFormats;
74 // <properties>
75 mutable sal_Int32 m_nPrivileges;
76 // </properties>
77 ::connectivity::sdbcx::OCollection* m_pColumns;
79 // IColumnFactory
80 virtual OColumn* createColumn(const OUString& _rName) const override;
81 virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
82 virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
83 virtual void columnDropped(const OUString& _sName) override;
85 virtual void refreshColumns() override;
87 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId) const override;
88 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
90 // OPropertySetHelper
91 virtual sal_Bool SAL_CALL convertFastPropertyValue(
92 css::uno::Any & rConvertedValue,
93 css::uno::Any & rOldValue,
94 sal_Int32 nHandle,
95 const css::uno::Any& rValue )
96 throw (css::lang::IllegalArgumentException) override;
97 virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle) const override;
98 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
99 sal_Int32 nHandle,
100 const css::uno::Any& rValue
103 throw (css::uno::Exception, std::exception) override;
105 virtual ~ODBTableDecorator() override;
106 public:
107 /** constructs a wrapper supporting the com.sun.star.sdb.Table service.
109 @param _rxConn
110 the connection the table belongs to. Must not be <NULL/>
111 @param _rxTable
112 the table from the driver can be <NULL/>
113 @throws css::sdbc::SQLException
115 ODBTableDecorator(
116 const css::uno::Reference< css::sdbc::XConnection >& _rxConn,
117 const css::uno::Reference< css::sdbcx::XColumnsSupplier >& _rxTable,
118 const css::uno::Reference< css::util::XNumberFormatsSupplier >& _rxNumberFormats,
119 const css::uno::Reference< css::container::XNameAccess >& _rxColumnDefinitions
120 ) throw(css::sdbc::SQLException);
122 // ODescriptor
123 void construct();
125 //XInterface
126 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException, std::exception) override;
127 virtual void SAL_CALL acquire() throw() override;
128 virtual void SAL_CALL release() throw() override;
129 //XTypeProvider
130 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException, std::exception) override;
131 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) override;
133 // OComponentHelper
134 virtual void SAL_CALL disposing() override;
136 // css::lang::XServiceInfo
137 DECLARE_SERVICE_INFO();
138 // XPropertySet
139 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception) override;
140 // css::sdbcx::XRename,
141 virtual void SAL_CALL rename( const OUString& _rNewName ) throw(css::sdbc::SQLException, css::container::ElementExistException, css::uno::RuntimeException, std::exception) override;
143 // css::sdbcx::XAlterTable,
144 virtual void SAL_CALL alterColumnByName( const OUString& _rName, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor ) throw(css::sdbc::SQLException, css::container::NoSuchElementException, css::uno::RuntimeException, std::exception) override;
145 virtual void SAL_CALL alterColumnByIndex( sal_Int32 _nIndex, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor ) throw(css::sdbc::SQLException, css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
147 // XNamed
148 virtual OUString SAL_CALL getName() throw(css::uno::RuntimeException, std::exception) override;
149 virtual void SAL_CALL setName( const OUString& aName ) throw (css::uno::RuntimeException, std::exception) override;
150 // css::lang::XUnoTunnel
151 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException, std::exception) override;
152 static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
154 // XColumnsSupplier
155 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) throw (css::uno::RuntimeException, std::exception) override;
156 // XKeysSupplier
157 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getKeys( ) throw (css::uno::RuntimeException, std::exception) override;
158 // XIndexesSupplier
159 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getIndexes( ) throw (css::uno::RuntimeException, std::exception) override;
160 // XDataDescriptorFactory
161 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw (css::uno::RuntimeException, std::exception) override;
163 protected:
164 using ODataSettings::getFastPropertyValue;
167 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */