LibreOffice Module dbaccess (master) 1
column.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 "columnsettings.hxx"
23
24#include <com/sun/star/container/XChild.hpp>
25#include <com/sun/star/container/XNameAccess.hpp>
26#include <com/sun/star/container/XNamed.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
28
35
36namespace dbaccess
37{
38
39
40 // OColumn
41
42 typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo,
43 css::container::XNamed
45
47 ,public OColumnBase
49 ,public IPropertyContainer // convenience for the derived class which also derive from OColumnSettings
50 {
51 friend class OColumns;
52
53 protected:
54 // <properties>
55 OUString m_sName;
56 // </properties>
57
58 protected:
59 OColumn( const bool _bNameIsReadOnly );
60
61 public:
62 virtual ~OColumn() override;
63
64 // css::lang::XTypeProvider
65 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
66 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override = 0;
67
68 // css::uno::XInterface
69 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
70 virtual void SAL_CALL acquire() noexcept override;
71 virtual void SAL_CALL release() noexcept override;
72
73 // css::beans::XPropertySet
74 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
75
76 // cppu::OComponentHelper
77 virtual void SAL_CALL disposing() override;
78
79 // css::lang::XServiceInfo
80 virtual OUString SAL_CALL getImplementationName( ) override;
81 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
83
84 // XNamed
85 virtual OUString SAL_CALL getName( ) override;
86 virtual void SAL_CALL setName( const OUString& _rName ) override;
87
88 protected:
89 // IPropertyContainer
90 virtual void registerProperty( const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void* _pPointerToMember, const css::uno::Type& _rMemberType ) override;
91 virtual void registerMayBeVoidProperty( const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, css::uno::Any* _pPointerToMember, const css::uno::Type& _rExpectedType ) override;
92 };
93
94 // IColumnFactory - used by OColumns for creating new columns
95 class SAL_NO_VTABLE IColumnFactory
96 {
97 public:
101 createColumn( const OUString& _rName ) const = 0;
102
108 virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() = 0;
109
112 virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) = 0;
113
116 virtual void columnDropped( const OUString& _sName ) = 0;
117
118 protected:
120 };
121
122 class OContainerMediator;
123 typedef ::cppu::ImplHelper1< css::container::XChild > TXChild;
125
126 class OColumns : public OColumns_BASE
127 ,public TXChild
128 {
130
131 // comes from the driver can be null
132 css::uno::Reference< css::container::XNameAccess > m_xDrvColumns;
133 css::uno::WeakReference< css::uno::XInterface > m_xParent;
136
138 bool m_bAddColumn : 1;
140
141 protected:
142 virtual void impl_refresh() override;
143 virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
144 virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
145 virtual connectivity::sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
146 virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
147
148 public:
150 {
151 return OColumns_BASE::createObject(_rName);
152 }
155 bool isInitialized() const { return m_bInitialized; }
156 void setInitialized() {m_bInitialized = true;}
157 void setMediator(OContainerMediator* _pMediator) { m_pMediator = _pMediator; }
158
159 public:
167 OColumns(
168 ::cppu::OWeakObject& _rParent,
169 ::osl::Mutex& _rMutex,
170 bool _bCaseSensitive,
171 const std::vector< OUString>& _rVector,
172 IColumnFactory* _pColFactory,
174 bool _bAddColumn = false,
175 bool _bDropColumn = false,
176 bool _bUseHardRef = true);
177
178 OColumns(
179 ::cppu::OWeakObject& _rParent,
180 ::osl::Mutex& _rMutex,
181 css::uno::Reference< css::container::XNameAccess > _xDrvColumns,
182 bool _bCaseSensitive,
183 const std::vector< OUString> &_rVector,
184 IColumnFactory* _pColFactory,
186 bool _bAddColumn = false,
187 bool _bDropColumn = false,
188 bool _bUseHardRef = true);
189 virtual ~OColumns() override;
190
191 //XInterface
192 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
193 virtual void SAL_CALL acquire() noexcept override { OColumns_BASE::acquire(); }
194 virtual void SAL_CALL release() noexcept override { OColumns_BASE::release(); }
195 //XTypeProvider
196 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
197
198 // css::lang::XServiceInfo
199 virtual OUString SAL_CALL getImplementationName( ) override;
200 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
201 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
202
203 // css::container::XChild
204 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
205 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
206
207 void append(const OUString& rName, OColumn*);
208 void clearColumns();
209 // only the name is identical to ::cppu::OComponentHelper
210 virtual void disposing() override;
211
212 private:
214 };
215}
216
217/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sdbcx::ObjectType createObject(const OUString &_rName) override
void setParent(OTableHelper *_pTable)
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual void columnAppended(const css::uno::Reference< css::beans::XPropertySet > &_rxSourceDescriptor)=0
notifies that a column, created from a column descriptor, has been appended
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor()=0
creates a column descriptor object.
virtual rtl::Reference< OColumn > createColumn(const OUString &_rName) const =0
creates an OColumn object which should represent the column with a given name
virtual void columnDropped(const OUString &_sName)=0
notifies that a column with a given name has been dropped
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override=0
OUString m_sName
Definition: column.hxx:55
virtual ~OColumn() override
OContainerMediator * m_pMediator
Definition: column.hxx:129
virtual void SAL_CALL acquire() noexcept override
Definition: column.hxx:193
virtual void SAL_CALL release() noexcept override
Definition: column.hxx:194
IColumnFactory * m_pColFactoryImpl
Definition: column.hxx:134
virtual connectivity::sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
::connectivity::sdbcx::IRefreshableColumns * m_pRefreshColumns
Definition: column.hxx:135
void setInitialized()
Definition: column.hxx:156
bool isInitialized() const
flag which determines whether the container is filled or not
Definition: column.hxx:155
void setMediator(OContainerMediator *_pMediator)
Definition: column.hxx:157
connectivity::sdbcx::ObjectType createBaseObject(const OUString &_rName)
Definition: column.hxx:149
css::uno::WeakReference< css::uno::XInterface > m_xParent
Definition: column.hxx:133
css::uno::Reference< css::container::XNameAccess > m_xDrvColumns
Definition: column.hxx:132
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
Type
css::uno::Reference< css::beans::XPropertySet > ObjectType
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, css::container::XNamed > OColumnBase
Definition: column.hxx:44
connectivity::OColumnsHelper OColumns_BASE
Definition: column.hxx:124
::cppu::ImplHelper1< css::container::XChild > TXChild
Definition: column.hxx:122
unsigned char sal_Bool