diff options
author | Ocke Janssen <oj@openoffice.org> | 2011-03-16 09:56:21 +0100 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2011-03-16 09:56:21 +0100 |
commit | a27d56208adb33e473ea39640f77437277b3595a (patch) | |
tree | 92c755bd3459120069c7f8266862774febf674b8 | |
parent | 4fadab268272467dc1de5b7ee9d0bb44a9210850 (diff) | |
parent | ab10119ec4d46ec4a5604c09edad4e8f97f3e9ca (diff) |
Automated merge with ssh://hg.services.openoffice.org/cws/dba34d
-rw-r--r-- | dbaccess/source/core/misc/DatabaseDataProvider.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index d093170ca..bba49beb3 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/sdb/XCompletedExecution.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> @@ -49,6 +50,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/chart/XDateCategories.hpp> #include <vector> #include <list> @@ -781,6 +783,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat } ::std::vector< ::rtl::OUString > aRowLabels; + ::std::vector< double > aDateRowLabels; ::std::vector< ::std::vector< double > > aDataValues; sal_Int32 nRowCount = 0; ::connectivity::ORowSetValue aValue; @@ -789,7 +792,16 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat ++nRowCount; aValue.fill( aColumns[0].nResultSetPosition, aColumns[0].nDataType, xRow ); - aRowLabels.push_back( aValue.getString() ); + switch(aColumns[0].nDataType) + { + case sdbc::DataType::DATE: + case sdbc::DataType::TIMESTAMP: + aDateRowLabels.push_back( aValue.getDouble() ); + break; + default: + aRowLabels.push_back( aValue.getString() ); + break; + } ::std::vector< double > aRow; for ( ColumnDescriptions::const_iterator col = aColumns.begin(); @@ -839,7 +851,16 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat } // if ( !nRowCount ) uno::Reference< chart::XChartDataArray> xData(m_xInternal,uno::UNO_QUERY); - xData->setRowDescriptions(uno::Sequence< ::rtl::OUString >(&(*aRowLabels.begin()),aRowLabels.size())); + if ( aDateRowLabels.empty() ) + { + xData->setRowDescriptions(uno::Sequence< ::rtl::OUString >(&(*aRowLabels.begin()),aRowLabels.size())); + } + else + { + uno::Reference< chart::XDateCategories> xDate(m_xInternal,uno::UNO_QUERY); + xDate->setDateCategories(uno::Sequence< double >(&(*aDateRowLabels.begin()),aDateRowLabels.size())); + } + const size_t nOffset = bFirstColumnIsCategory ? 1 : 0; uno::Sequence< ::rtl::OUString > aColumnDescriptions( aColumns.size() - nOffset ); |