build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / dbaccess / source / core / dataaccess / ComponentDefinition.hxx
blob84825edfc355f9dfcff4a20f8ca1390c1e8970ee
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_DATAACCESS_COMPONENTDEFINITION_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
23 #include "commandbase.hxx"
24 #include <comphelper/propertycontainer.hxx>
25 #include <com/sun/star/sdbcx/XRename.hpp>
26 #include <cppuhelper/implbase1.hxx>
27 #include <comphelper/proparrhlp.hxx>
28 #include "datasettings.hxx"
29 #include <com/sun/star/container/XNameAccess.hpp>
30 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
31 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
32 #include <com/sun/star/uno/XComponentContext.hpp>
33 #include "ContentHelper.hxx"
34 #include "apitools.hxx"
35 #include <column.hxx>
37 #include <memory>
38 namespace dbaccess
41 typedef ::cppu::ImplHelper1< css::sdbcx::XColumnsSupplier > OComponentDefinition_BASE;
43 class OComponentDefinition_Impl : public OContentHelper_Impl
44 ,public ODataSettings_Base
46 public:
47 typedef ::std::map < OUString
48 , css::uno::Reference< css::beans::XPropertySet >
49 > Columns;
50 typedef Columns::iterator iterator;
51 typedef Columns::const_iterator const_iterator;
53 private:
54 Columns m_aColumns;
56 public:
57 OUString m_sSchemaName;
58 OUString m_sCatalogName;
60 public:
61 OComponentDefinition_Impl();
62 virtual ~OComponentDefinition_Impl() override;
64 inline size_t size() const { return m_aColumns.size(); }
66 inline const_iterator begin() const { return m_aColumns.begin(); }
67 inline const_iterator end() const { return m_aColumns.end(); }
69 inline const_iterator find( const OUString& _rName ) const { return m_aColumns.find( _rName ); }
71 inline void erase( const OUString& _rName ) { m_aColumns.erase( _rName ); }
73 inline void insert( const OUString& _rName, const css::uno::Reference< css::beans::XPropertySet >& _rxColumn )
75 OSL_PRECOND( m_aColumns.find( _rName ) == m_aColumns.end(), "OComponentDefinition_Impl::insert: there's already an element with this name!" );
76 m_aColumns.insert( Columns::value_type( _rName, _rxColumn ) );
80 class OColumnPropertyListener;
81 // OComponentDefinition - a database "document" which describes a query
82 class OComponentDefinition :public OContentHelper
83 ,public ODataSettings
84 ,public IColumnFactory
85 ,public OComponentDefinition_BASE
86 ,public ::comphelper::OPropertyArrayUsageHelper< OComponentDefinition >
88 protected:
89 rtl::Reference< OColumns > m_xColumns;
90 rtl::Reference<OColumnPropertyListener> m_xColumnPropertyListener;
91 bool m_bTable;
93 virtual ~OComponentDefinition() override;
94 virtual void SAL_CALL disposing() override;
96 const OComponentDefinition_Impl& getDefinition() const { return dynamic_cast< const OComponentDefinition_Impl& >( *m_pImpl.get() ); }
97 OComponentDefinition_Impl& getDefinition() { return dynamic_cast< OComponentDefinition_Impl& >( *m_pImpl.get() ); }
98 public:
99 OComponentDefinition(
100 const css::uno::Reference< css::uno::XComponentContext >&,
101 const css::uno::Reference< css::uno::XInterface >& _xParentContainer,
102 const TContentPtr& _pImpl,
103 bool _bTable = true);
105 OComponentDefinition(
106 const css::uno::Reference< css::uno::XInterface >& _rxContainer
107 ,const OUString& _rElementName
108 ,const css::uno::Reference< css::uno::XComponentContext >&
109 ,const TContentPtr& _pImpl
110 ,bool _bTable = true
113 virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
114 throw (css::uno::RuntimeException, std::exception) override;
115 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
116 throw (css::uno::RuntimeException, std::exception) override;
118 // css::uno::XInterface
119 DECLARE_XINTERFACE( )
121 // css::lang::XServiceInfo
122 virtual OUString SAL_CALL getImplementationName( ) throw(css::uno::RuntimeException, std::exception) override;
123 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException, std::exception) override;
125 // XInitialization
126 virtual void SAL_CALL initialize( css::uno::Sequence< css::uno::Any > const & rArguments) throw (css::uno::Exception, std::exception) override;
128 // css::beans::XPropertySet
129 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception) override;
131 // XColumnsSupplier
132 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) throw (css::uno::RuntimeException, std::exception) override;
134 // OPropertySetHelper
135 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
137 // IColumnFactory
138 virtual OColumn* createColumn(const OUString& _rName) const override;
139 virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
140 virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
141 virtual void columnDropped(const OUString& _sName) override;
142 using OContentHelper::notifyDataSourceModified;
144 protected:
145 // OPropertyArrayUsageHelper
146 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
148 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
149 sal_Int32 nHandle,
150 const css::uno::Any& rValue) throw (css::uno::Exception, std::exception) override;
152 // OContentHelper overridables
153 virtual OUString determineContentType() const override;
155 private:
156 void registerProperties();
159 } // namespace dbaccess
161 #endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */