merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / core / api / query.hxx
blob2e2e54ceebc0b89f365ca082068767b8c96b9388
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: query.hxx,v $
10 * $Revision: 1.20 $
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_QUERY_HXX_
32 #define _DBA_COREAPI_QUERY_HXX_
34 #ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
35 #include "querydescriptor.hxx"
36 #endif
37 #ifndef _CPPUHELPER_IMPLBASE3_HXX_
38 #include <cppuhelper/implbase3.hxx>
39 #endif
40 #ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
41 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
44 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
45 #endif
46 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
47 #include <com/sun/star/sdbc/XConnection.hpp>
48 #endif
49 #ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
50 #include <com/sun/star/sdbcx/XRename.hpp>
51 #endif
52 #ifndef DBA_CONTENTHELPER_HXX
53 #include "ContentHelper.hxx"
54 #endif
56 #include <map>
58 namespace dbtools
60 class IWarningsContainer;
63 //........................................................................
64 namespace dbaccess
66 //........................................................................
68 //==========================================================================
69 //= OQuery - an object implementing the sdb.Query service
70 //==========================================================================
71 typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbcx::XDataDescriptorFactory,
72 ::com::sun::star::beans::XPropertyChangeListener,
73 ::com::sun::star::sdbcx::XRename
74 > OQuery_Base;
75 class OQuery;
76 class OColumn;
77 typedef ::comphelper::OPropertyArrayUsageHelper< OQuery > OQuery_ArrayHelperBase;
80 class OQuery :public OContentHelper
81 ,public OQueryDescriptor_Base
82 ,public OQuery_Base
83 ,public OQuery_ArrayHelperBase
84 ,public ODataSettings
86 friend struct TRelease;
88 public:
89 typedef ::std::map< ::rtl::OUString,OColumn*,::comphelper::UStringMixLess> TNameColumnMap;
91 protected:
92 // TNameColumnMap m_aColumnMap; // contains all columnnames to columns
93 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xCommandDefinition;
94 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
95 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xCommandPropInfo;
96 ::rtl::Reference< OContainerMediator > m_pColumnMediator;
97 ::dbtools::IWarningsContainer* m_pWarnings;
98 sal_Bool m_bCaseSensitiv : 1; // assume case sensitivity of the column names ?
100 // possible actions on our "aggregate"
101 enum AGGREGATE_ACTION { NONE, SETTING_PROPERTIES, FLUSHING };
102 AGGREGATE_ACTION m_eDoingCurrently;
104 // ------------------------------------------------------------------------
105 /** a class which automatically resets m_eDoingCurrently in it's destructor
107 class OAutoActionReset; // just for the following friend declaration
108 friend class OAutoActionReset;
109 class OAutoActionReset
111 OQuery* m_pActor;
112 public:
113 OAutoActionReset(OQuery* _pActor) : m_pActor(_pActor) { }
114 ~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; }
117 protected:
118 virtual ~OQuery();
120 // OPropertyArrayUsageHelper
121 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
122 ::cppu::IPropertyArrayHelper* getArrayHelper() { return OQuery_ArrayHelperBase::getArrayHelper(); }
124 public:
125 OQuery(
126 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxCommandDefinition,
127 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn,
128 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
131 // com::sun::star::lang::XTypeProvider
132 DECLARE_TYPEPROVIDER( );
134 // ::com::sun::star::uno::XInterface
135 DECLARE_XINTERFACE( )
137 // ::com::sun::star::beans::XPropertySet
138 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
140 // OPropertySetHelper
141 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
143 // ::com::sun::star::lang::XServiceInfo
144 DECLARE_SERVICE_INFO();
146 // ::com::sun::star::sdbcx::XDataDescriptorFactory
147 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
149 // ::com::sun::star::beans::XPropertyChangeListener
150 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
152 // ::com::sun::star::lang::XEventListener
153 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
155 // OPropertySetHelper
156 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
157 sal_Int32 nHandle,
158 const ::com::sun::star::uno::Any& rValue )
159 throw (::com::sun::star::uno::Exception);
161 public:
162 // the caller is responsible for the lifetime!
163 void setWarningsContainer( ::dbtools::IWarningsContainer* _pWarnings ) { m_pWarnings = _pWarnings; }
164 ::dbtools::IWarningsContainer* getWarningsContainer( ) const { return m_pWarnings; }
166 // XRename
167 virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
169 protected:
170 virtual void SAL_CALL disposing();
172 virtual OColumn* createColumn(const ::rtl::OUString& _rName) const;
174 virtual void rebuildColumns( );
176 // OContentHelper overridables
177 virtual ::rtl::OUString determineContentType() const;
179 private:
180 void registerProperties();
183 //........................................................................
184 } // namespace dbaccess
185 //........................................................................
187 #endif // _DBA_COREAPI_QUERY_HXX_