1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _DBA_CORE_QUERYCONTAINER_HXX_ 25*b1cdbd2cSJim Jagielski #define _DBA_CORE_QUERYCONTAINER_HXX_ 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #ifndef _CPPUHELPER_IMPLBASE5_HXX_ 28*b1cdbd2cSJim Jagielski #include <cppuhelper/implbase5.hxx> 29*b1cdbd2cSJim Jagielski #endif 30*b1cdbd2cSJim Jagielski #ifndef _COMPHELPER_STLTYPES_HXX_ 31*b1cdbd2cSJim Jagielski #include <comphelper/stl_types.hxx> 32*b1cdbd2cSJim Jagielski #endif 33*b1cdbd2cSJim Jagielski #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ 34*b1cdbd2cSJim Jagielski #include <cppuhelper/interfacecontainer.hxx> 35*b1cdbd2cSJim Jagielski #endif 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski /** === begin UNO includes == **/ 38*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 39*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/XPropertySet.hpp> 40*b1cdbd2cSJim Jagielski #endif 41*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ 42*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XEnumerationAccess.hpp> 43*b1cdbd2cSJim Jagielski #endif 44*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_ 45*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XContainerListener.hpp> 46*b1cdbd2cSJim Jagielski #endif 47*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ 48*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XNameContainer.hpp> 49*b1cdbd2cSJim Jagielski #endif 50*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 51*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XNameAccess.hpp> 52*b1cdbd2cSJim Jagielski #endif 53*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ 54*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XIndexAccess.hpp> 55*b1cdbd2cSJim Jagielski #endif 56*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_ 57*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XContainer.hpp> 58*b1cdbd2cSJim Jagielski #endif 59*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_ 60*b1cdbd2cSJim Jagielski #include <com/sun/star/util/XRefreshable.hpp> 61*b1cdbd2cSJim Jagielski #endif 62*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ 63*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XServiceInfo.hpp> 64*b1cdbd2cSJim Jagielski #endif 65*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ 66*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/Sequence.hxx> 67*b1cdbd2cSJim Jagielski #endif 68*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ 69*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XNameContainer.hpp> 70*b1cdbd2cSJim Jagielski #endif 71*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ 72*b1cdbd2cSJim Jagielski #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> 73*b1cdbd2cSJim Jagielski #endif 74*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ 75*b1cdbd2cSJim Jagielski #include <com/sun/star/sdbcx/XAppend.hpp> 76*b1cdbd2cSJim Jagielski #endif 77*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_ 78*b1cdbd2cSJim Jagielski #include <com/sun/star/sdbcx/XDrop.hpp> 79*b1cdbd2cSJim Jagielski #endif 80*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 81*b1cdbd2cSJim Jagielski #include <com/sun/star/sdbc/XConnection.hpp> 82*b1cdbd2cSJim Jagielski #endif 83*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_ 84*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/XPropertyChangeListener.hpp> 85*b1cdbd2cSJim Jagielski #endif 86*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERAPPROVELISTENER_HPP_ 87*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XContainerApproveListener.hpp> 88*b1cdbd2cSJim Jagielski #endif 89*b1cdbd2cSJim Jagielski /** === end UNO includes === **/ 90*b1cdbd2cSJim Jagielski 91*b1cdbd2cSJim Jagielski #ifndef _DBA_CORE_DEFINITIONCONTAINER_HXX_ 92*b1cdbd2cSJim Jagielski #include "definitioncontainer.hxx" 93*b1cdbd2cSJim Jagielski #endif 94*b1cdbd2cSJim Jagielski #ifndef _DBASHARED_APITOOLS_HXX_ 95*b1cdbd2cSJim Jagielski #include "apitools.hxx" 96*b1cdbd2cSJim Jagielski #endif 97*b1cdbd2cSJim Jagielski 98*b1cdbd2cSJim Jagielski namespace dbtools 99*b1cdbd2cSJim Jagielski { 100*b1cdbd2cSJim Jagielski class IWarningsContainer; 101*b1cdbd2cSJim Jagielski } 102*b1cdbd2cSJim Jagielski 103*b1cdbd2cSJim Jagielski //........................................................................ 104*b1cdbd2cSJim Jagielski namespace dbaccess 105*b1cdbd2cSJim Jagielski { 106*b1cdbd2cSJim Jagielski //........................................................................ 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener 109*b1cdbd2cSJim Jagielski , ::com::sun::star::container::XContainerApproveListener 110*b1cdbd2cSJim Jagielski , ::com::sun::star::sdbcx::XDataDescriptorFactory 111*b1cdbd2cSJim Jagielski , ::com::sun::star::sdbcx::XAppend 112*b1cdbd2cSJim Jagielski , ::com::sun::star::sdbcx::XDrop 113*b1cdbd2cSJim Jagielski > OQueryContainer_Base; 114*b1cdbd2cSJim Jagielski 115*b1cdbd2cSJim Jagielski //========================================================================== 116*b1cdbd2cSJim Jagielski //= OQueryContainer 117*b1cdbd2cSJim Jagielski //========================================================================== 118*b1cdbd2cSJim Jagielski class OQueryContainer; 119*b1cdbd2cSJim Jagielski class OContainerListener; 120*b1cdbd2cSJim Jagielski class OQuery; 121*b1cdbd2cSJim Jagielski class OQueryContainer : public ODefinitionContainer 122*b1cdbd2cSJim Jagielski , public OQueryContainer_Base 123*b1cdbd2cSJim Jagielski { 124*b1cdbd2cSJim Jagielski protected: 125*b1cdbd2cSJim Jagielski ::dbtools::IWarningsContainer* m_pWarnings; 126*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > 127*b1cdbd2cSJim Jagielski m_xCommandDefinitions; 128*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > 129*b1cdbd2cSJim Jagielski m_xConnection; 130*b1cdbd2cSJim Jagielski // possible actions on our "aggregate" 131*b1cdbd2cSJim Jagielski enum AGGREGATE_ACTION { NONE, INSERTING, FLUSHING }; 132*b1cdbd2cSJim Jagielski AGGREGATE_ACTION m_eDoingCurrently; 133*b1cdbd2cSJim Jagielski 134*b1cdbd2cSJim Jagielski OContainerListener* m_pCommandsListener; 135*b1cdbd2cSJim Jagielski 136*b1cdbd2cSJim Jagielski // ------------------------------------------------------------------------ 137*b1cdbd2cSJim Jagielski /** a class which automatically resets m_eDoingCurrently in it's destructor 138*b1cdbd2cSJim Jagielski */ 139*b1cdbd2cSJim Jagielski class OAutoActionReset; // just for the following friend declaration 140*b1cdbd2cSJim Jagielski friend class OAutoActionReset; 141*b1cdbd2cSJim Jagielski class OAutoActionReset 142*b1cdbd2cSJim Jagielski { 143*b1cdbd2cSJim Jagielski OQueryContainer* m_pActor; 144*b1cdbd2cSJim Jagielski public: OAutoActionReset(OQueryContainer * _pActor)145*b1cdbd2cSJim Jagielski OAutoActionReset(OQueryContainer* _pActor) : m_pActor(_pActor) { } ~OAutoActionReset()146*b1cdbd2cSJim Jagielski ~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; } 147*b1cdbd2cSJim Jagielski }; 148*b1cdbd2cSJim Jagielski 149*b1cdbd2cSJim Jagielski // ODefinitionContainer 150*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject( const ::rtl::OUString& _rName); 151*b1cdbd2cSJim Jagielski virtual sal_Bool checkExistence(const ::rtl::OUString& _rName); 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski // helper 154*b1cdbd2cSJim Jagielski virtual void SAL_CALL disposing(); 155*b1cdbd2cSJim Jagielski virtual ~OQueryContainer(); 156*b1cdbd2cSJim Jagielski public: 157*b1cdbd2cSJim Jagielski /** ctor of the container. The parent has to support the <type scope="com::sun::star::sdbc">XConnection</type> 158*b1cdbd2cSJim Jagielski interface.<BR> 159*b1cdbd2cSJim Jagielski 160*b1cdbd2cSJim Jagielski @param _pWarnings 161*b1cdbd2cSJim Jagielski specifies a warnings container (May be <NULL/>) 162*b1cdbd2cSJim Jagielski 163*b1cdbd2cSJim Jagielski Any errors which occur during the lifetime of the query container, 164*b1cdbd2cSJim Jagielski which cannot be reported as exceptionts (for instance in methods where throwing an SQLException is 165*b1cdbd2cSJim Jagielski not allowed) will be appended to this container.</p> 166*b1cdbd2cSJim Jagielski <p>The caller is responsible for ensuring the lifetime of the object pointed to by this parameter. 167*b1cdbd2cSJim Jagielski */ 168*b1cdbd2cSJim Jagielski OQueryContainer( 169*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxCommandDefinitions, 170*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, 171*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 172*b1cdbd2cSJim Jagielski ::dbtools::IWarningsContainer* _pWarnings 173*b1cdbd2cSJim Jagielski ); 174*b1cdbd2cSJim Jagielski 175*b1cdbd2cSJim Jagielski DECLARE_XINTERFACE( ) 176*b1cdbd2cSJim Jagielski DECLARE_XTYPEPROVIDER( ) 177*b1cdbd2cSJim Jagielski DECLARE_SERVICE_INFO(); 178*b1cdbd2cSJim Jagielski 179*b1cdbd2cSJim Jagielski // ::com::sun::star::container::XContainerListener 180*b1cdbd2cSJim Jagielski virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 181*b1cdbd2cSJim Jagielski virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 182*b1cdbd2cSJim Jagielski virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 183*b1cdbd2cSJim Jagielski 184*b1cdbd2cSJim Jagielski // XContainerApproveListener 185*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveInsertElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 186*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveReplaceElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 187*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveRemoveElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 188*b1cdbd2cSJim Jagielski 189*b1cdbd2cSJim Jagielski // ::com::sun::star::lang::XEventListener 190*b1cdbd2cSJim Jagielski virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 191*b1cdbd2cSJim Jagielski 192*b1cdbd2cSJim Jagielski // ::com::sun::star::sdbcx::XDataDescriptorFactory 193*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); 194*b1cdbd2cSJim Jagielski 195*b1cdbd2cSJim Jagielski // ::com::sun::star::sdbcx::XAppend 196*b1cdbd2cSJim Jagielski virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); 197*b1cdbd2cSJim Jagielski 198*b1cdbd2cSJim Jagielski // ::com::sun::star::sdbcx::XDrop 199*b1cdbd2cSJim Jagielski virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); 200*b1cdbd2cSJim Jagielski virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 201*b1cdbd2cSJim Jagielski 202*b1cdbd2cSJim Jagielski // ::com::sun::star::container::XElementAccess 203*b1cdbd2cSJim Jagielski virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); 204*b1cdbd2cSJim Jagielski // ::com::sun::star::container::XIndexAccess 205*b1cdbd2cSJim Jagielski virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException); 206*b1cdbd2cSJim Jagielski // ::com::sun::star::container::XNameAccess 207*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); 208*b1cdbd2cSJim Jagielski 209*b1cdbd2cSJim Jagielski protected: 210*b1cdbd2cSJim Jagielski // OContentHelper overridables 211*b1cdbd2cSJim Jagielski virtual ::rtl::OUString determineContentType() const; 212*b1cdbd2cSJim Jagielski 213*b1cdbd2cSJim Jagielski private: 214*b1cdbd2cSJim Jagielski // helper 215*b1cdbd2cSJim Jagielski /** create a query object wrapping a CommandDefinition given by name. To retrieve the object, the CommandDescription 216*b1cdbd2cSJim Jagielski container will be asked for the given name.<BR> 217*b1cdbd2cSJim Jagielski The returned object is acquired once. 218*b1cdbd2cSJim Jagielski */ 219*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > implCreateWrapper(const ::rtl::OUString& _rName); 220*b1cdbd2cSJim Jagielski /// create a query object wrapping a CommandDefinition. The returned object is acquired once. 221*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > implCreateWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _rxCommandDesc); 222*b1cdbd2cSJim Jagielski 223*b1cdbd2cSJim Jagielski }; 224*b1cdbd2cSJim Jagielski //........................................................................ 225*b1cdbd2cSJim Jagielski } // namespace dbaccess 226*b1cdbd2cSJim Jagielski //........................................................................ 227*b1cdbd2cSJim Jagielski 228*b1cdbd2cSJim Jagielski #endif // _DBA_CORE_QUERYCONTAINER_HXX_ 229*b1cdbd2cSJim Jagielski 230*b1cdbd2cSJim Jagielski 231