LibreOffice Module dbaccess (master) 1
TableDeco.hxx
Go to the documentation of this file.
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
20#pragma once
21
22#include <memory>
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/lang/XUnoTunnel.hpp>
32#include <com/sun/star/sdbc/XConnection.hpp>
34#include "datasettings.hxx"
35#include "column.hxx"
36
40
41namespace dbaccess
42{
43 typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier,
44 css::sdbcx::XKeysSupplier,
45 css::container::XNamed,
46 css::lang::XServiceInfo,
47 css::sdbcx::XDataDescriptorFactory,
48 css::sdbcx::XIndexesSupplier,
49 css::sdbcx::XRename,
50 css::lang::XUnoTunnel,
51 css::sdbcx::XAlterTable> OTableDescriptor_BASE;
52 // OTables
54 typedef ::comphelper::OIdPropertyArrayUsageHelper< ODBTableDecorator > ODBTableDecorator_PROP;
55
58 ,public ODataSettings //ODataSettings_Base
59 ,public IColumnFactory
62 {
63 void fillPrivileges() const;
64 css::uno::Reference< css::container::XContainerListener > m_xColumnMediator;
65 css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xTable;
66 css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions;
67 css::uno::Reference< css::sdbc::XConnection > m_xConnection;
68 css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
69 css::uno::Reference< css::util::XNumberFormatsSupplier > m_xNumberFormats;
70
71 // <properties>
72 mutable sal_Int32 m_nPrivileges;
73 // </properties>
74 // note: this thing uses the ref-count of "this", see OCollection::acquire()!
75 std::unique_ptr<::connectivity::sdbcx::OCollection> m_pColumns;
76
77 protected:
78 // IColumnFactory
79 virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
80 virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
81 virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
82 virtual void columnDropped(const OUString& _sName) override;
83
84 virtual void refreshColumns() override;
85
86 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId) const override;
87 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
88
89 // OPropertySetHelper
90 virtual sal_Bool SAL_CALL convertFastPropertyValue(
91 css::uno::Any & rConvertedValue,
92 css::uno::Any & rOldValue,
93 sal_Int32 nHandle,
94 const css::uno::Any& rValue ) override;
95 virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle) const override;
96 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
97 sal_Int32 nHandle,
98 const css::uno::Any& rValue
99 ) override;
100
101 virtual ~ODBTableDecorator() override;
102 public:
112 const css::uno::Reference< css::sdbc::XConnection >& _rxConn,
113 const css::uno::Reference< css::sdbcx::XColumnsSupplier >& _rxTable,
114 const css::uno::Reference< css::util::XNumberFormatsSupplier >& _rxNumberFormats,
115 const css::uno::Reference< css::container::XNameAccess >& _rxColumnDefinitions
116 );
117
118 // ODescriptor
119 void construct();
120
121 //XInterface
122 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
123 virtual void SAL_CALL acquire() noexcept override;
124 virtual void SAL_CALL release() noexcept override;
125 //XTypeProvider
126 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
127 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
128
129 // OComponentHelper
130 virtual void SAL_CALL disposing() override;
131
132 // css::lang::XServiceInfo
134 // XPropertySet
135 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
136 // css::sdbcx::XRename,
137 virtual void SAL_CALL rename( const OUString& _rNewName ) override;
138
139 // css::sdbcx::XAlterTable,
140 virtual void SAL_CALL alterColumnByName( const OUString& _rName, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor ) override;
141 virtual void SAL_CALL alterColumnByIndex( sal_Int32 _nIndex, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor ) override;
142
143 // XNamed
144 virtual OUString SAL_CALL getName() override;
145 virtual void SAL_CALL setName( const OUString& aName ) override;
146 // css::lang::XUnoTunnel
147 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
148 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
149
150 // XColumnsSupplier
151 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
152 // XKeysSupplier
153 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getKeys( ) override;
154 // XIndexesSupplier
155 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getIndexes( ) override;
156 // XDataDescriptorFactory
157 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override;
158
159 protected:
161 };
162}
163
164/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: TableDeco.cxx:92
virtual ::cppu::IPropertyArrayHelper * createArrayHelper(sal_Int32 _nId) const override
Definition: TableDeco.cxx:307
virtual void SAL_CALL acquire() noexcept override
Definition: TableDeco.cxx:619
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getIndexes() override
Definition: TableDeco.cxx:434
virtual void SAL_CALL setName(const OUString &aName) override
Definition: TableDeco.cxx:629
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: TableDeco.cxx:334
virtual void SAL_CALL release() noexcept override
Definition: TableDeco.cxx:624
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: TableDeco.cxx:389
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: TableDeco.cxx:480
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override
creates a column descriptor object.
Definition: TableDeco.cxx:608
css::uno::Reference< css::sdbc::XConnection > m_xConnection
Definition: TableDeco.hxx:67
virtual void refreshColumns() override
Definition: TableDeco.cxx:539
virtual void SAL_CALL rename(const OUString &_rNewName) override
Definition: TableDeco.cxx:397
virtual OUString SAL_CALL getName() override
Definition: TableDeco.cxx:459
virtual void SAL_CALL disposing() override
Definition: TableDeco.cxx:77
css::uno::Reference< css::util::XNumberFormatsSupplier > m_xNumberFormats
Definition: TableDeco.hxx:69
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: TableDeco.cxx:372
css::uno::Reference< css::container::XContainerListener > m_xColumnMediator
Definition: TableDeco.hxx:64
virtual ~ODBTableDecorator() override
Definition: TableDeco.cxx:67
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override
Definition: TableDeco.cxx:448
css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions
Definition: TableDeco.hxx:66
ODBTableDecorator(const css::uno::Reference< css::sdbc::XConnection > &_rxConn, const css::uno::Reference< css::sdbcx::XColumnsSupplier > &_rxTable, const css::uno::Reference< css::util::XNumberFormatsSupplier > &_rxNumberFormats, const css::uno::Reference< css::container::XNameAccess > &_rxColumnDefinitions)
constructs a wrapper supporting the com.sun.star.sdb.Table service.
Definition: TableDeco.cxx:53
std::unique_ptr<::connectivity::sdbcx::OCollection > m_pColumns
Definition: TableDeco.hxx:75
virtual rtl::Reference< OColumn > createColumn(const OUString &_rName) const override
creates an OColumn object which should represent the column with a given name
Definition: TableDeco.cxx:573
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: TableDeco.cxx:211
virtual void SAL_CALL alterColumnByIndex(sal_Int32 _nIndex, const css::uno::Reference< css::beans::XPropertySet > &_rxDescriptor) override
Definition: TableDeco.cxx:421
virtual void SAL_CALL alterColumnByName(const OUString &_rName, const css::uno::Reference< css::beans::XPropertySet > &_rxDescriptor) override
Definition: TableDeco.cxx:409
css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xTable
Definition: TableDeco.hxx:65
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override
Definition: TableDeco.cxx:515
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: TableDeco.cxx:468
virtual void columnAppended(const css::uno::Reference< css::beans::XPropertySet > &_rxSourceDescriptor) override
notifies that a column, created from a column descriptor, has been appended
Definition: TableDeco.cxx:596
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
Definition: TableDeco.hxx:68
virtual void columnDropped(const OUString &_sName) override
notifies that a column with a given name has been dropped
Definition: TableDeco.cxx:601
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getKeys() override
Definition: TableDeco.cxx:441
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: TableDeco.cxx:71
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: TableDeco.cxx:534
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: TableDeco.cxx:142
Type
::cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier, css::sdbcx::XKeysSupplier, css::container::XNamed, css::lang::XServiceInfo, css::sdbcx::XDataDescriptorFactory, css::sdbcx::XIndexesSupplier, css::sdbcx::XRename, css::lang::XUnoTunnel, css::sdbcx::XAlterTable > OTableDescriptor_BASE
Definition: TableDeco.hxx:51
::comphelper::OIdPropertyArrayUsageHelper< ODBTableDecorator > ODBTableDecorator_PROP
Definition: TableDeco.hxx:53
unsigned char sal_Bool
signed char sal_Int8