summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/tools/DiagramHelper.cxx33
1 files changed, 2 insertions, 31 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 3dcbf4b2b17c..162bdf67169c 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1202,38 +1202,9 @@ sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XN
SAL_WARN("chart2", "DiagramHelper::getDateTimeInputNumberFormat - no SvNumberFormatter");
else
{
- // Categorize the format according to the implementation of
- // SvNumberFormatter::GetEditFormat(), making assumptions about what
- // would be time only.
- /* TODO: implement a method at SvNumberFormatter that does this and
- * call instead, if Chart isn't able transport the proper format of the
- * Axis, which of course would be much better.. */
short nType;
- if (0.0 <= fNumber && fNumber < 1.0)
- {
- // Clearly a time.
- nType = util::NumberFormat::TIME;
- nRet = pNumFormatter->GetFormatIndex( NF_TIME_HHMM, LANGUAGE_SYSTEM);
- }
- else if (fabs( fNumber) * 24 < 0x7fff)
- {
- // Assuming time within 32k hours or 3.7 years.
- nType = util::NumberFormat::TIME;
- nRet = pNumFormatter->GetFormatIndex( NF_TIME_HH_MMSS, LANGUAGE_SYSTEM);
- }
- else if (rtl::math::approxFloor( fNumber) != fNumber)
- {
- // Date+Time.
- nType = util::NumberFormat::DATETIME;
- nRet = pNumFormatter->GetFormatIndex( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, LANGUAGE_SYSTEM);
- }
- else
- {
- // Date only.
- nType = util::NumberFormat::DATE;
- nRet = pNumFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM);
- }
-
+ // Obtain best matching date, time or datetime format.
+ nRet = pNumFormatter->GuessDateTimeFormat( nType, fNumber, LANGUAGE_SYSTEM);
// Obtain the corresponding edit format.
nRet = pNumFormatter->GetEditFormat( fNumber, nRet, nType, LANGUAGE_SYSTEM, NULL);
}