fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / core / inc / column.hxx
blob00f48ba4c54196df4d5d1720ad456c679947cdfb
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_COLUMN_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
23 #include "columnsettings.hxx"
25 #include <com/sun/star/container/XChild.hpp>
26 #include <com/sun/star/container/XEnumerationAccess.hpp>
27 #include <com/sun/star/container/XIndexAccess.hpp>
28 #include <com/sun/star/container/XNameAccess.hpp>
29 #include <com/sun/star/container/XNamed.hpp>
30 #include <com/sun/star/io/IOException.hpp>
31 #include <com/sun/star/io/XObjectInputStream.hpp>
32 #include <com/sun/star/io/XObjectOutputStream.hpp>
33 #include <com/sun/star/lang/WrappedTargetException.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #include <com/sun/star/sdbc/XResultSet.hpp>
38 #include <com/sun/star/sdbcx/XAppend.hpp>
39 #include <com/sun/star/sdbcx/XDrop.hpp>
40 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
42 #include <comphelper/broadcasthelper.hxx>
43 #include <comphelper/proparrhlp.hxx>
44 #include <comphelper/propertycontainer.hxx>
45 #include <connectivity/CommonTools.hxx>
46 #include <connectivity/FValue.hxx>
47 #include <connectivity/TColumnsHelper.hxx>
48 #include <connectivity/sdbcx/IRefreshable.hxx>
49 #include <cppuhelper/compbase2.hxx>
50 #include <cppuhelper/compbase4.hxx>
51 #include <cppuhelper/implbase1.hxx>
52 #include <cppuhelper/propshlp.hxx>
53 #include <osl/diagnose.h>
55 namespace dbaccess
59 // OColumn
61 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::lang::XServiceInfo,
62 ::com::sun::star::container::XNamed
63 > OColumnBase;
65 class OColumn :public comphelper::OBaseMutex
66 ,public OColumnBase
67 ,public ::comphelper::OPropertyContainer
68 ,public IPropertyContainer // convenience for the derived class which also derive from OColumnSettings
70 friend class OColumns;
72 protected:
73 // <properties>
74 OUString m_sName;
75 // </properties>
77 protected:
78 OColumn( const bool _bNameIsReadOnly );
80 public:
81 virtual ~OColumn();
83 // com::sun::star::lang::XTypeProvider
84 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
87 // com::sun::star::uno::XInterface
88 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
90 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
92 // com::sun::star::beans::XPropertySet
93 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 // cppu::OComponentHelper
96 virtual void SAL_CALL disposing() SAL_OVERRIDE;
98 // ::com::sun::star::lang::XServiceInfo
99 virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 // XNamed
104 virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 virtual void SAL_CALL setName( const OUString& _rName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 virtual void fireValueChange( const ::connectivity::ORowSetValue& _rOldValue );
109 protected:
110 // IPropertyContainer
111 virtual void registerProperty( const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void* _pPointerToMember, const ::com::sun::star::uno::Type& _rMemberType ) SAL_OVERRIDE;
112 virtual void registerMayBeVoidProperty( const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, ::com::sun::star::uno::Any* _pPointerToMember, const ::com::sun::star::uno::Type& _rExpectedType ) SAL_OVERRIDE;
113 virtual void registerPropertyNoMember( const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const ::com::sun::star::uno::Type& _rType, const void* _pInitialValue ) SAL_OVERRIDE;
116 // IColumnFactory - used by OColumns for creating new columns
117 class SAL_NO_VTABLE IColumnFactory
119 public:
120 /** creates a OColumn object which should represent the column with a given name
122 virtual OColumn*
123 createColumn( const OUString& _rName ) const = 0;
125 /** creates a column descriptor object.
127 A column descriptor object is used to append new columns to the collection. If such an append
128 actually happened, columnAppended is called afterwards.
130 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor() = 0;
132 /** notifies that a column, created from a column descriptor, has been appended
134 virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor ) = 0;
136 /** notifies that a column with a given name has been dropped
138 virtual void columnDropped( const OUString& _sName ) = 0;
140 protected:
141 ~IColumnFactory() {}
144 class OContainerMediator;
145 typedef ::cppu::ImplHelper1< ::com::sun::star::container::XChild > TXChild;
146 typedef connectivity::OColumnsHelper OColumns_BASE;
148 class OColumns : public OColumns_BASE
149 ,public TXChild
151 OContainerMediator* m_pMediator;
153 protected:
154 // comes from the driver can be null
155 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xDrvColumns;
156 ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > m_xParent;
157 IColumnFactory* m_pColFactoryImpl;
158 ::connectivity::sdbcx::IRefreshableColumns* m_pRefreshColumns;
160 bool m_bInitialized : 1;
161 bool m_bAddColumn : 1;
162 bool m_bDropColumn : 1;
164 virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
165 virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) SAL_OVERRIDE;
166 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor() SAL_OVERRIDE;
167 virtual connectivity::sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) SAL_OVERRIDE;
168 virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) SAL_OVERRIDE;
170 public:
171 connectivity::sdbcx::ObjectType createBaseObject(const OUString& _rName)
173 return OColumns_BASE::createObject(_rName);
175 /** flag which determines whether the container is filled or not
177 inline bool isInitialized() const { return m_bInitialized; }
178 inline void setInitialized() {m_bInitialized = true;}
179 inline void setMediator(OContainerMediator* _pMediator) { m_pMediator = _pMediator; }
181 public:
182 /** constructs an empty container without configuration location.
183 @param rParent the parent object. This instance will be used for refcounting, so the parent
184 cannot die before the container does.
185 @param _rMutex the mutex of the parent.
186 @param _bCaseSensitive the initial case sensitivity flag
187 @see setCaseSensitive
189 OColumns(
190 ::cppu::OWeakObject& _rParent,
191 ::osl::Mutex& _rMutex,
192 bool _bCaseSensitive,
193 const ::std::vector< OUString>& _rVector,
194 IColumnFactory* _pColFactory,
195 ::connectivity::sdbcx::IRefreshableColumns* _pRefresh,
196 bool _bAddColumn = false,
197 bool _bDropColumn = false,
198 bool _bUseHardRef = true);
200 OColumns(
201 ::cppu::OWeakObject& _rParent,
202 ::osl::Mutex& _rMutex,
203 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxDrvColumns,
204 bool _bCaseSensitive,
205 const ::std::vector< OUString> &_rVector,
206 IColumnFactory* _pColFactory,
207 ::connectivity::sdbcx::IRefreshableColumns* _pRefresh,
208 bool _bAddColumn = false,
209 bool _bDropColumn = false,
210 bool _bUseHardRef = true);
211 virtual ~OColumns();
213 //XInterface
214 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OColumns_BASE::acquire(); }
216 virtual void SAL_CALL release() throw() SAL_OVERRIDE { OColumns_BASE::release(); }
217 //XTypeProvider
218 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
220 // ::com::sun::star::lang::XServiceInfo
221 virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
222 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
223 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
225 // ::com::sun::star::container::XChild
226 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
227 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
229 void append(const OUString& rName, OColumn*);
230 void clearColumns();
231 // only the name is identical to ::cppu::OComponentHelper
232 virtual void SAL_CALL disposing() SAL_OVERRIDE;
234 private:
235 using OColumns_BASE::setParent;
238 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */