tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / core / dataaccess / ComponentDefinition.hxx
blob4c10a5354b308f3fcb8ee817868360f868cf3aad
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 #pragma once
22 #include <commandbase.hxx>
23 #include <com/sun/star/sdbcx/XRename.hpp>
24 #include <cppuhelper/implbase1.hxx>
25 #include <comphelper/proparrhlp.hxx>
26 #include <rtl/ref.hxx>
27 #include <datasettings.hxx>
28 #include <com/sun/star/container/XNameAccess.hpp>
29 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
30 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <ContentHelper.hxx>
33 #include <apitools.hxx>
34 #include <column.hxx>
36 #include <memory>
37 namespace dbaccess
40 typedef ::cppu::ImplHelper1< css::sdbcx::XColumnsSupplier > OComponentDefinition_BASE;
42 class OComponentDefinition_Impl : public OContentHelper_Impl
43 ,public ODataSettings_Base
45 public:
46 typedef std::map < OUString
47 , css::uno::Reference< css::beans::XPropertySet >
48 > Columns;
49 typedef Columns::iterator iterator;
50 typedef Columns::const_iterator const_iterator;
52 private:
53 Columns m_aColumns;
55 public:
56 OUString m_sSchemaName;
57 OUString m_sCatalogName;
59 public:
60 OComponentDefinition_Impl();
61 virtual ~OComponentDefinition_Impl() override;
63 size_t size() const { return m_aColumns.size(); }
65 const_iterator begin() const { return m_aColumns.begin(); }
66 const_iterator end() const { return m_aColumns.end(); }
68 const_iterator find( const OUString& _rName ) const { return m_aColumns.find( _rName ); }
70 void erase( const OUString& _rName ) { m_aColumns.erase( _rName ); }
72 void insert( const OUString& _rName, const css::uno::Reference< css::beans::XPropertySet >& _rxColumn )
74 OSL_PRECOND( m_aColumns.find( _rName ) == m_aColumns.end(), "OComponentDefinition_Impl::insert: there's already an element with this name!" );
75 m_aColumns.emplace( _rName, _rxColumn );
79 class OColumnPropertyListener;
80 // OComponentDefinition - a database "document" which describes a query
81 class OComponentDefinition :public OContentHelper
82 ,public ODataSettings
83 ,public IColumnFactory
84 ,public OComponentDefinition_BASE
85 ,public ::comphelper::OPropertyArrayUsageHelper< OComponentDefinition >
87 // no Reference! see OCollection::acquire
88 std::unique_ptr<OColumns> m_pColumns;
89 rtl::Reference<OColumnPropertyListener> m_xColumnPropertyListener;
90 bool m_bTable;
92 protected:
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 ); }
97 OComponentDefinition_Impl& getDefinition() { return dynamic_cast< OComponentDefinition_Impl& >( *m_pImpl ); }
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() override;
114 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
116 // css::uno::XInterface
117 DECLARE_XINTERFACE( )
119 // css::lang::XServiceInfo
120 virtual OUString SAL_CALL getImplementationName( ) override;
121 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
123 // XInitialization
124 virtual void SAL_CALL initialize( css::uno::Sequence< css::uno::Any > const & rArguments) override;
126 // css::beans::XPropertySet
127 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
129 // XColumnsSupplier
130 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
132 // OPropertySetHelper
133 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
135 // IColumnFactory
136 virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
137 virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
138 virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
139 virtual void columnDropped(const OUString& _sName) override;
140 using OContentHelper::notifyDataSourceModified;
142 protected:
143 // OPropertyArrayUsageHelper
144 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
146 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
147 sal_Int32 nHandle,
148 const css::uno::Any& rValue) override;
150 // OContentHelper overridables
151 virtual OUString determineContentType() const override;
153 private:
154 void registerProperties();
157 } // namespace dbaccess
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */