summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-08-12 14:29:25 +0200
committerEike Rathke <erack@redhat.com>2015-08-12 14:34:28 +0200
commit9d370f2bb9f2af1b3acc1531f1e71b0ded36e40f (patch)
treecae00f9ac8dc70ff398167aad3bba66bbed53715 /chart2
parentc1c142dc64f96791ebbaf03caeb3ff1852a7598f (diff)
move date/time guess work to SvNumberFormatter::GuessDateTimeFormat()
Change-Id: I26f7c47f5b3cf4a3c4274832448d9c8076981af0
Diffstat (limited to 'chart2')
-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);
}