1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include "querydescriptor.hxx"
23 #include <cppuhelper/implbase3.hxx>
24 #include <rtl/ref.hxx>
25 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
26 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
27 #include <com/sun/star/sdbc/XConnection.hpp>
28 #include <com/sun/star/sdbcx/XRename.hpp>
29 #include <ContentHelper.hxx>
35 class WarningsContainer
;
41 // OQuery - an object implementing the sdb.Query service
42 typedef ::cppu::ImplHelper3
< css::sdbcx::XDataDescriptorFactory
,
43 css::beans::XPropertyChangeListener
,
48 typedef ::comphelper::OPropertyArrayUsageHelper
< OQuery
> OQuery_ArrayHelperBase
;
50 class OQuery
:public OContentHelper
51 ,public OQueryDescriptor_Base
53 ,public OQuery_ArrayHelperBase
56 friend struct TRelease
;
59 css::uno::Reference
< css::beans::XPropertySet
> m_xCommandDefinition
;
60 css::uno::Reference
< css::sdbc::XConnection
> m_xConnection
;
61 css::uno::Reference
< css::beans::XPropertySetInfo
> m_xCommandPropInfo
;
62 ::rtl::Reference
< OContainerMediator
> m_pColumnMediator
;
63 ::dbtools::WarningsContainer
* m_pWarnings
;
65 // possible actions on our "aggregate"
66 enum class AggregateAction
{ NONE
, SettingProperties
};
67 AggregateAction m_eDoingCurrently
;
69 /** a class which automatically resets m_eDoingCurrently in its destructor
71 class OAutoActionReset
; // just for the following friend declaration
72 friend class OAutoActionReset
;
73 class OAutoActionReset
77 explicit OAutoActionReset(OQuery
& _rActor
) : m_rActor(_rActor
) { }
78 ~OAutoActionReset() { m_rActor
.m_eDoingCurrently
= AggregateAction::NONE
; }
82 virtual ~OQuery() override
;
84 // OPropertyArrayUsageHelper
85 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const override
;
86 using OQuery_ArrayHelperBase::getArrayHelper
;
90 const css::uno::Reference
< css::beans::XPropertySet
>& _rxCommandDefinition
,
91 const css::uno::Reference
< css::sdbc::XConnection
>& _rxConn
,
92 const css::uno::Reference
< css::uno::XComponentContext
>& _xORB
95 virtual css::uno::Sequence
<css::uno::Type
> SAL_CALL
getTypes() override
;
96 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId() override
;
98 // css::uno::XInterface
101 // css::beans::XPropertySet
102 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
104 // OPropertySetHelper
105 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
107 // css::lang::XServiceInfo
108 DECLARE_SERVICE_INFO();
110 // css::sdbcx::XDataDescriptorFactory
111 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
createDataDescriptor( ) override
;
113 // css::beans::XPropertyChangeListener
114 virtual void SAL_CALL
propertyChange( const css::beans::PropertyChangeEvent
& evt
) override
;
116 // css::lang::XEventListener
117 virtual void SAL_CALL
disposing( const css::lang::EventObject
& _rSource
) override
;
119 // OPropertySetHelper
120 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
122 const css::uno::Any
& rValue
) override
;
125 // the caller is responsible for the lifetime!
126 void setWarningsContainer( ::dbtools::WarningsContainer
* _pWarnings
) { m_pWarnings
= _pWarnings
; }
129 virtual void SAL_CALL
rename( const OUString
& newName
) override
;
132 virtual void SAL_CALL
disposing() override
;
134 virtual OColumn
* createColumn(const OUString
& _rName
) const override
;
136 virtual void rebuildColumns( ) override
;
138 // OContentHelper overridables
139 virtual OUString
determineContentType() const override
;
142 void registerProperties();
145 } // namespace dbaccess
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */