diff options
author | Ocke Janssen <oj@openoffice.org> | 2011-03-14 11:06:22 +0100 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2011-03-14 11:06:22 +0100 |
commit | e76d571936cb4ba720070a5fbb1880200e242a2b (patch) | |
tree | 378495a0e6ad2137a3059c48d370dc4072558d81 /dbaccess | |
parent | 7ac57e56a25cb5ff3236553260987dc4894aa452 (diff) |
dba34d: #i116774# set date descriptions
Diffstat (limited to 'dbaccess')
-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 ab0ccc737a11..574139b78f76 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 ); |