calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / dbaccess / source / core / inc / DatabaseDataProvider.hxx
blob8c2029634b8a1ef029c5f52e101eb4c2b54719b8
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 .
19 #pragma once
21 #include <sal/config.h>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
26 #include <com/sun/star/chart2/XInternalDataProvider.hpp>
27 #include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
28 #include <com/sun/star/sdbc/XRowSet.hpp>
29 #include <com/sun/star/container/XChild.hpp>
31 #include <cppuhelper/compbase.hxx>
32 #include <cppuhelper/basemutex.hxx>
33 #include <cppuhelper/propertysetmixin.hxx>
35 #include <connectivity/parameters.hxx>
36 #include <connectivity/filtermanager.hxx>
39 namespace dbaccess
42 typedef ::cppu::WeakComponentImplHelper< css::chart2::data::XDatabaseDataProvider
43 , css::container::XChild
44 , css::chart::XComplexDescriptionAccess
45 , css::lang::XServiceInfo > TDatabaseDataProvider;
47 class DatabaseDataProvider: private ::cppu::BaseMutex,
48 public TDatabaseDataProvider,
49 public ::cppu::PropertySetMixin< css::chart2::data::XDatabaseDataProvider >
51 public:
52 explicit DatabaseDataProvider(css::uno::Reference< css::uno::XComponentContext > const & context);
54 private:
55 // css::uno::XInterface:
56 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override;
57 virtual void SAL_CALL acquire() noexcept override
58 { TDatabaseDataProvider::acquire(); }
59 virtual void SAL_CALL release() noexcept override
60 { TDatabaseDataProvider::release(); }
62 // css::lang::XServiceInfo
63 virtual OUString SAL_CALL getImplementationName( ) override;
64 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
65 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
67 // css::chart2::data::XDataProvider:
68 virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence< css::beans::PropertyValue > & aArguments) override;
69 virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(const css::uno::Sequence< css::beans::PropertyValue > & aArguments) override;
70 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource) override;
71 virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString & aRangeRepresentation) override;
72 virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const OUString & aRangeRepresentation) override;
74 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
75 createDataSequenceByValueArray(
76 const OUString& aRole, const OUString & aRangeRepresentation, const OUString& aRoleQualifier) override;
78 virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override;
80 // css::chart2::data::XRangeXMLConversion:
81 virtual OUString SAL_CALL convertRangeToXML(const OUString & aRangeRepresentation) override;
82 virtual OUString SAL_CALL convertRangeFromXML(const OUString & aXMLRange) override;
84 // css::lang::XInitialization:
85 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override;
87 // css::beans::XPropertySet:
88 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
89 virtual void SAL_CALL setPropertyValue(const OUString & aPropertyName, const css::uno::Any & aValue) override;
90 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString & PropertyName) override;
91 virtual void SAL_CALL addPropertyChangeListener(const OUString & aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > & xListener) override;
92 virtual void SAL_CALL removePropertyChangeListener(const OUString & aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > & aListener) override;
93 virtual void SAL_CALL addVetoableChangeListener(const OUString & PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) override;
94 virtual void SAL_CALL removeVetoableChangeListener(const OUString & PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) override;
96 // css::chart2::data::XDatabaseDataProvider:
97 virtual css::uno::Sequence< OUString > SAL_CALL getMasterFields() override;
98 virtual void SAL_CALL setMasterFields(const css::uno::Sequence< OUString > & the_value) override;
99 virtual css::uno::Sequence< OUString > SAL_CALL getDetailFields() override;
100 virtual void SAL_CALL setDetailFields(const css::uno::Sequence< OUString > & the_value) override;
101 virtual OUString SAL_CALL getCommand() override;
102 virtual void SAL_CALL setCommand(const OUString & the_value) override;
103 virtual ::sal_Int32 SAL_CALL getCommandType() override;
104 virtual void SAL_CALL setCommandType(::sal_Int32 the_value) override;
105 virtual OUString SAL_CALL getFilter() override;
106 virtual void SAL_CALL setFilter(const OUString & the_value) override;
107 virtual sal_Bool SAL_CALL getApplyFilter() override;
108 virtual void SAL_CALL setApplyFilter( sal_Bool _applyfilter ) override;
109 virtual OUString SAL_CALL getHavingClause() override;
110 virtual void SAL_CALL setHavingClause( const OUString& _havingclause ) override;
111 virtual OUString SAL_CALL getGroupBy() override;
112 virtual void SAL_CALL setGroupBy( const OUString& _groupby ) override;
113 virtual OUString SAL_CALL getOrder() override;
114 virtual void SAL_CALL setOrder( const OUString& _order ) override;
115 virtual sal_Bool SAL_CALL getEscapeProcessing() override;
116 virtual void SAL_CALL setEscapeProcessing(sal_Bool the_value) override;
117 virtual ::sal_Int32 SAL_CALL getRowLimit() override;
118 virtual void SAL_CALL setRowLimit( ::sal_Int32 _rowlimit ) override;
119 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getActiveConnection() override;
120 virtual void SAL_CALL setActiveConnection(const css::uno::Reference< css::sdbc::XConnection > & the_value) override;
121 virtual OUString SAL_CALL getDataSourceName() override;
122 virtual void SAL_CALL setDataSourceName( const OUString& _datasourcename ) override;
124 // css::sdbc::XParameters
125 virtual void SAL_CALL setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) override;
126 virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName) override;
127 virtual void SAL_CALL setBoolean(sal_Int32 parameterIndex, sal_Bool x) override;
128 virtual void SAL_CALL setByte(sal_Int32 parameterIndex, sal_Int8 x) override;
129 virtual void SAL_CALL setShort(sal_Int32 parameterIndex, sal_Int16 x) override;
130 virtual void SAL_CALL setInt(sal_Int32 parameterIndex, sal_Int32 x) override;
131 virtual void SAL_CALL setLong(sal_Int32 parameterIndex, sal_Int64 x) override;
132 virtual void SAL_CALL setFloat(sal_Int32 parameterIndex, float x) override;
133 virtual void SAL_CALL setDouble(sal_Int32 parameterIndex, double x) override;
134 virtual void SAL_CALL setString(sal_Int32 parameterIndex, const OUString& x) override;
135 virtual void SAL_CALL setBytes(sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x) override;
136 virtual void SAL_CALL setDate(sal_Int32 parameterIndex, const css::util::Date& x) override;
137 virtual void SAL_CALL setTime(sal_Int32 parameterIndex, const css::util::Time& x) override;
138 virtual void SAL_CALL setTimestamp(sal_Int32 parameterIndex, const css::util::DateTime& x) override;
139 virtual void SAL_CALL setBinaryStream(sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream>& x, sal_Int32 length) override;
140 virtual void SAL_CALL setCharacterStream(sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream>& x, sal_Int32 length) override;
141 virtual void SAL_CALL setObject(sal_Int32 parameterIndex, const css::uno::Any& x) override;
142 virtual void SAL_CALL setObjectWithInfo(sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) override;
143 virtual void SAL_CALL setRef(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef>& x) override;
144 virtual void SAL_CALL setBlob(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob>& x) override;
145 virtual void SAL_CALL setClob(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob>& x) override;
146 virtual void SAL_CALL setArray(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray>& x) override;
147 virtual void SAL_CALL clearParameters() override;
149 // css::sdbc::XRowSet
150 virtual void SAL_CALL execute() override;
151 virtual void SAL_CALL addRowSetListener(const css::uno::Reference< css::sdbc::XRowSetListener>& _rxListener) override;
152 virtual void SAL_CALL removeRowSetListener(const css::uno::Reference< css::sdbc::XRowSetListener>& _rxListener) override;
154 // css::sdbc::XResultSet
155 virtual sal_Bool SAL_CALL next() override;
156 virtual sal_Bool SAL_CALL isBeforeFirst() override;
157 virtual sal_Bool SAL_CALL isAfterLast() override;
158 virtual sal_Bool SAL_CALL isFirst() override;
159 virtual sal_Bool SAL_CALL isLast() override;
160 virtual void SAL_CALL beforeFirst() override;
161 virtual void SAL_CALL afterLast() override;
162 virtual sal_Bool SAL_CALL first() override;
163 virtual sal_Bool SAL_CALL last() override;
164 virtual sal_Int32 SAL_CALL getRow() override;
165 virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override;
166 virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override;
167 virtual sal_Bool SAL_CALL previous() override;
168 virtual void SAL_CALL refreshRow() override;
169 virtual sal_Bool SAL_CALL rowUpdated() override;
170 virtual sal_Bool SAL_CALL rowInserted() override;
171 virtual sal_Bool SAL_CALL rowDeleted() override;
172 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override;
174 // container::XChild
175 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
176 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
178 // ____ XComplexDescriptionAccess ____
179 virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexRowDescriptions() override;
180 virtual void SAL_CALL setComplexRowDescriptions( const css::uno::Sequence< css::uno::Sequence< OUString > >& aRowDescriptions ) override;
181 virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexColumnDescriptions() override;
182 virtual void SAL_CALL setComplexColumnDescriptions( const css::uno::Sequence< css::uno::Sequence< OUString > >& aColumnDescriptions ) override;
184 // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
185 virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override;
186 virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
187 virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
188 virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override;
189 virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
190 virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
192 // ____ XChartData (base of XChartDataArray) ____
193 virtual void SAL_CALL addChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
194 virtual void SAL_CALL removeChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
195 virtual double SAL_CALL getNotANumber() override;
196 virtual sal_Bool SAL_CALL isNotANumber(double nNumber ) override;
197 private:
198 DatabaseDataProvider(DatabaseDataProvider const &) = delete;
199 DatabaseDataProvider& operator =(DatabaseDataProvider const &) = delete;
201 virtual ~DatabaseDataProvider() override {}
203 // This function is called upon disposing the component,
204 // if your component needs special work when it becomes
205 // disposed, do it here.
206 virtual void SAL_CALL disposing() override;
208 void impl_fillRowSet_throw();
209 bool impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies);
210 void impl_fillInternalDataProvider_throw(bool _bHasCategories,const css::uno::Sequence< OUString >& i_aColumnNames);
211 void impl_invalidateParameter_nothrow();
212 css::uno::Any impl_getNumberFormatKey_nothrow(const OUString & _sRangeRepresentation) const;
214 template <typename T> void set( const OUString& _sProperty
215 ,const T& Value
216 ,T& _member)
218 BoundListeners l;
220 ::osl::MutexGuard aGuard(m_aMutex);
221 if ( _member != Value )
223 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
224 _member = Value;
227 l.notify();
230 ::dbtools::ParameterManager m_aParameterManager;
231 ::dbtools::FilterManager m_aFilterManager;
232 std::map< OUString, css::uno::Any> m_aNumberFormats;
234 css::uno::Reference< css::uno::XComponentContext > m_xContext;
235 css::uno::Reference< css::sdbc::XConnection > m_xActiveConnection;
236 css::uno::Reference< css::sdbc::XRowSet > m_xRowSet;
237 css::uno::Reference< css::chart2::XInternalDataProvider > m_xInternal;
238 css::uno::Reference< css::chart::XComplexDescriptionAccess > m_xComplexDescriptionAccess;
239 css::uno::Reference< css::chart2::data::XRangeXMLConversion> m_xRangeConversion;
240 css::uno::Reference< css::task::XInteractionHandler> m_xHandler;
241 // the object doin' most of the work - an SDB-rowset
242 css::uno::Reference< css::uno::XAggregation> m_xAggregate;
243 css::uno::Reference< css::beans::XPropertySet> m_xAggregateSet;
244 css::uno::Reference< css::uno::XInterface> m_xParent;
245 css::uno::Sequence< OUString > m_MasterFields;
246 css::uno::Sequence< OUString > m_DetailFields;
248 OUString m_Command;
249 OUString m_DataSourceName;
250 sal_Int32 m_CommandType;
251 sal_Int32 m_RowLimit;
252 OUString m_Filter;
253 OUString m_HavingClause;
254 OUString m_Order;
255 OUString m_GroupBy;
256 bool m_EscapeProcessing;
257 bool m_ApplyFilter;
260 } // namespace dbaccess
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */