xref: /AOO41X/main/dbaccess/source/core/misc/DatabaseDataProvider.cxx (revision 96de54900b79e13b861fbc62cbf36018b54e21b7)
1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
24cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "DatabaseDataProvider.hxx"
27cdf0e10cSrcweir #include "dbastrings.hrc"
28cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx"
29cdf0e10cSrcweir #include <comphelper/types.hxx>
30cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx>
31cdf0e10cSrcweir #include <connectivity/FValue.hxx>
32cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
33cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
34cdf0e10cSrcweir #include <rtl/math.hxx>
35cdf0e10cSrcweir #include <tools/diagnose_ex.h>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
38cdf0e10cSrcweir #include <com/sun/star/sdb/XCompletedExecution.hpp>
39cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
40cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp>
41cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp>
42cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp>
43cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
44cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
45cdf0e10cSrcweir #include <com/sun/star/sdbc/XColumnLocate.hpp>
46cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
47cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp>
48cdf0e10cSrcweir #include <com/sun/star/chart/XChartDataArray.hpp>
49cdf0e10cSrcweir #include <com/sun/star/chart/XDateCategories.hpp>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <vector>
52cdf0e10cSrcweir #include <list>
53cdf0e10cSrcweir 
54cdf0e10cSrcweir namespace dbaccess
55cdf0e10cSrcweir {
56cdf0e10cSrcweir using namespace ::com::sun::star;
57cdf0e10cSrcweir using ::com::sun::star::sdbc::SQLException;
58cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
59cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException;
60cdf0e10cSrcweir // -----------------------------------------------------------------------------
DatabaseDataProvider(uno::Reference<uno::XComponentContext> const & context)61cdf0e10cSrcweir DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContext > const & context) :
62cdf0e10cSrcweir     TDatabaseDataProvider(m_aMutex),
63cdf0e10cSrcweir     ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >(
64cdf0e10cSrcweir         context, static_cast< Implements >(
65cdf0e10cSrcweir             IMPLEMENTS_PROPERTY_SET), uno::Sequence< ::rtl::OUString >()),
66cdf0e10cSrcweir     m_aParameterManager( m_aMutex, uno::Reference< lang::XMultiServiceFactory >(context->getServiceManager(),uno::UNO_QUERY) ),
67cdf0e10cSrcweir     m_aFilterManager( uno::Reference< lang::XMultiServiceFactory >(context->getServiceManager(),uno::UNO_QUERY) ),
68cdf0e10cSrcweir     m_xContext(context),
69cdf0e10cSrcweir     m_CommandType(sdb::CommandType::COMMAND), // #i94114
70cdf0e10cSrcweir     m_RowLimit(0),
71cdf0e10cSrcweir     m_EscapeProcessing(sal_True),
72cdf0e10cSrcweir     m_ApplyFilter(sal_True)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir     m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart.InternalDataProvider")),m_xContext ), uno::UNO_QUERY );
75cdf0e10cSrcweir     m_xRangeConversion.set(m_xInternal,uno::UNO_QUERY);
76cdf0e10cSrcweir     m_xComplexDescriptionAccess.set(m_xInternal,uno::UNO_QUERY);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     osl_incrementInterlockedCount( &m_refCount );
79cdf0e10cSrcweir     {
80cdf0e10cSrcweir         m_xRowSet.set( m_xContext->getServiceManager()->createInstanceWithContext(SERVICE_SDB_ROWSET,m_xContext ), uno::UNO_QUERY );
81cdf0e10cSrcweir         m_xAggregate.set(m_xRowSet,uno::UNO_QUERY);
82cdf0e10cSrcweir         m_xAggregateSet.set(m_xRowSet,uno::UNO_QUERY);
83cdf0e10cSrcweir         uno::Reference<beans::XPropertySet> xProp(static_cast< ::cppu::OWeakObject* >( this ),uno::UNO_QUERY);
84cdf0e10cSrcweir         m_aFilterManager.initialize( m_xAggregateSet );
85cdf0e10cSrcweir         m_aParameterManager.initialize( xProp, m_xAggregate );
86cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::makeAny(m_CommandType));
87cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::makeAny(m_EscapeProcessing));
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir     osl_decrementInterlockedCount( &m_refCount );
90cdf0e10cSrcweir }
91cdf0e10cSrcweir // -----------------------------------------------------------------------------
disposing()92cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::disposing()
93cdf0e10cSrcweir {
94cdf0e10cSrcweir     lang::EventObject aEvt(static_cast<XWeak*>(this));
95cdf0e10cSrcweir     m_aParameterManager.disposing( aEvt );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     m_aParameterManager.dispose();   // (to free any references it may have to me)
98cdf0e10cSrcweir     m_aFilterManager.dispose();      // (dito)
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     m_xParent.clear();
101cdf0e10cSrcweir     m_xAggregateSet.clear();
102cdf0e10cSrcweir     m_xAggregate.clear();
103cdf0e10cSrcweir     m_xRangeConversion.clear();
104cdf0e10cSrcweir     ::comphelper::disposeComponent(m_xRowSet);
105cdf0e10cSrcweir     ::comphelper::disposeComponent(m_xInternal);
106cdf0e10cSrcweir     m_xActiveConnection.clear();
107cdf0e10cSrcweir }
108cdf0e10cSrcweir // -----------------------------------------------------------------------------
queryInterface(uno::Type const & type)109cdf0e10cSrcweir uno::Any DatabaseDataProvider::queryInterface(uno::Type const & type) throw (uno::RuntimeException)
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     return TDatabaseDataProvider::queryInterface(type);
112cdf0e10cSrcweir }
113cdf0e10cSrcweir // -----------------------------------------------------------------------------
114cdf0e10cSrcweir 
115cdf0e10cSrcweir //------------------------------------------------------------------------------
getImplementationName_Static()116cdf0e10cSrcweir rtl::OUString DatabaseDataProvider::getImplementationName_Static(  ) throw(uno::RuntimeException)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	return rtl::OUString::createFromAscii("com.sun.star.comp.chart2.data.DatabaseDataProvider");
119cdf0e10cSrcweir }
120cdf0e10cSrcweir // -----------------------------------------------------------------------------
121cdf0e10cSrcweir // -------------------------------------------------------------------------
122cdf0e10cSrcweir // XServiceInfo
getImplementationName()123cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getImplementationName(  ) throw(uno::RuntimeException)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir 	return getImplementationName_Static();
126cdf0e10cSrcweir }
127cdf0e10cSrcweir // -----------------------------------------------------------------------------
128cdf0e10cSrcweir // -------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)129cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException)
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 	return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir // -----------------------------------------------------------------------------
134cdf0e10cSrcweir //------------------------------------------------------------------------------
getSupportedServiceNames_Static()135cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > DatabaseDataProvider::getSupportedServiceNames_Static(  ) throw (uno::RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 	uno::Sequence< rtl::OUString > aSNS( 1 );
138cdf0e10cSrcweir     aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DatabaseDataProvider"));
139cdf0e10cSrcweir 	return aSNS;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSupportedServiceNames()142cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL DatabaseDataProvider::getSupportedServiceNames(  ) throw(uno::RuntimeException)
143cdf0e10cSrcweir {
144cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
145cdf0e10cSrcweir }
146cdf0e10cSrcweir // -----------------------------------------------------------------------------
Create(uno::Reference<uno::XComponentContext> const & context)147cdf0e10cSrcweir uno::Reference< uno::XInterface > DatabaseDataProvider::Create(uno::Reference< uno::XComponentContext > const & context)
148cdf0e10cSrcweir {
149cdf0e10cSrcweir 	return *(new DatabaseDataProvider(context)) ;
150cdf0e10cSrcweir }
151cdf0e10cSrcweir // -----------------------------------------------------------------------------
152cdf0e10cSrcweir // lang::XInitialization:
initialize(const uno::Sequence<uno::Any> & aArguments)153cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > & aArguments) throw (uno::RuntimeException, uno::Exception)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
156cdf0e10cSrcweir     const uno::Any* pIter   = aArguments.getConstArray();
157cdf0e10cSrcweir     const uno::Any* pEnd    = pIter + aArguments.getLength();
158cdf0e10cSrcweir     for(;pIter != pEnd;++pIter)
159cdf0e10cSrcweir     {
160cdf0e10cSrcweir         if ( !m_xActiveConnection.is() )
161cdf0e10cSrcweir             (*pIter) >>= m_xActiveConnection;
162cdf0e10cSrcweir         else if ( !m_xHandler.is() )
163cdf0e10cSrcweir             (*pIter) >>= m_xHandler;
164cdf0e10cSrcweir     }
165cdf0e10cSrcweir     m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::makeAny( m_xActiveConnection ) );
166cdf0e10cSrcweir }
167cdf0e10cSrcweir // -----------------------------------------------------------------------------
168cdf0e10cSrcweir 
169cdf0e10cSrcweir // chart2::data::XDataProvider:
createDataSourcePossible(const uno::Sequence<beans::PropertyValue> & _aArguments)170cdf0e10cSrcweir ::sal_Bool SAL_CALL DatabaseDataProvider::createDataSourcePossible(const uno::Sequence< beans::PropertyValue > & _aArguments) throw (uno::RuntimeException)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir     //::osl::ResettableMutexGuard aClearForNotifies(m_aMutex);
173cdf0e10cSrcweir     const beans::PropertyValue* pArgIter = _aArguments.getConstArray();
174cdf0e10cSrcweir     const beans::PropertyValue* pArgEnd  = pArgIter + _aArguments.getLength();
175cdf0e10cSrcweir     for(;pArgIter != pArgEnd;++pArgIter)
176cdf0e10cSrcweir     {
177cdf0e10cSrcweir         if ( pArgIter->Name.equalsAscii("DataRowSource") )
178cdf0e10cSrcweir         {
179cdf0e10cSrcweir             ::com::sun::star::chart::ChartDataRowSource eRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
180cdf0e10cSrcweir             pArgIter->Value >>= eRowSource;
181cdf0e10cSrcweir             if ( eRowSource != ::com::sun::star::chart::ChartDataRowSource_COLUMNS )
182cdf0e10cSrcweir                 return sal_False;
183cdf0e10cSrcweir         } // if ( pArgIter->Name.equalsAscii("DataRowSource") )
184cdf0e10cSrcweir         else if ( pArgIter->Name.equalsAscii("CellRangeRepresentation") )
185cdf0e10cSrcweir         {
186cdf0e10cSrcweir             ::rtl::OUString sRange;
187cdf0e10cSrcweir             pArgIter->Value >>= sRange;
188cdf0e10cSrcweir             if ( !sRange.equalsAscii("all") )
189cdf0e10cSrcweir                 return sal_False;
190cdf0e10cSrcweir         }
191cdf0e10cSrcweir         else if ( pArgIter->Name.equalsAscii("FirstCellAsLabel") )
192cdf0e10cSrcweir         {
193cdf0e10cSrcweir             sal_Bool bFirstCellAsLabel = sal_True;
194cdf0e10cSrcweir             pArgIter->Value >>= bFirstCellAsLabel;
195cdf0e10cSrcweir             if ( !bFirstCellAsLabel )
196cdf0e10cSrcweir                 return sal_False;
197cdf0e10cSrcweir         }
198cdf0e10cSrcweir     }
199cdf0e10cSrcweir     return sal_True;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir // -----------------------------------------------------------------------------
202cdf0e10cSrcweir // -----------------------------------------------------------------------------
createDataSource(const uno::Sequence<beans::PropertyValue> & _aArguments)203cdf0e10cSrcweir uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::createDataSource(const uno::Sequence< beans::PropertyValue > & _aArguments) throw (uno::RuntimeException, lang::IllegalArgumentException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir     osl::ResettableMutexGuard aClearForNotifies(m_aMutex);
206cdf0e10cSrcweir     if ( createDataSourcePossible(_aArguments) )
207cdf0e10cSrcweir     {
208cdf0e10cSrcweir         try
209cdf0e10cSrcweir         {
210cdf0e10cSrcweir             uno::Reference< chart::XChartDataArray> xChartData( m_xInternal, uno::UNO_QUERY_THROW );
211cdf0e10cSrcweir             xChartData->setData( uno::Sequence< uno::Sequence< double > >() );
212cdf0e10cSrcweir             xChartData->setColumnDescriptions( uno::Sequence< ::rtl::OUString >() );
213cdf0e10cSrcweir 		    if ( m_xInternal->hasDataByRangeRepresentation( ::rtl::OUString::valueOf( sal_Int32(0) ) ) )
214cdf0e10cSrcweir 			    m_xInternal->deleteSequence(0);
215cdf0e10cSrcweir         }
216cdf0e10cSrcweir         catch( const uno::Exception& )
217cdf0e10cSrcweir         {
218cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
219cdf0e10cSrcweir         }
220cdf0e10cSrcweir 
221cdf0e10cSrcweir         ::comphelper::NamedValueCollection aArgs( _aArguments );
222cdf0e10cSrcweir         const sal_Bool bHasCategories = aArgs.getOrDefault( "HasCategories", sal_True );
223cdf0e10cSrcweir         uno::Sequence< ::rtl::OUString > aColumnNames =
224cdf0e10cSrcweir             aArgs.getOrDefault( "ColumnDescriptions", uno::Sequence< ::rtl::OUString >() );
225cdf0e10cSrcweir 
226cdf0e10cSrcweir         bool bRet = false;
227cdf0e10cSrcweir         if ( m_Command.getLength() != 0 && m_xActiveConnection.is() )
228cdf0e10cSrcweir         {
229cdf0e10cSrcweir             try
230cdf0e10cSrcweir             {
231cdf0e10cSrcweir                 impl_fillRowSet_throw();
232cdf0e10cSrcweir                 impl_executeRowSet_throw(aClearForNotifies);
233cdf0e10cSrcweir                 impl_fillInternalDataProvider_throw(bHasCategories,aColumnNames);
234cdf0e10cSrcweir                 bRet = true;
235cdf0e10cSrcweir             }
236cdf0e10cSrcweir             catch(const uno::Exception& /*e*/)
237cdf0e10cSrcweir             {
238cdf0e10cSrcweir             }
239cdf0e10cSrcweir         }
240cdf0e10cSrcweir         if ( !bRet ) // no command set or an error occured, use Internal data handler
241cdf0e10cSrcweir         {
242cdf0e10cSrcweir             uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY);
243cdf0e10cSrcweir             if ( xIni.is() )
244cdf0e10cSrcweir             {
245cdf0e10cSrcweir                 uno::Sequence< uno::Any > aInitArgs(1);
246cdf0e10cSrcweir                 beans::NamedValue aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True));
247cdf0e10cSrcweir                 aInitArgs[0] <<= aParam;
248cdf0e10cSrcweir                 xIni->initialize(aInitArgs);
249cdf0e10cSrcweir             }
250cdf0e10cSrcweir         }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir     }
253cdf0e10cSrcweir     return m_xInternal->createDataSource(_aArguments);
254cdf0e10cSrcweir }
255cdf0e10cSrcweir // -----------------------------------------------------------------------------
256cdf0e10cSrcweir 
detectArguments(const uno::Reference<chart2::data::XDataSource> & _xDataSource)257cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArguments(const uno::Reference< chart2::data::XDataSource > & _xDataSource) throw (uno::RuntimeException)
258cdf0e10cSrcweir {
259cdf0e10cSrcweir     ::comphelper::NamedValueCollection aArguments;
260cdf0e10cSrcweir     aArguments.put( "CellRangeRepresentation", uno::Any( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "all" ) ) ) );
261cdf0e10cSrcweir     aArguments.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
262cdf0e10cSrcweir     // internal data always contains labels and categories
263cdf0e10cSrcweir     aArguments.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     sal_Bool bHasCategories = sal_False;
266cdf0e10cSrcweir     if( _xDataSource.is())
267cdf0e10cSrcweir     {
268cdf0e10cSrcweir         uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences(_xDataSource->getDataSequences());
269cdf0e10cSrcweir         const sal_Int32 nCount( aSequences.getLength());
270cdf0e10cSrcweir         for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx )
271cdf0e10cSrcweir         {
272cdf0e10cSrcweir             if( aSequences[nIdx].is() )
273cdf0e10cSrcweir             {
274cdf0e10cSrcweir                 uno::Reference< beans::XPropertySet > xSeqProp( aSequences[nIdx]->getValues(), uno::UNO_QUERY );
275cdf0e10cSrcweir                 ::rtl::OUString aRole;
276cdf0e10cSrcweir                 if  (   xSeqProp.is()
277cdf0e10cSrcweir                     &&  ( xSeqProp->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" ) ) ) >>= aRole )
278cdf0e10cSrcweir                     &&  aRole.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "categories" ) )
279cdf0e10cSrcweir                     )
280cdf0e10cSrcweir                 {
281cdf0e10cSrcweir                     bHasCategories = sal_True;
282cdf0e10cSrcweir                     break;
283cdf0e10cSrcweir                 }
284cdf0e10cSrcweir             }
285cdf0e10cSrcweir         }
286cdf0e10cSrcweir     }
287cdf0e10cSrcweir     aArguments.put( "HasCategories", uno::makeAny( bHasCategories ) );
288cdf0e10cSrcweir     return aArguments.getPropertyValues();
289cdf0e10cSrcweir }
290cdf0e10cSrcweir // -----------------------------------------------------------------------------
291cdf0e10cSrcweir 
createDataSequenceByRangeRepresentationPossible(const::rtl::OUString &)292cdf0e10cSrcweir ::sal_Bool SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentationPossible(const ::rtl::OUString & /*aRangeRepresentation*/) throw (uno::RuntimeException)
293cdf0e10cSrcweir {
294cdf0e10cSrcweir     return sal_True;
295cdf0e10cSrcweir }
296cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_getNumberFormatKey_nothrow(const::rtl::OUString & _sRangeRepresentation) const297cdf0e10cSrcweir uno::Any DatabaseDataProvider::impl_getNumberFormatKey_nothrow(const ::rtl::OUString & _sRangeRepresentation) const
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     ::std::map< ::rtl::OUString,com::sun::star::uno::Any>::const_iterator aFind = m_aNumberFormats.find(_sRangeRepresentation);
300cdf0e10cSrcweir     if ( aFind != m_aNumberFormats.end() )
301cdf0e10cSrcweir         return aFind->second;
302cdf0e10cSrcweir     return uno::makeAny(sal_Int32(0));
303cdf0e10cSrcweir }
304cdf0e10cSrcweir // -----------------------------------------------------------------------------
createDataSequenceByRangeRepresentation(const::rtl::OUString & _sRangeRepresentation)305cdf0e10cSrcweir uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentation(const ::rtl::OUString & _sRangeRepresentation) throw (uno::RuntimeException, lang::IllegalArgumentException)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
308cdf0e10cSrcweir     uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation);;
309cdf0e10cSrcweir     uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY);
310cdf0e10cSrcweir     const static ::rtl::OUString s_sNumberFormatKey(RTL_CONSTASCII_USTRINGPARAM("NumberFormatKey"));
311cdf0e10cSrcweir     if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) )
312cdf0e10cSrcweir     {
313cdf0e10cSrcweir         xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation));
314cdf0e10cSrcweir     }
315cdf0e10cSrcweir     return xData;
316cdf0e10cSrcweir }
317cdf0e10cSrcweir 
getComplexRowDescriptions()318cdf0e10cSrcweir uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
319cdf0e10cSrcweir {
320cdf0e10cSrcweir     return m_xComplexDescriptionAccess->getComplexRowDescriptions();
321cdf0e10cSrcweir }
setComplexRowDescriptions(const uno::Sequence<uno::Sequence<::rtl::OUString>> & aRowDescriptions)322cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setComplexRowDescriptions( const uno::Sequence< uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (uno::RuntimeException)
323cdf0e10cSrcweir {
324cdf0e10cSrcweir     m_xComplexDescriptionAccess->setComplexRowDescriptions(aRowDescriptions);
325cdf0e10cSrcweir }
getComplexColumnDescriptions()326cdf0e10cSrcweir uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir     return m_xComplexDescriptionAccess->getComplexColumnDescriptions();
329cdf0e10cSrcweir }
setComplexColumnDescriptions(const uno::Sequence<uno::Sequence<rtl::OUString>> & aColumnDescriptions)330cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setComplexColumnDescriptions( const uno::Sequence< uno::Sequence< rtl::OUString > >& aColumnDescriptions ) throw (uno::RuntimeException)
331cdf0e10cSrcweir {
332cdf0e10cSrcweir     m_xComplexDescriptionAccess->setComplexColumnDescriptions(aColumnDescriptions);
333cdf0e10cSrcweir }
334cdf0e10cSrcweir // ____ XChartDataArray ____
getData()335cdf0e10cSrcweir uno::Sequence< uno::Sequence< double > > SAL_CALL DatabaseDataProvider::getData()    throw (uno::RuntimeException)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir     return m_xComplexDescriptionAccess->getData();
338cdf0e10cSrcweir }
339cdf0e10cSrcweir 
setData(const uno::Sequence<uno::Sequence<double>> & rDataInRows)340cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setData( const uno::Sequence< uno::Sequence< double > >& rDataInRows )    throw (uno::RuntimeException)
341cdf0e10cSrcweir {
342cdf0e10cSrcweir     m_xComplexDescriptionAccess->setData(rDataInRows);
343cdf0e10cSrcweir }
344cdf0e10cSrcweir 
setRowDescriptions(const uno::Sequence<rtl::OUString> & aRowDescriptions)345cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setRowDescriptions( const uno::Sequence< rtl::OUString >& aRowDescriptions )    throw (uno::RuntimeException)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir     m_xComplexDescriptionAccess->setRowDescriptions(aRowDescriptions);
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
setColumnDescriptions(const uno::Sequence<rtl::OUString> & aColumnDescriptions)350cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setColumnDescriptions( const uno::Sequence< rtl::OUString >& aColumnDescriptions )    throw (uno::RuntimeException)
351cdf0e10cSrcweir {
352cdf0e10cSrcweir     m_xComplexDescriptionAccess->setColumnDescriptions(aColumnDescriptions);
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
getRowDescriptions()355cdf0e10cSrcweir uno::Sequence< rtl::OUString > SAL_CALL DatabaseDataProvider::getRowDescriptions()    throw (uno::RuntimeException)
356cdf0e10cSrcweir {
357cdf0e10cSrcweir     return m_xComplexDescriptionAccess->getRowDescriptions();
358cdf0e10cSrcweir }
359cdf0e10cSrcweir 
getColumnDescriptions()360cdf0e10cSrcweir uno::Sequence< rtl::OUString > SAL_CALL DatabaseDataProvider::getColumnDescriptions()    throw (uno::RuntimeException)
361cdf0e10cSrcweir {
362cdf0e10cSrcweir     return m_xComplexDescriptionAccess->getColumnDescriptions();
363cdf0e10cSrcweir }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir // ____ XChartData (base of XChartDataArray) ____
addChartDataChangeEventListener(const uno::Reference<::com::sun::star::chart::XChartDataChangeEventListener> & x)366cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::addChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x)    throw (uno::RuntimeException)
367cdf0e10cSrcweir {
368cdf0e10cSrcweir     m_xComplexDescriptionAccess->addChartDataChangeEventListener(x);
369cdf0e10cSrcweir }
370cdf0e10cSrcweir 
removeChartDataChangeEventListener(const uno::Reference<::com::sun::star::chart::XChartDataChangeEventListener> & x)371cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::removeChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x)    throw (uno::RuntimeException)
372cdf0e10cSrcweir {
373cdf0e10cSrcweir     m_xComplexDescriptionAccess->removeChartDataChangeEventListener(x);
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
getNotANumber()376cdf0e10cSrcweir double SAL_CALL DatabaseDataProvider::getNotANumber()    throw (uno::RuntimeException)
377cdf0e10cSrcweir {
378cdf0e10cSrcweir     return m_xComplexDescriptionAccess->getNotANumber();
379cdf0e10cSrcweir }
380cdf0e10cSrcweir 
isNotANumber(double nNumber)381cdf0e10cSrcweir ::sal_Bool SAL_CALL DatabaseDataProvider::isNotANumber( double nNumber )    throw (uno::RuntimeException)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir     return m_xComplexDescriptionAccess->isNotANumber(nNumber);
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir // -----------------------------------------------------------------------------
387cdf0e10cSrcweir 
getRangeSelection()388cdf0e10cSrcweir uno::Reference< sheet::XRangeSelection > SAL_CALL DatabaseDataProvider::getRangeSelection() throw (uno::RuntimeException)
389cdf0e10cSrcweir {
390cdf0e10cSrcweir     // TODO: Exchange the default return implementation for "getRangeSelection" !!!
391cdf0e10cSrcweir     // Exchange the default return implementation.
392cdf0e10cSrcweir     // NOTE: Default initialized polymorphic structs can cause problems because of
393cdf0e10cSrcweir     // missing default initialization of primitive types of some C++ compilers or
394cdf0e10cSrcweir     // different Any initialization in Java and C++ polymorphic structs.
395cdf0e10cSrcweir     return uno::Reference< sheet::XRangeSelection >();
396cdf0e10cSrcweir }
397cdf0e10cSrcweir // -----------------------------------------------------------------------------
398cdf0e10cSrcweir // chart2::data::XRangeXMLConversion:
convertRangeToXML(const::rtl::OUString & _sRangeRepresentation)399cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::convertRangeToXML(const ::rtl::OUString & _sRangeRepresentation) throw (uno::RuntimeException, lang::IllegalArgumentException)
400cdf0e10cSrcweir {
401cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
402cdf0e10cSrcweir     return m_xRangeConversion->convertRangeToXML(_sRangeRepresentation);
403cdf0e10cSrcweir }
404cdf0e10cSrcweir // -----------------------------------------------------------------------------
405cdf0e10cSrcweir 
convertRangeFromXML(const::rtl::OUString & _sXMLRange)406cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::convertRangeFromXML(const ::rtl::OUString & _sXMLRange) throw (uno::RuntimeException, lang::IllegalArgumentException)
407cdf0e10cSrcweir {
408cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
409cdf0e10cSrcweir     return m_xRangeConversion->convertRangeFromXML(_sXMLRange);
410cdf0e10cSrcweir }
411cdf0e10cSrcweir // -----------------------------------------------------------------------------
412cdf0e10cSrcweir 
413cdf0e10cSrcweir // com.sun.star.beans.XPropertySet:
getPropertySetInfo()414cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL DatabaseDataProvider::getPropertySetInfo() throw (uno::RuntimeException)
415cdf0e10cSrcweir {
416cdf0e10cSrcweir     return ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::getPropertySetInfo();
417cdf0e10cSrcweir }
418cdf0e10cSrcweir // -----------------------------------------------------------------------------
419cdf0e10cSrcweir 
setPropertyValue(const::rtl::OUString & aPropertyName,const uno::Any & aValue)420cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setPropertyValue(const ::rtl::OUString & aPropertyName, const uno::Any & aValue) throw (uno::RuntimeException, beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException)
421cdf0e10cSrcweir {
422cdf0e10cSrcweir     ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::setPropertyValue(aPropertyName, aValue);
423cdf0e10cSrcweir }
424cdf0e10cSrcweir // -----------------------------------------------------------------------------
425cdf0e10cSrcweir 
getPropertyValue(const::rtl::OUString & aPropertyName)426cdf0e10cSrcweir uno::Any SAL_CALL DatabaseDataProvider::getPropertyValue(const ::rtl::OUString & aPropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException)
427cdf0e10cSrcweir {
428cdf0e10cSrcweir     return ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::getPropertyValue(aPropertyName);
429cdf0e10cSrcweir }
430cdf0e10cSrcweir // -----------------------------------------------------------------------------
431cdf0e10cSrcweir 
addPropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & xListener)432cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::addPropertyChangeListener(const ::rtl::OUString & aPropertyName, const uno::Reference< beans::XPropertyChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir     ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::addPropertyChangeListener(aPropertyName, xListener);
435cdf0e10cSrcweir }
436cdf0e10cSrcweir // -----------------------------------------------------------------------------
437cdf0e10cSrcweir 
removePropertyChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XPropertyChangeListener> & xListener)438cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::removePropertyChangeListener(const ::rtl::OUString & aPropertyName, const uno::Reference< beans::XPropertyChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException)
439cdf0e10cSrcweir {
440cdf0e10cSrcweir     ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::removePropertyChangeListener(aPropertyName, xListener);
441cdf0e10cSrcweir }
442cdf0e10cSrcweir // -----------------------------------------------------------------------------
443cdf0e10cSrcweir 
addVetoableChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XVetoableChangeListener> & xListener)444cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::addVetoableChangeListener(const ::rtl::OUString & aPropertyName, const uno::Reference< beans::XVetoableChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException)
445cdf0e10cSrcweir {
446cdf0e10cSrcweir     ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::addVetoableChangeListener(aPropertyName, xListener);
447cdf0e10cSrcweir }
448cdf0e10cSrcweir // -----------------------------------------------------------------------------
449cdf0e10cSrcweir 
removeVetoableChangeListener(const::rtl::OUString & aPropertyName,const uno::Reference<beans::XVetoableChangeListener> & xListener)450cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::removeVetoableChangeListener(const ::rtl::OUString & aPropertyName, const uno::Reference< beans::XVetoableChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir     ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::removeVetoableChangeListener(aPropertyName, xListener);
453cdf0e10cSrcweir }
454cdf0e10cSrcweir // -----------------------------------------------------------------------------
455cdf0e10cSrcweir 
456cdf0e10cSrcweir // chart2::data::XDatabaseDataProvider:
getMasterFields()457cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL DatabaseDataProvider::getMasterFields() throw (uno::RuntimeException)
458cdf0e10cSrcweir {
459cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
460cdf0e10cSrcweir     return m_MasterFields;
461cdf0e10cSrcweir }
462cdf0e10cSrcweir // -----------------------------------------------------------------------------
463cdf0e10cSrcweir 
setMasterFields(const uno::Sequence<::rtl::OUString> & the_value)464cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setMasterFields(const uno::Sequence< ::rtl::OUString > & the_value) throw (uno::RuntimeException)
465cdf0e10cSrcweir {
466cdf0e10cSrcweir     impl_invalidateParameter_nothrow();
467cdf0e10cSrcweir     set(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MasterFields")),the_value,m_MasterFields);
468cdf0e10cSrcweir }
469cdf0e10cSrcweir // -----------------------------------------------------------------------------
470cdf0e10cSrcweir 
getDetailFields()471cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL DatabaseDataProvider::getDetailFields() throw (uno::RuntimeException)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
474cdf0e10cSrcweir     return m_DetailFields;
475cdf0e10cSrcweir }
476cdf0e10cSrcweir // -----------------------------------------------------------------------------
477cdf0e10cSrcweir 
setDetailFields(const uno::Sequence<::rtl::OUString> & the_value)478cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setDetailFields(const uno::Sequence< ::rtl::OUString > & the_value) throw (uno::RuntimeException)
479cdf0e10cSrcweir {
480cdf0e10cSrcweir     set(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DetailFields")),the_value,m_DetailFields);
481cdf0e10cSrcweir }
482cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCommand()483cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getCommand() throw (uno::RuntimeException)
484cdf0e10cSrcweir {
485cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
486cdf0e10cSrcweir     return m_Command;
487cdf0e10cSrcweir }
488cdf0e10cSrcweir // -----------------------------------------------------------------------------
489cdf0e10cSrcweir 
setCommand(const::rtl::OUString & the_value)490cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setCommand(const ::rtl::OUString & the_value) throw (uno::RuntimeException)
491cdf0e10cSrcweir {
492cdf0e10cSrcweir     {
493cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
494cdf0e10cSrcweir         impl_invalidateParameter_nothrow();
495cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND,   uno::makeAny( the_value ) );
496cdf0e10cSrcweir     }
497cdf0e10cSrcweir     set(PROPERTY_COMMAND,the_value,m_Command);
498cdf0e10cSrcweir }
499cdf0e10cSrcweir // -----------------------------------------------------------------------------
500cdf0e10cSrcweir 
getCommandType()501cdf0e10cSrcweir ::sal_Int32 SAL_CALL DatabaseDataProvider::getCommandType() throw (uno::RuntimeException)
502cdf0e10cSrcweir {
503cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
504cdf0e10cSrcweir     return m_CommandType;
505cdf0e10cSrcweir }
506cdf0e10cSrcweir // -----------------------------------------------------------------------------
507cdf0e10cSrcweir 
setCommandType(::sal_Int32 the_value)508cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setCommandType(::sal_Int32 the_value) throw (uno::RuntimeException)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir     {
511cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
512cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND_TYPE,   uno::makeAny( the_value ) );
513cdf0e10cSrcweir     }
514cdf0e10cSrcweir     set(PROPERTY_COMMAND_TYPE,the_value,m_CommandType);
515cdf0e10cSrcweir }
516cdf0e10cSrcweir // -----------------------------------------------------------------------------
517cdf0e10cSrcweir 
getFilter()518cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getFilter() throw (uno::RuntimeException)
519cdf0e10cSrcweir {
520cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
521cdf0e10cSrcweir     return m_aFilterManager.getFilterComponent( dbtools::FilterManager::fcPublicFilter );
522cdf0e10cSrcweir }
523cdf0e10cSrcweir // -----------------------------------------------------------------------------
524cdf0e10cSrcweir 
setFilter(const::rtl::OUString & the_value)525cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setFilter(const ::rtl::OUString & the_value) throw (uno::RuntimeException)
526cdf0e10cSrcweir {
527cdf0e10cSrcweir     {
528cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
529cdf0e10cSrcweir         m_aFilterManager.setFilterComponent( dbtools::FilterManager::fcPublicFilter, the_value );
530cdf0e10cSrcweir     }
531cdf0e10cSrcweir     set(PROPERTY_FILTER,the_value,m_Filter);
532cdf0e10cSrcweir }
533cdf0e10cSrcweir // -----------------------------------------------------------------------------
getApplyFilter()534cdf0e10cSrcweir ::sal_Bool SAL_CALL DatabaseDataProvider::getApplyFilter() throw (RuntimeException)
535cdf0e10cSrcweir {
536cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
537cdf0e10cSrcweir     return m_ApplyFilter;
538cdf0e10cSrcweir }
539cdf0e10cSrcweir // -----------------------------------------------------------------------------
setApplyFilter(::sal_Bool the_value)540cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setApplyFilter( ::sal_Bool the_value ) throw (RuntimeException)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir     {
543cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
544cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER,   uno::makeAny( the_value ) );
545cdf0e10cSrcweir     }
546cdf0e10cSrcweir     set(PROPERTY_APPLYFILTER,the_value,m_ApplyFilter);
547cdf0e10cSrcweir }
548cdf0e10cSrcweir // -----------------------------------------------------------------------------
getHavingClause()549cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getHavingClause() throw (uno::RuntimeException)
550cdf0e10cSrcweir {
551cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
552cdf0e10cSrcweir     return m_HavingClause;
553cdf0e10cSrcweir }
554cdf0e10cSrcweir // -----------------------------------------------------------------------------
setHavingClause(const::rtl::OUString & the_value)555cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setHavingClause( const ::rtl::OUString& the_value ) throw (beans::UnknownPropertyException, uno::RuntimeException)
556cdf0e10cSrcweir {
557cdf0e10cSrcweir     {
558cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
559cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue( PROPERTY_HAVING_CLAUSE,   uno::makeAny( the_value ) );
560cdf0e10cSrcweir     }
561cdf0e10cSrcweir     set(PROPERTY_HAVING_CLAUSE,the_value,m_HavingClause);
562cdf0e10cSrcweir }
563cdf0e10cSrcweir // -----------------------------------------------------------------------------
getGroupBy()564cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getGroupBy() throw (uno::RuntimeException)
565cdf0e10cSrcweir {
566cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
567cdf0e10cSrcweir     return m_GroupBy;
568cdf0e10cSrcweir }
569cdf0e10cSrcweir // -----------------------------------------------------------------------------
setGroupBy(const::rtl::OUString & the_value)570cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setGroupBy( const ::rtl::OUString& the_value ) throw (beans::UnknownPropertyException, uno::RuntimeException)
571cdf0e10cSrcweir {
572cdf0e10cSrcweir     {
573cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
574cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue( PROPERTY_GROUP_BY,   uno::makeAny( the_value ) );
575cdf0e10cSrcweir     }
576cdf0e10cSrcweir     set(PROPERTY_GROUP_BY,the_value,m_GroupBy);
577cdf0e10cSrcweir }
578cdf0e10cSrcweir // -----------------------------------------------------------------------------
getOrder()579cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getOrder() throw (uno::RuntimeException)
580cdf0e10cSrcweir {
581cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
582cdf0e10cSrcweir     return m_Order;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir // -----------------------------------------------------------------------------
setOrder(const::rtl::OUString & the_value)585cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setOrder( const ::rtl::OUString& the_value ) throw (uno::RuntimeException)
586cdf0e10cSrcweir {
587cdf0e10cSrcweir     {
588cdf0e10cSrcweir         osl::MutexGuard g(m_aMutex);
589cdf0e10cSrcweir         m_xAggregateSet->setPropertyValue( PROPERTY_ORDER,   uno::makeAny( the_value ) );
590cdf0e10cSrcweir     }
591cdf0e10cSrcweir     set(PROPERTY_ORDER,the_value,m_Order);
592cdf0e10cSrcweir }
593cdf0e10cSrcweir // -----------------------------------------------------------------------------
getEscapeProcessing()594cdf0e10cSrcweir ::sal_Bool SAL_CALL DatabaseDataProvider::getEscapeProcessing() throw (uno::RuntimeException)
595cdf0e10cSrcweir {
596cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
597cdf0e10cSrcweir     return m_EscapeProcessing;
598cdf0e10cSrcweir }
599cdf0e10cSrcweir // -----------------------------------------------------------------------------
600cdf0e10cSrcweir 
setEscapeProcessing(::sal_Bool the_value)601cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setEscapeProcessing(::sal_Bool the_value) throw (uno::RuntimeException)
602cdf0e10cSrcweir {
603cdf0e10cSrcweir     set(PROPERTY_ESCAPE_PROCESSING,the_value,m_EscapeProcessing);
604cdf0e10cSrcweir }
605cdf0e10cSrcweir // -----------------------------------------------------------------------------
getRowLimit()606cdf0e10cSrcweir ::sal_Int32 SAL_CALL DatabaseDataProvider::getRowLimit() throw (uno::RuntimeException)
607cdf0e10cSrcweir {
608cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
609cdf0e10cSrcweir     return m_RowLimit;
610cdf0e10cSrcweir }
611cdf0e10cSrcweir // -----------------------------------------------------------------------------
612cdf0e10cSrcweir 
setRowLimit(::sal_Int32 the_value)613cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setRowLimit(::sal_Int32 the_value) throw (uno::RuntimeException)
614cdf0e10cSrcweir {
615cdf0e10cSrcweir     set(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RowLimit")),the_value,m_RowLimit);
616cdf0e10cSrcweir }
617cdf0e10cSrcweir // -----------------------------------------------------------------------------
getActiveConnection()618cdf0e10cSrcweir uno::Reference< sdbc::XConnection > SAL_CALL DatabaseDataProvider::getActiveConnection() throw (uno::RuntimeException)
619cdf0e10cSrcweir {
620cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
621cdf0e10cSrcweir     return m_xActiveConnection;
622cdf0e10cSrcweir }
623cdf0e10cSrcweir // -----------------------------------------------------------------------------
624cdf0e10cSrcweir 
setActiveConnection(const uno::Reference<sdbc::XConnection> & the_value)625cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setActiveConnection(const uno::Reference< sdbc::XConnection > & the_value) throw (uno::RuntimeException, lang::IllegalArgumentException)
626cdf0e10cSrcweir {
627cdf0e10cSrcweir     if ( !the_value.is() )
628cdf0e10cSrcweir         throw lang::IllegalArgumentException();
629cdf0e10cSrcweir     set(PROPERTY_ACTIVE_CONNECTION,the_value,m_xActiveConnection);
630cdf0e10cSrcweir }
631cdf0e10cSrcweir // -----------------------------------------------------------------------------
getDataSourceName()632cdf0e10cSrcweir ::rtl::OUString SAL_CALL DatabaseDataProvider::getDataSourceName() throw (uno::RuntimeException)
633cdf0e10cSrcweir {
634cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
635cdf0e10cSrcweir     return m_DataSourceName;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir // -----------------------------------------------------------------------------
638cdf0e10cSrcweir 
setDataSourceName(const::rtl::OUString & the_value)639cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setDataSourceName(const ::rtl::OUString& the_value) throw (uno::RuntimeException)
640cdf0e10cSrcweir {
641cdf0e10cSrcweir     set(PROPERTY_DATASOURCENAME,the_value,m_DataSourceName);
642cdf0e10cSrcweir }
643cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_executeRowSet_throw(::osl::ResettableMutexGuard & _rClearForNotifies)644cdf0e10cSrcweir void DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir     if ( impl_fillParameters_nothrow(_rClearForNotifies) )
647cdf0e10cSrcweir         m_xRowSet->execute();
648cdf0e10cSrcweir }
649cdf0e10cSrcweir 
650cdf0e10cSrcweir // -----------------------------------------------------------------------------
651cdf0e10cSrcweir namespace
652cdf0e10cSrcweir {
653cdf0e10cSrcweir     struct ColumnDescription
654cdf0e10cSrcweir     {
655cdf0e10cSrcweir         ::rtl::OUString sName;
656cdf0e10cSrcweir         sal_Int32       nResultSetPosition;
657cdf0e10cSrcweir         sal_Int32       nDataType;
658cdf0e10cSrcweir 
ColumnDescriptiondbaccess::__anonfce6e6b30111::ColumnDescription659cdf0e10cSrcweir         ColumnDescription()
660cdf0e10cSrcweir             :sName()
661cdf0e10cSrcweir             ,nResultSetPosition( 0 )
662cdf0e10cSrcweir             ,nDataType( sdbc::DataType::VARCHAR )
663cdf0e10cSrcweir         {
664cdf0e10cSrcweir         }
ColumnDescriptiondbaccess::__anonfce6e6b30111::ColumnDescription665cdf0e10cSrcweir         explicit ColumnDescription( const ::rtl::OUString& i_rName )
666cdf0e10cSrcweir             :sName( i_rName )
667cdf0e10cSrcweir             ,nResultSetPosition( 0 )
668cdf0e10cSrcweir             ,nDataType( sdbc::DataType::VARCHAR )
669cdf0e10cSrcweir         {
670cdf0e10cSrcweir         }
671cdf0e10cSrcweir     };
672cdf0e10cSrcweir 
673cdf0e10cSrcweir     struct CreateColumnDescription : public ::std::unary_function< ::rtl::OUString, ColumnDescription >
674cdf0e10cSrcweir     {
operator ()dbaccess::__anonfce6e6b30111::CreateColumnDescription675cdf0e10cSrcweir         ColumnDescription operator()( const ::rtl::OUString& i_rName )
676cdf0e10cSrcweir         {
677cdf0e10cSrcweir             return ColumnDescription( i_rName );
678cdf0e10cSrcweir         }
679cdf0e10cSrcweir     };
680cdf0e10cSrcweir 
681cdf0e10cSrcweir     struct SelectColumnName : public ::std::unary_function< ColumnDescription, ::rtl::OUString >
682cdf0e10cSrcweir     {
operator ()dbaccess::__anonfce6e6b30111::SelectColumnName683cdf0e10cSrcweir         const ::rtl::OUString& operator()( const ColumnDescription& i_rColumn )
684cdf0e10cSrcweir         {
685cdf0e10cSrcweir             return i_rColumn.sName;
686cdf0e10cSrcweir         }
687cdf0e10cSrcweir     };
688cdf0e10cSrcweir }
689cdf0e10cSrcweir 
690cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const uno::Sequence<::rtl::OUString> & i_aColumnNames)691cdf0e10cSrcweir void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const uno::Sequence< ::rtl::OUString >& i_aColumnNames)
692cdf0e10cSrcweir {
693cdf0e10cSrcweir     // clear the data before fill the new one
694cdf0e10cSrcweir     uno::Reference< sdbcx::XColumnsSupplier > xColSup(m_xRowSet,uno::UNO_QUERY_THROW);
695cdf0e10cSrcweir     uno::Reference< container::XNameAccess > xColumns( xColSup->getColumns(), uno::UNO_SET_THROW );
696cdf0e10cSrcweir     const uno::Sequence< ::rtl::OUString > aRowSetColumnNames( xColumns->getElementNames() );
697cdf0e10cSrcweir 
698cdf0e10cSrcweir     typedef ::std::vector< ColumnDescription > ColumnDescriptions;
699cdf0e10cSrcweir     ColumnDescriptions aColumns;
700cdf0e10cSrcweir     bool bFirstColumnIsCategory = _bHasCategories;
701cdf0e10cSrcweir     if ( i_aColumnNames.getLength() )
702cdf0e10cSrcweir     {
703cdf0e10cSrcweir         // some normalizations ...
704cdf0e10cSrcweir         uno::Sequence< ::rtl::OUString > aImposedColumnNames( i_aColumnNames );
705cdf0e10cSrcweir 
706cdf0e10cSrcweir         // strangely, there exist documents where the ColumnDescriptions end with a number of empty strings. /me
707cdf0e10cSrcweir         // thinks they're generated when you have a chart based on a result set with n columns, but remove some
708cdf0e10cSrcweir         // of those columns from the chart - it looks like a bug in the report XML export to me.
709cdf0e10cSrcweir         // So, get rid of the "trailing" empty columns
710cdf0e10cSrcweir         sal_Int32 nLastNonEmptyColName = aImposedColumnNames.getLength() - 1;
711cdf0e10cSrcweir         for ( ; nLastNonEmptyColName >= 0; --nLastNonEmptyColName )
712cdf0e10cSrcweir         {
713cdf0e10cSrcweir             if ( aImposedColumnNames[ nLastNonEmptyColName ].getLength() != 0 )
714cdf0e10cSrcweir                 break;
715cdf0e10cSrcweir         }
716cdf0e10cSrcweir         aImposedColumnNames.realloc( nLastNonEmptyColName + 1 );
717cdf0e10cSrcweir 
718cdf0e10cSrcweir         // second, for X-Y-charts the ColumnDescriptions exported by chart miss the name of the first (non-category)
719cdf0e10cSrcweir         // column. This, this results in a ColumnDescriptions array like <"", "col2", "col3">, where you'd expect
720cdf0e10cSrcweir         // <"col1", "col2", "col3">.
721cdf0e10cSrcweir         // Fix this with some heuristics:
722cdf0e10cSrcweir         if ( ( aImposedColumnNames.getLength() > 0 ) && ( aImposedColumnNames[0].getLength() == 0 ) )
723cdf0e10cSrcweir         {
724cdf0e10cSrcweir             const sal_Int32 nAssumedRowSetColumnIndex = _bHasCategories ? 1 : 0;
725cdf0e10cSrcweir             if ( nAssumedRowSetColumnIndex < aRowSetColumnNames.getLength() )
726cdf0e10cSrcweir                 aImposedColumnNames[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ];
727cdf0e10cSrcweir         }
728cdf0e10cSrcweir 
729cdf0e10cSrcweir         const sal_Int32 nCount = aImposedColumnNames.getLength();
730cdf0e10cSrcweir         for ( sal_Int32 i = 0 ; i < nCount; ++i )
731cdf0e10cSrcweir         {
732cdf0e10cSrcweir             const ::rtl::OUString sColumnName( aImposedColumnNames[i] );
733cdf0e10cSrcweir             if ( !xColumns->hasByName( sColumnName ) )
734cdf0e10cSrcweir                 continue;
735cdf0e10cSrcweir 
736cdf0e10cSrcweir             if ( _bHasCategories && aColumns.empty() )
737cdf0e10cSrcweir             {
738cdf0e10cSrcweir                 if ( aRowSetColumnNames.getLength() )
739cdf0e10cSrcweir                     aColumns.push_back( ColumnDescription( aRowSetColumnNames[0] ) );
740cdf0e10cSrcweir                 else
741cdf0e10cSrcweir                     aColumns.push_back( ColumnDescription( sColumnName ) );
742cdf0e10cSrcweir                 bFirstColumnIsCategory = true;
743cdf0e10cSrcweir             }
744cdf0e10cSrcweir             aColumns.push_back( ColumnDescription( sColumnName ) );
745cdf0e10cSrcweir         }
746cdf0e10cSrcweir     }
747cdf0e10cSrcweir     if ( aColumns.empty() )
748cdf0e10cSrcweir     {
749cdf0e10cSrcweir         aColumns.resize( aRowSetColumnNames.getLength() );
750cdf0e10cSrcweir         ::std::transform(
751cdf0e10cSrcweir             aRowSetColumnNames.getConstArray(),
752cdf0e10cSrcweir             aRowSetColumnNames.getConstArray() + aRowSetColumnNames.getLength(),
753cdf0e10cSrcweir             aColumns.begin(),
754cdf0e10cSrcweir             CreateColumnDescription()
755cdf0e10cSrcweir        );
756cdf0e10cSrcweir     }
757cdf0e10cSrcweir 
758cdf0e10cSrcweir     // fill the data
759cdf0e10cSrcweir     uno::Reference< sdbc::XResultSet> xRes( m_xRowSet, uno::UNO_QUERY_THROW );
760cdf0e10cSrcweir     uno::Reference< sdbc::XRow> xRow( m_xRowSet,uno::UNO_QUERY_THROW );
761cdf0e10cSrcweir     uno::Reference< sdbc::XResultSetMetaDataSupplier > xSuppMeta( m_xRowSet,uno::UNO_QUERY_THROW );
762cdf0e10cSrcweir     uno::Reference< sdbc::XResultSetMetaData > xResultSetMetaData( xSuppMeta->getMetaData(), uno::UNO_SET_THROW );
763cdf0e10cSrcweir     uno::Reference< sdbc::XColumnLocate > xColumnLocate( m_xRowSet, uno::UNO_QUERY_THROW );
764cdf0e10cSrcweir 
765cdf0e10cSrcweir     for (   ColumnDescriptions::iterator col = aColumns.begin();
766cdf0e10cSrcweir             col != aColumns.end();
767cdf0e10cSrcweir             ++col
768cdf0e10cSrcweir          )
769cdf0e10cSrcweir     {
770cdf0e10cSrcweir         col->nResultSetPosition = xColumnLocate->findColumn( col->sName );
771cdf0e10cSrcweir 
772cdf0e10cSrcweir         const uno::Reference< beans::XPropertySet > xColumn( xColumns->getByName( col->sName ), uno::UNO_QUERY_THROW );
773cdf0e10cSrcweir         const uno::Any aNumberFormat( xColumn->getPropertyValue( PROPERTY_NUMBERFORMAT ) );
774cdf0e10cSrcweir         OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_TYPE ) >>= col->nDataType );
775cdf0e10cSrcweir 
776cdf0e10cSrcweir         const sal_Int32 columnIndex = col - aColumns.begin();
777cdf0e10cSrcweir         const ::rtl::OUString sRangeName = ::rtl::OUString::valueOf( columnIndex );
778cdf0e10cSrcweir         m_aNumberFormats.insert( ::std::map< ::rtl::OUString, uno::Any >::value_type( sRangeName, aNumberFormat ) );
779cdf0e10cSrcweir     }
780cdf0e10cSrcweir 
781cdf0e10cSrcweir     ::std::vector< ::rtl::OUString > aRowLabels;
782cdf0e10cSrcweir     ::std::vector< ::std::vector< double > > aDataValues;
783cdf0e10cSrcweir     sal_Int32 nRowCount = 0;
784cdf0e10cSrcweir     ::connectivity::ORowSetValue aValue;
785cdf0e10cSrcweir     while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) )
786cdf0e10cSrcweir     {
787cdf0e10cSrcweir         ++nRowCount;
788cdf0e10cSrcweir 
789cdf0e10cSrcweir         aValue.fill( aColumns[0].nResultSetPosition, aColumns[0].nDataType, xRow );
790cdf0e10cSrcweir 		aRowLabels.push_back( aValue.getString() );
791cdf0e10cSrcweir 
792cdf0e10cSrcweir         ::std::vector< double > aRow;
793cdf0e10cSrcweir         for (   ColumnDescriptions::const_iterator col = aColumns.begin();
794cdf0e10cSrcweir                 col != aColumns.end();
795cdf0e10cSrcweir                 ++col
796cdf0e10cSrcweir             )
797cdf0e10cSrcweir         {
798cdf0e10cSrcweir             if ( bFirstColumnIsCategory && ( col == aColumns.begin() )  )
799cdf0e10cSrcweir                 continue;
800cdf0e10cSrcweir 
801cdf0e10cSrcweir             aValue.fill( col->nResultSetPosition, col->nDataType, xRow );
802cdf0e10cSrcweir             if ( aValue.isNull() )
803cdf0e10cSrcweir             {
804cdf0e10cSrcweir                 double nValue;
805cdf0e10cSrcweir                 ::rtl::math::setNan( &nValue );
806cdf0e10cSrcweir                 aRow.push_back( nValue );
807cdf0e10cSrcweir             }
808cdf0e10cSrcweir             else
809cdf0e10cSrcweir                 aRow.push_back( aValue.getDouble() );
810cdf0e10cSrcweir         }
811cdf0e10cSrcweir 
812cdf0e10cSrcweir         aDataValues.push_back( aRow );
813cdf0e10cSrcweir     }
814cdf0e10cSrcweir 
815cdf0e10cSrcweir     // insert default data when no rows exist
816cdf0e10cSrcweir     if ( !nRowCount )
817cdf0e10cSrcweir     {
818cdf0e10cSrcweir         nRowCount = 3;
819cdf0e10cSrcweir         const double fDefaultData[ ] =
820cdf0e10cSrcweir             { 9.10, 3.20, 4.54,
821cdf0e10cSrcweir               2.40, 8.80, 9.65,
822cdf0e10cSrcweir               3.10, 1.50, 3.70,
823cdf0e10cSrcweir               4.30, 9.02, 6.20 };
824cdf0e10cSrcweir         for(sal_Int32 h = 0,k = 0; h < nRowCount; ++h,++k )
825cdf0e10cSrcweir         {
826cdf0e10cSrcweir             aRowLabels.push_back(::rtl::OUString::valueOf(h+1));
827cdf0e10cSrcweir             ::std::vector< double > aRow;
828cdf0e10cSrcweir             const sal_Int32 nSize = sizeof(fDefaultData)/sizeof(fDefaultData[0]);
829cdf0e10cSrcweir             for (size_t j = 0; j < (aColumns.size()-1); ++j,++k)
830cdf0e10cSrcweir             {
831cdf0e10cSrcweir                 if ( k >= nSize )
832cdf0e10cSrcweir                     k = 0;
833cdf0e10cSrcweir                 aRow.push_back(fDefaultData[k]);
834cdf0e10cSrcweir             } // for (sal_Int32 j = 0,k = 0; j < (aColumns.size()-1); ++j,++k)
835cdf0e10cSrcweir             aDataValues.push_back(aRow);
836cdf0e10cSrcweir         }
837cdf0e10cSrcweir     } // if ( !nRowCount )
838cdf0e10cSrcweir 
839cdf0e10cSrcweir 	uno::Reference< chart::XChartDataArray> xData(m_xInternal,uno::UNO_QUERY);
840cdf0e10cSrcweir 	xData->setRowDescriptions(uno::Sequence< ::rtl::OUString >(&(*aRowLabels.begin()),aRowLabels.size()));
841cdf0e10cSrcweir 
842cdf0e10cSrcweir     const size_t nOffset = bFirstColumnIsCategory ? 1 : 0;
843cdf0e10cSrcweir     uno::Sequence< ::rtl::OUString > aColumnDescriptions( aColumns.size() - nOffset );
844cdf0e10cSrcweir     ::std::transform(
845cdf0e10cSrcweir         aColumns.begin() + nOffset,
846cdf0e10cSrcweir         aColumns.end(),
847cdf0e10cSrcweir         aColumnDescriptions.getArray(),
848cdf0e10cSrcweir         SelectColumnName()
849cdf0e10cSrcweir     );
850cdf0e10cSrcweir     xData->setColumnDescriptions( aColumnDescriptions );
851cdf0e10cSrcweir 
852cdf0e10cSrcweir     uno::Sequence< uno::Sequence< double > > aData(aDataValues.size());
853cdf0e10cSrcweir     uno::Sequence< double >* pDataIter  = aData.getArray();
854cdf0e10cSrcweir     uno::Sequence< double >* pDataEnd   = pDataIter + aData.getLength();
855cdf0e10cSrcweir     for(sal_Int32 i= 0;pDataIter != pDataEnd; ++pDataIter,++i )
856cdf0e10cSrcweir     {
857cdf0e10cSrcweir         if ( !aDataValues[i].empty() )
858cdf0e10cSrcweir             *pDataIter = uno::Sequence< double >(&(*(aDataValues[i]).begin()),(aDataValues[i]).size());
859cdf0e10cSrcweir     }
860cdf0e10cSrcweir     xData->setData(aData);
861cdf0e10cSrcweir }
862cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_fillRowSet_throw()863cdf0e10cSrcweir void DatabaseDataProvider::impl_fillRowSet_throw()
864cdf0e10cSrcweir {
865cdf0e10cSrcweir     m_xAggregateSet->setPropertyValue( PROPERTY_FILTER,   uno::makeAny( getFilter() ) );
866cdf0e10cSrcweir     uno::Reference< sdbc::XParameters> xParam(m_xRowSet,uno::UNO_QUERY_THROW);
867cdf0e10cSrcweir     xParam->clearParameters( );
868cdf0e10cSrcweir }
869cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_fillParameters_nothrow(::osl::ResettableMutexGuard & _rClearForNotifies)870cdf0e10cSrcweir bool DatabaseDataProvider::impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies)
871cdf0e10cSrcweir {
872cdf0e10cSrcweir 	// do we have to fill the parameters again?
873cdf0e10cSrcweir     if ( !m_aParameterManager.isUpToDate() )
874cdf0e10cSrcweir 		m_aParameterManager.updateParameterInfo( m_aFilterManager );
875cdf0e10cSrcweir 
876cdf0e10cSrcweir     if ( m_aParameterManager.isUpToDate() )
877cdf0e10cSrcweir         return m_aParameterManager.fillParameterValues( m_xHandler, _rClearForNotifies );
878cdf0e10cSrcweir 
879cdf0e10cSrcweir     return true;
880cdf0e10cSrcweir }
881cdf0e10cSrcweir // com::sun::star::sdbc::XParameters
882cdf0e10cSrcweir //------------------------------------------------------------------------------
setNull(sal_Int32 parameterIndex,sal_Int32 sqlType)883cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw( SQLException, RuntimeException )
884cdf0e10cSrcweir {
885cdf0e10cSrcweir 	m_aParameterManager.setNull(parameterIndex, sqlType);
886cdf0e10cSrcweir }
887cdf0e10cSrcweir 
888cdf0e10cSrcweir //------------------------------------------------------------------------------
setObjectNull(sal_Int32 parameterIndex,sal_Int32 sqlType,const::rtl::OUString & typeName)889cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw( SQLException, RuntimeException )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir 	m_aParameterManager.setObjectNull(parameterIndex, sqlType, typeName);
892cdf0e10cSrcweir }
893cdf0e10cSrcweir 
894cdf0e10cSrcweir //------------------------------------------------------------------------------
setBoolean(sal_Int32 parameterIndex,sal_Bool x)895cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw( SQLException, RuntimeException )
896cdf0e10cSrcweir {
897cdf0e10cSrcweir 	m_aParameterManager.setBoolean(parameterIndex, x);
898cdf0e10cSrcweir }
899cdf0e10cSrcweir 
900cdf0e10cSrcweir //------------------------------------------------------------------------------
setByte(sal_Int32 parameterIndex,sal_Int8 x)901cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw( SQLException, RuntimeException )
902cdf0e10cSrcweir {
903cdf0e10cSrcweir 	m_aParameterManager.setByte(parameterIndex, x);
904cdf0e10cSrcweir }
905cdf0e10cSrcweir 
906cdf0e10cSrcweir //------------------------------------------------------------------------------
setShort(sal_Int32 parameterIndex,sal_Int16 x)907cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw( SQLException, RuntimeException )
908cdf0e10cSrcweir {
909cdf0e10cSrcweir 	m_aParameterManager.setShort(parameterIndex, x);
910cdf0e10cSrcweir }
911cdf0e10cSrcweir 
912cdf0e10cSrcweir //------------------------------------------------------------------------------
setInt(sal_Int32 parameterIndex,sal_Int32 x)913cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw( SQLException, RuntimeException )
914cdf0e10cSrcweir {
915cdf0e10cSrcweir 	m_aParameterManager.setInt(parameterIndex, x);
916cdf0e10cSrcweir }
917cdf0e10cSrcweir 
918cdf0e10cSrcweir //------------------------------------------------------------------------------
setLong(sal_Int32 parameterIndex,sal_Int64 x)919cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setLong(sal_Int32 parameterIndex, sal_Int64 x) throw( SQLException, RuntimeException )
920cdf0e10cSrcweir {
921cdf0e10cSrcweir 	m_aParameterManager.setLong(parameterIndex, x);
922cdf0e10cSrcweir }
923cdf0e10cSrcweir 
924cdf0e10cSrcweir //------------------------------------------------------------------------------
setFloat(sal_Int32 parameterIndex,float x)925cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setFloat(sal_Int32 parameterIndex, float x) throw( SQLException, RuntimeException )
926cdf0e10cSrcweir {
927cdf0e10cSrcweir 	m_aParameterManager.setFloat(parameterIndex, x);
928cdf0e10cSrcweir }
929cdf0e10cSrcweir 
930cdf0e10cSrcweir //------------------------------------------------------------------------------
setDouble(sal_Int32 parameterIndex,double x)931cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setDouble(sal_Int32 parameterIndex, double x) throw( SQLException, RuntimeException )
932cdf0e10cSrcweir {
933cdf0e10cSrcweir 	m_aParameterManager.setDouble(parameterIndex, x);
934cdf0e10cSrcweir }
935cdf0e10cSrcweir 
936cdf0e10cSrcweir //------------------------------------------------------------------------------
setString(sal_Int32 parameterIndex,const::rtl::OUString & x)937cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw( SQLException, RuntimeException )
938cdf0e10cSrcweir {
939cdf0e10cSrcweir 	m_aParameterManager.setString(parameterIndex, x);
940cdf0e10cSrcweir }
941cdf0e10cSrcweir 
942cdf0e10cSrcweir //------------------------------------------------------------------------------
setBytes(sal_Int32 parameterIndex,const uno::Sequence<sal_Int8> & x)943cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setBytes(sal_Int32 parameterIndex, const uno::Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
944cdf0e10cSrcweir {
945cdf0e10cSrcweir 	m_aParameterManager.setBytes(parameterIndex, x);
946cdf0e10cSrcweir }
947cdf0e10cSrcweir 
948cdf0e10cSrcweir //------------------------------------------------------------------------------
setDate(sal_Int32 parameterIndex,const util::Date & x)949cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setDate(sal_Int32 parameterIndex, const util::Date& x) throw( SQLException, RuntimeException )
950cdf0e10cSrcweir {
951cdf0e10cSrcweir 	m_aParameterManager.setDate(parameterIndex, x);
952cdf0e10cSrcweir }
953cdf0e10cSrcweir 
954cdf0e10cSrcweir //------------------------------------------------------------------------------
setTime(sal_Int32 parameterIndex,const util::Time & x)955cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setTime(sal_Int32 parameterIndex, const util::Time& x) throw( SQLException, RuntimeException )
956cdf0e10cSrcweir {
957cdf0e10cSrcweir 	m_aParameterManager.setTime(parameterIndex, x);
958cdf0e10cSrcweir }
959cdf0e10cSrcweir 
960cdf0e10cSrcweir //------------------------------------------------------------------------------
setTimestamp(sal_Int32 parameterIndex,const util::DateTime & x)961cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setTimestamp(sal_Int32 parameterIndex, const util::DateTime& x) throw( SQLException, RuntimeException )
962cdf0e10cSrcweir {
963cdf0e10cSrcweir 	m_aParameterManager.setTimestamp(parameterIndex, x);
964cdf0e10cSrcweir }
965cdf0e10cSrcweir 
966cdf0e10cSrcweir //------------------------------------------------------------------------------
setBinaryStream(sal_Int32 parameterIndex,const uno::Reference<io::XInputStream> & x,sal_Int32 length)967cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setBinaryStream(sal_Int32 parameterIndex, const uno::Reference<io::XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException )
968cdf0e10cSrcweir {
969cdf0e10cSrcweir 	m_aParameterManager.setBinaryStream(parameterIndex, x, length);
970cdf0e10cSrcweir }
971cdf0e10cSrcweir 
972cdf0e10cSrcweir //------------------------------------------------------------------------------
setCharacterStream(sal_Int32 parameterIndex,const uno::Reference<io::XInputStream> & x,sal_Int32 length)973cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setCharacterStream(sal_Int32 parameterIndex, const uno::Reference<io::XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException )
974cdf0e10cSrcweir {
975cdf0e10cSrcweir 	m_aParameterManager.setCharacterStream(parameterIndex, x, length);
976cdf0e10cSrcweir }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir //------------------------------------------------------------------------------
setObjectWithInfo(sal_Int32 parameterIndex,const uno::Any & x,sal_Int32 targetSqlType,sal_Int32 scale)979cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setObjectWithInfo(sal_Int32 parameterIndex, const uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw( SQLException, RuntimeException )
980cdf0e10cSrcweir {
981cdf0e10cSrcweir 	m_aParameterManager.setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
982cdf0e10cSrcweir }
983cdf0e10cSrcweir 
984cdf0e10cSrcweir //------------------------------------------------------------------------------
setObject(sal_Int32 parameterIndex,const uno::Any & x)985cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setObject(sal_Int32 parameterIndex, const uno::Any& x) throw( SQLException, RuntimeException )
986cdf0e10cSrcweir {
987cdf0e10cSrcweir 	m_aParameterManager.setObject(parameterIndex, x);
988cdf0e10cSrcweir }
989cdf0e10cSrcweir 
990cdf0e10cSrcweir //------------------------------------------------------------------------------
setRef(sal_Int32 parameterIndex,const uno::Reference<sdbc::XRef> & x)991cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setRef(sal_Int32 parameterIndex, const uno::Reference<sdbc::XRef>& x) throw( SQLException, RuntimeException )
992cdf0e10cSrcweir {
993cdf0e10cSrcweir 	m_aParameterManager.setRef(parameterIndex, x);
994cdf0e10cSrcweir }
995cdf0e10cSrcweir 
996cdf0e10cSrcweir //------------------------------------------------------------------------------
setBlob(sal_Int32 parameterIndex,const uno::Reference<sdbc::XBlob> & x)997cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setBlob(sal_Int32 parameterIndex, const uno::Reference<sdbc::XBlob>& x) throw( SQLException, RuntimeException )
998cdf0e10cSrcweir {
999cdf0e10cSrcweir 	m_aParameterManager.setBlob(parameterIndex, x);
1000cdf0e10cSrcweir }
1001cdf0e10cSrcweir 
1002cdf0e10cSrcweir //------------------------------------------------------------------------------
setClob(sal_Int32 parameterIndex,const uno::Reference<sdbc::XClob> & x)1003cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setClob(sal_Int32 parameterIndex, const uno::Reference<sdbc::XClob>& x) throw( SQLException, RuntimeException )
1004cdf0e10cSrcweir {
1005cdf0e10cSrcweir 	m_aParameterManager.setClob(parameterIndex, x);
1006cdf0e10cSrcweir }
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir //------------------------------------------------------------------------------
setArray(sal_Int32 parameterIndex,const Reference<sdbc::XArray> & x)1009cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setArray(sal_Int32 parameterIndex, const Reference<sdbc::XArray>& x) throw( SQLException, RuntimeException )
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir 	m_aParameterManager.setArray(parameterIndex, x);
1012cdf0e10cSrcweir }
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir //------------------------------------------------------------------------------
clearParameters()1015cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::clearParameters() throw( SQLException, RuntimeException )
1016cdf0e10cSrcweir {
1017cdf0e10cSrcweir 	m_aParameterManager.clearParameters();
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir //==============================================================================
1020cdf0e10cSrcweir // com::sun::star::sdbc::XRowSet
1021cdf0e10cSrcweir //------------------------------------------------------------------------------
execute()1022cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::execute() throw( SQLException, RuntimeException )
1023cdf0e10cSrcweir {
1024cdf0e10cSrcweir     uno::Sequence< beans::PropertyValue > aEmpty;
1025cdf0e10cSrcweir     createDataSource(aEmpty);
1026cdf0e10cSrcweir }
1027cdf0e10cSrcweir //------------------------------------------------------------------------------
addRowSetListener(const uno::Reference<sdbc::XRowSetListener> & _rListener)1028cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::addRowSetListener(const uno::Reference<sdbc::XRowSetListener>& _rListener) throw( RuntimeException )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir 	if (m_xRowSet.is())
1031cdf0e10cSrcweir 		m_xRowSet->addRowSetListener(_rListener);
1032cdf0e10cSrcweir }
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir //------------------------------------------------------------------------------
removeRowSetListener(const uno::Reference<sdbc::XRowSetListener> & _rListener)1035cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::removeRowSetListener(const uno::Reference<sdbc::XRowSetListener>& _rListener) throw( RuntimeException )
1036cdf0e10cSrcweir {
1037cdf0e10cSrcweir 	if (m_xRowSet.is())
1038cdf0e10cSrcweir 		m_xRowSet->removeRowSetListener(_rListener);
1039cdf0e10cSrcweir }
1040cdf0e10cSrcweir //==============================================================================
1041cdf0e10cSrcweir // com::sun::star::sdbc::XResultSet
1042cdf0e10cSrcweir //------------------------------------------------------------------------------
next()1043cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::next() throw( SQLException, RuntimeException )
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir 	return m_xRowSet->next();
1046cdf0e10cSrcweir }
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir //------------------------------------------------------------------------------
isBeforeFirst()1049cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::isBeforeFirst() throw( SQLException, RuntimeException )
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir 	return m_xRowSet->isBeforeFirst();
1052cdf0e10cSrcweir }
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir //------------------------------------------------------------------------------
isAfterLast()1055cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::isAfterLast() throw( SQLException, RuntimeException )
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir 	return m_xRowSet->isAfterLast();
1058cdf0e10cSrcweir }
1059cdf0e10cSrcweir 
1060cdf0e10cSrcweir //------------------------------------------------------------------------------
isFirst()1061cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::isFirst() throw( SQLException, RuntimeException )
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir 	return m_xRowSet->isFirst();
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir //------------------------------------------------------------------------------
isLast()1067cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::isLast() throw( SQLException, RuntimeException )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir 	return m_xRowSet->isLast();
1070cdf0e10cSrcweir }
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir //------------------------------------------------------------------------------
beforeFirst()1073cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::beforeFirst() throw( SQLException, RuntimeException )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir 	m_xRowSet->beforeFirst();
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir //------------------------------------------------------------------------------
afterLast()1079cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::afterLast() throw( SQLException, RuntimeException )
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir 	m_xRowSet->afterLast();
1082cdf0e10cSrcweir }
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir //------------------------------------------------------------------------------
first()1085cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::first() throw( SQLException, RuntimeException )
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir 	return m_xRowSet->first();
1088cdf0e10cSrcweir }
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir //------------------------------------------------------------------------------
last()1091cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::last() throw( SQLException, RuntimeException )
1092cdf0e10cSrcweir {
1093cdf0e10cSrcweir 	return m_xRowSet->last();
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir //------------------------------------------------------------------------------
getRow()1097cdf0e10cSrcweir sal_Int32 SAL_CALL DatabaseDataProvider::getRow() throw( SQLException, RuntimeException )
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir 	return m_xRowSet->getRow();
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir //------------------------------------------------------------------------------
absolute(sal_Int32 row)1103cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir 	return m_xRowSet->absolute(row);
1106cdf0e10cSrcweir }
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir //------------------------------------------------------------------------------
relative(sal_Int32 rows)1109cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir 	return m_xRowSet->relative(rows);
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir 
1114cdf0e10cSrcweir //------------------------------------------------------------------------------
previous()1115cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::previous() throw( SQLException, RuntimeException )
1116cdf0e10cSrcweir {
1117cdf0e10cSrcweir 	return m_xRowSet->previous();
1118cdf0e10cSrcweir }
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir //------------------------------------------------------------------------------
refreshRow()1121cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::refreshRow() throw( SQLException, RuntimeException )
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir 	m_xRowSet->refreshRow();
1124cdf0e10cSrcweir }
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir //------------------------------------------------------------------------------
rowUpdated()1127cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::rowUpdated() throw( SQLException, RuntimeException )
1128cdf0e10cSrcweir {
1129cdf0e10cSrcweir 	return m_xRowSet->rowUpdated();
1130cdf0e10cSrcweir }
1131cdf0e10cSrcweir 
1132cdf0e10cSrcweir //------------------------------------------------------------------------------
rowInserted()1133cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::rowInserted() throw( SQLException, RuntimeException )
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir 	return m_xRowSet->rowInserted();
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir //------------------------------------------------------------------------------
rowDeleted()1139cdf0e10cSrcweir sal_Bool SAL_CALL DatabaseDataProvider::rowDeleted() throw( SQLException, RuntimeException )
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir 	return m_xRowSet->rowDeleted();
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir 
1144cdf0e10cSrcweir //------------------------------------------------------------------------------
getStatement()1145cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL DatabaseDataProvider::getStatement() throw( SQLException, RuntimeException )
1146cdf0e10cSrcweir {
1147cdf0e10cSrcweir 	return m_xRowSet->getStatement();
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir // -----------------------------------------------------------------------------
getParent()1150cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL DatabaseDataProvider::getParent(  ) throw (uno::RuntimeException)
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir     return m_xParent;
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir // -----------------------------------------------------------------------------
setParent(const uno::Reference<uno::XInterface> & _xParent)1155cdf0e10cSrcweir void SAL_CALL DatabaseDataProvider::setParent( const uno::Reference< uno::XInterface >& _xParent ) throw (lang::NoSupportException, uno::RuntimeException)
1156cdf0e10cSrcweir {
1157cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
1158cdf0e10cSrcweir     m_xParent = _xParent;
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir // -----------------------------------------------------------------------------
impl_invalidateParameter_nothrow()1161cdf0e10cSrcweir void DatabaseDataProvider::impl_invalidateParameter_nothrow()
1162cdf0e10cSrcweir {
1163cdf0e10cSrcweir     osl::MutexGuard g(m_aMutex);
1164cdf0e10cSrcweir     m_aParameterManager.clearAllParameterInformation();
1165cdf0e10cSrcweir }
1166cdf0e10cSrcweir // -----------------------------------------------------------------------------
1167cdf0e10cSrcweir } // namespace dbaccess
1168