diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-12 14:36:07 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-12 14:36:07 +0100 |
commit | bb15dfd763af19c547a27c40882d9cdf1477f375 (patch) | |
tree | c61f11f2407c0ca3ab3072db2415984df595b7d5 /chart2/source/tools | |
parent | 9a8ff5c2508f78394dfda2e22c0b3b600000a284 (diff) |
chart46: #i25706# implement date axis - #i116425# interpret no data as text axis
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/ExplicitCategoriesProvider.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index c1b3ae4daf39..1c52a3c3e622 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -412,6 +412,7 @@ bool lcl_isDateFormat( sal_Int32 nNumberFormat, const Reference< util::XNumberFo bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< DatePlusIndex >& rDateCategories, bool bIsAutoDate, Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier ) { bool bOnlyDatesFound = true; + bool bAnyDataFound = false; if( xDataSequence.is() ) { @@ -451,18 +452,28 @@ bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataS else bIsDate = true; + bool bContainsEmptyString = false; + bool bContainsNan = false; uno::Any aAny = aValues[nN]; + if( aAny.hasValue() ) + { + OUString aTest; + double fTest; + if( (aAny>>=aTest) && !aTest.getLength() ) //empty String + bContainsEmptyString = true; + else if( (aAny>>=fTest) && ::rtl::math::isNan(fTest) ) + bContainsNan = true; + + if( !bContainsEmptyString && !bContainsNan ) + bAnyDataFound = true; + } DatePlusIndex aDatePlusIndex( 1.0, nN ); if( bIsDate && (aAny >>= aDatePlusIndex.fValue) ) rDateCategories.push_back( aDatePlusIndex ); else { - if( aAny.hasValue() ) - { - OUString aTest; - if( !( (aAny>>=aTest) && !aTest.getLength() ) )//empty string does not count as non date value! - bOnlyDatesFound=false; - } + if( aAny.hasValue() && !bContainsEmptyString )//empty string does not count as non date value! + bOnlyDatesFound=false; ::rtl::math::setNan( &aDatePlusIndex.fValue ); rDateCategories.push_back( aDatePlusIndex ); } @@ -470,7 +481,7 @@ bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataS ::std::sort( rDateCategories.begin(), rDateCategories.end(), DatePlusIndexComparator() ); } - return bOnlyDatesFound; + return bAnyDataFound && bOnlyDatesFound; } void ExplicitCategoriesProvider::init() |