diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-19 15:46:50 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-19 15:46:50 +0100 |
commit | b86301a3311c67e4e322331295b04f6a1a9c765a (patch) | |
tree | 2083ec459f34038ed59641846c54edaa9c6da337 | |
parent | 91bc4841ef639a0e48449fab1f2a07920f2e5eba (diff) |
chart46: #i25706# implement date axis - #i116467# change behaviour of own data table
-rw-r--r-- | chart2/source/controller/dialogs/ObjectNameProvider.cxx | 9 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/Strings.src | 5 | ||||
-rw-r--r-- | chart2/source/inc/CommonFunctors.hxx | 13 | ||||
-rw-r--r-- | chart2/source/inc/Strings.hrc | 2 | ||||
-rwxr-xr-x | chart2/source/tools/AxisHelper.cxx | 58 |
5 files changed, 55 insertions, 32 deletions
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 257ff045f1161..483424d044978 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -191,14 +191,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal if( aX.getLength() == 0 ) { - rtl::OUString aCategory = ::rtl::OUString( String(SchResId(STR_TIP_CATEGORY_VALUE))); - - replaceParamterInString( aCategory - , C2U("%CATEGORYVALUE") - , ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex ) - ); - - aRet = aCategory; + aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex ); } else { diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index 4b4cec65426e3..ca511f08dbfe0 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -388,11 +388,6 @@ String STR_TIP_DATAPOINT_VALUES Text [ en-US ] = "Values: %POINTVALUES"; }; -String STR_TIP_CATEGORY_VALUE -{ - Text [ en-US ] = "'%CATEGORYVALUE'"; -}; - String STR_TIP_DATAPOINT { Text [ en-US ] = "Data Point %POINTNUMBER, data series %SERIESNUMBER, values: %POINTVALUES"; diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx index 13435741e63ed..eec5b59dd582e 100644 --- a/chart2/source/inc/CommonFunctors.hxx +++ b/chart2/source/inc/CommonFunctors.hxx @@ -67,18 +67,7 @@ struct OOO_DLLPUBLIC_CHARTTOOLS AnyToDouble : public ::std::unary_function< ::co ::rtl::math::setNan( & fResult ); ::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() ); - if( eClass == ::com::sun::star::uno::TypeClass_STRING ) - { - rtl_math_ConversionStatus eConversionStatus; - fResult = ::rtl::math::stringToDouble( - * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() ), - sal_Char( '.' ), sal_Char( ',' ), - & eConversionStatus, NULL ); - - if( eConversionStatus != rtl_math_ConversionStatus_Ok ) - ::rtl::math::setNan( & fResult ); - } - else if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE ) + if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE ) { fResult = * reinterpret_cast< const double * >( rAny.getValue() ); } diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index fa7917ff7c5ac..a5df51f813785 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -31,6 +31,7 @@ #include <svl/solar.hrc> //next free is 293 +//single free: 139 //#define RID_APP_START 30000 ////#define STR_NULL (RID_APP_START + 1) @@ -325,7 +326,6 @@ #define STR_TIP_DATAPOINT (RID_APP_START + 140) #define STR_TIP_DATAPOINT_INDEX (RID_APP_START + 141) #define STR_TIP_DATAPOINT_VALUES (RID_APP_START + 142) -#define STR_TIP_CATEGORY_VALUE (RID_APP_START + 139) //----------------------------------------------------------------------------- //warning and info boxes diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 3f1213e06155d..4fd21e2c3b8b7 100755 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -39,6 +39,7 @@ #include "DataSeriesHelper.hxx" #include "Scaling.hxx" #include "ChartModelHelper.hxx" +#include "DataSourceHelper.hxx" #include <tools/debug.hxx> #include <unotools/saveopt.hxx> @@ -52,6 +53,8 @@ // header for class OUStringBuffer #include <rtl/ustrbuf.hxx> +#include <rtl/math.hxx> + #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/lang/XServiceName.hpp> @@ -150,6 +153,12 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( , bool bSearchForParallelAxisIfNothingIsFound ) { sal_Int32 nNumberFormatKey(0); + bool bNumberFormatKeyFoundViaAttachedData = false; + sal_Int32 nAxisIndex = 0; + sal_Int32 nDimensionIndex = 1; + AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex ); + Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); if( xProp.is() && !( xProp->getPropertyValue( C2U( "NumberFormat" ) ) >>= nNumberFormatKey ) ) { @@ -172,7 +181,6 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( if( aData.Categories.is() ) { Reference< data::XDataSequence > xSeq( aData.Categories->getValues()); - Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY ); if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) ) nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 ); else @@ -180,6 +188,49 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( bFormatSet = true; } } + else if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() && nDimensionIndex == 0 ) //maybe date axis + { + Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram() ); + if( DiagramHelper::isSupportingDateAxis( xDiagram ) ) + { + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier ); + } + else + { + Reference< data::XDataSource > xSource( DataSourceHelper::getUsedData( xChartDoc ) ); + if( xSource.is() ) + { + ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aXValues( + DataSeriesHelper::getAllDataSequencesByRole( xSource->getDataSequences(), C2U("values-x"), true ) ); + if( aXValues.empty() ) + { + Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) ); + if( xCategories.is() ) + { + Reference< data::XDataSequence > xSeq( xCategories->getValues()); + if( xSeq.is() ) + { + bool bHasValidDoubles = false; + double fTest=0.0; + Sequence< uno::Any > aCats( xSeq->getData() ); + sal_Int32 nCount = aCats.getLength(); + for( sal_Int32 i = 0; i < nCount; ++i ) + { + if( (aCats[i]>>=fTest) && !::rtl::math::isNan(fTest) ) + { + bHasValidDoubles=true; + break; + } + } + if( bHasValidDoubles ) + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier ); + } + } + } + } + } + bFormatSet = true; + } } if( !bFormatSet ) @@ -187,16 +238,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( typedef ::std::map< sal_Int32, sal_Int32 > tNumberformatFrequency; tNumberformatFrequency aKeyMap; - bool bNumberFormatKeyFoundViaAttachedData = false; - sal_Int32 nAxisIndex = 0; - sal_Int32 nDimensionIndex = 1; - try { Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW ); if( xCTCnt.is() ) { - AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex ); ::rtl::OUString aRoleToMatch; if( nDimensionIndex == 0 ) aRoleToMatch = C2U("values-x"); |