diff options
-rw-r--r-- | sc/source/filter/inc/sheetdatabuffer.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatabuffer.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatacontext.cxx | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx index ceb3a8058e00..f84f91c39430 100644 --- a/sc/source/filter/inc/sheetdatabuffer.hxx +++ b/sc/source/filter/inc/sheetdatabuffer.hxx @@ -133,6 +133,8 @@ public: void setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode ); /** Inserts a formula cell into the sheet. */ void setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens ); + /** Inserts a ISO 8601 date cell into the sheet. */ + void setDateCell( const CellModel& rModel, const OUString& rDateString ); /** Inserts the passed token array as array formula. */ void createArrayFormula( diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index b4839b2c96dc..668a74ebec30 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -223,6 +223,19 @@ void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCod setCellFormat( rModel ); } +void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& rDateString ) +{ + ScDocument& rDoc = getScDocument(); + SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); + + double fValue = 0.0; + sal_uInt32 nFormatIndex; + bool bValid = pFormatter->IsNumberFormat( rDateString, nFormatIndex, fValue ); + + if(bValid) + setValueCell( rModel, fValue ); +} + void SheetDataBuffer::setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens ) { mbPendingSharedFmla = false; diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 227c1d9783f5..c22930f3feb6 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -215,6 +215,9 @@ void SheetDataContext::onEndElement() case XML_s: mrSheetData.setStringCell( maCellData, maCellValue.toInt32() ); break; + case XML_d: + mrSheetData.setDateCell( maCellData, maCellValue ); + break; } else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr.get() ) { |