merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / core / api / querydescriptor.hxx
blob14a4d9c0366cd89d0bb9e2dc53c9002b8fda940e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: querydescriptor.hxx,v $
10 * $Revision: 1.18 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
32 #define _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
34 #ifndef _CPPUHELPER_IMPLBASE3_HXX_
35 #include <cppuhelper/implbase3.hxx>
36 #endif
37 #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
38 #include <comphelper/proparrhlp.hxx>
39 #endif
40 #ifndef _OSL_MUTEX_HXX_
41 #include <osl/mutex.hxx>
42 #endif
44 #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
45 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
46 #endif
47 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
48 #include <com/sun/star/lang/XServiceInfo.hpp>
49 #endif
50 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
51 #include <com/sun/star/lang/XUnoTunnel.hpp>
52 #endif
54 #ifndef _DBASHARED_APITOOLS_HXX_
55 #include "apitools.hxx"
56 #endif
57 #ifndef _DBA_COREAPI_COLUMN_HXX_
58 #include "column.hxx"
59 #endif
60 #ifndef _DBA_CORE_DATASETTINGS_HXX_
61 #include "datasettings.hxx"
62 #endif
63 #ifndef _DBA_CORE_COMMANDBASE_HXX_
64 #include "commandbase.hxx"
65 #endif
66 #ifndef _COMPHELPER_BROADCASTHELPER_HXX_
67 #include <comphelper/broadcasthelper.hxx>
68 #endif
69 #ifndef _COMPHELPER_UNO3_HXX_
70 #include <comphelper/uno3.hxx>
71 #endif
73 //........................................................................
74 namespace dbaccess
76 //........................................................................
78 //==========================================================================
79 //= OQueryDescriptor_Base - a query descriptor (as the name suggests :)
80 //==========================================================================
81 typedef ::cppu::ImplHelper3<
82 ::com::sun::star::sdbcx::XColumnsSupplier,
83 ::com::sun::star::lang::XUnoTunnel,
84 ::com::sun::star::lang::XServiceInfo > OQueryDescriptor_BASE;
86 class OQueryDescriptor_Base
87 :public OQueryDescriptor_BASE
88 ,public OCommandBase
89 ,public IColumnFactory
90 ,public ::connectivity::sdbcx::IRefreshableColumns
92 private:
93 sal_Bool m_bColumnsOutOfDate : 1; // the columns have to be rebuild on the next getColumns ?
94 ::osl::Mutex& m_rMutex;
96 protected:
97 OColumns* m_pColumns; // our column descriptions
98 ::rtl::OUString m_sElementName;
99 virtual ~OQueryDescriptor_Base();
101 void setColumnsOutOfDate( sal_Bool _bOutOfDate = sal_True );
102 sal_Bool isColumnsOutOfDate() const { return m_bColumnsOutOfDate; }
104 sal_Int32 getColumnCount() const { return m_pColumns ? m_pColumns->getCount() : 0; }
105 void clearColumns( );
107 void implAppendColumn( const ::rtl::OUString& _rName, OColumn* _pColumn );
109 public:
110 OQueryDescriptor_Base(::osl::Mutex& _rMutex,::cppu::OWeakObject& _rMySelf);
111 /** constructs the object with a UNO QueryDescriptor. If you use this ctor, the resulting object
112 won't have any column informations (the column container will be empty)
114 OQueryDescriptor_Base(const OQueryDescriptor_Base& _rSource,::cppu::OWeakObject& _rMySelf);
116 // ::com::sun::star::sdbcx::XColumnsSupplier
117 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
119 // ::com::sun::star::lang::XUnoTunnel
120 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
121 DECLARE_IMPLEMENTATION_ID( );
123 // ::com::sun::star::lang::XServiceInfo
124 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
125 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
126 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
128 protected:
130 // IColumnFactory
131 virtual OColumn* createColumn(const ::rtl::OUString& _rName) const;
132 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor();
133 virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor );
134 virtual void columnDropped(const ::rtl::OUString& _sName);
136 /** rebuild our columns set
138 clearColumns has already been called before, do <em>NOT</em> call it, again
140 virtual void rebuildColumns( );
142 virtual void disposeColumns();
144 // IRefreshableColumns overridables
145 virtual void refreshColumns();
148 class OQueryDescriptor : public comphelper::OMutexAndBroadcastHelper
149 ,public ::cppu::OWeakObject
150 ,public OQueryDescriptor_Base
151 ,public ::comphelper::OPropertyArrayUsageHelper< OQueryDescriptor_Base >
152 ,public ODataSettings
154 OQueryDescriptor(const OQueryDescriptor&);
155 void operator =(const OQueryDescriptor&);
156 // helper
157 void registerProperties();
158 protected:
159 // OPropertyArrayUsageHelper
160 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
162 // OPropertySetHelper
163 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
165 virtual ~OQueryDescriptor();
166 public:
167 OQueryDescriptor();
168 /** constructs the object with a UNO QueryDescriptor. If you use this ctor, the resulting object
169 won't have any column informations (the column container will be empty)
171 OQueryDescriptor(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForeignDescriptor);
172 OQueryDescriptor(const OQueryDescriptor_Base& _rSource);
174 // com::sun::star::lang::XTypeProvider
175 DECLARE_TYPEPROVIDER( );
177 // ::com::sun::star::uno::XInterface
178 DECLARE_XINTERFACE( )
180 // ::com::sun::star::beans::XPropertySet
181 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
184 //........................................................................
185 } // namespace dbaccess
186 //........................................................................
188 #endif // _DBA_COREAPI_QUERYDESCRIPTOR_HXX_