[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source
Eike Rathke
erack at redhat.com
Sun Oct 1 18:59:20 UTC 2017
sc/source/filter/oox/sheetdatabuffer.cxx | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
New commits:
commit ffeaa487a9ba67eee816016e50b6092abb217003
Author: Eike Rathke <erack at redhat.com>
Date: Sat Sep 30 20:31:34 2017 +0200
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/42970
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 585a8a1bbcf6..e5ee2cf637fc 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -48,6 +48,7 @@
#include "documentimport.hxx"
#include "formulabuffer.hxx"
#include <numformat.hxx>
+#include <sax/tools/converter.hxx>
namespace oox {
namespace xls {
@@ -206,15 +207,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)
More information about the Libreoffice-commits
mailing list