summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-30 20:31:34 +0200
committerAndras Timar <andras.timar@collabora.com>2017-10-18 11:59:54 +0200
commit73c3f33f995d108bd10e7009655edae2d77c1534 (patch)
tree56a2e0435e5503615bf51fc13018166eafe71bba /sc
parent9b6320bb348ec3c0342c2c102cbcb34e62fe551f (diff)
Resolves: tdf#100822 use sax::Converter::parseDateTime() for 'd' ISO 8601 date
Instead of squeezing the string through the locale dependent number parser (which should force '.' Time100SecSeparator for 'T' ISO 8601 but apparently doesn't yet) that is a bottle neck anyway. Change-Id: I70f74e680322a715c9cc658c8be033620d9798e3 (cherry picked from commit 5374c04a89e1720490a3625dfd95406c2d60c0cd) Reviewed-on: https://gerrit.libreoffice.org/42971 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit d4dad2989071eb5a21d608aa5c3782a68fddf571)
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/oox/sheetdatabuffer.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index dbcc07d5db64..350f271c1be0 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -54,6 +54,7 @@
#include "documentimport.hxx"
#include "formulabuffer.hxx"
#include <numformat.hxx>
+#include <sax/tools/converter.hxx>
namespace oox {
namespace xls {
@@ -215,15 +216,17 @@ void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCod
void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& rDateString )
{
- ScDocument& rDoc = getScDocument();
- SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-
- double fValue = 0.0;
- sal_uInt32 nFormatIndex = 0;
- bool bValid = pFormatter->IsNumberFormat( rDateString, nFormatIndex, fValue );
+ css::util::DateTime aDateTime;
+ if (!sax::Converter::parseDateTime( aDateTime, nullptr, rDateString))
+ {
+ SAL_WARN("sc.filter", "SheetDataBuffer::setDateCell - could not parse: " << rDateString);
+ // At least don't lose data.
+ setStringCell( rModel, rDateString);
+ return;
+ }
- if(bValid)
- setValueCell( rModel, fValue );
+ double fSerial = getUnitConverter().calcSerialFromDateTime( aDateTime);
+ setValueCell( rModel, fSerial);
}
void SheetDataBuffer::createSharedFormula(const ScAddress& rAddr, const ApiTokenSequence& rTokens)