diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-03-01 16:36:18 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-03-01 16:36:51 +0100 |
commit | dff29fadfe418421f2af9fd4f1dccc8a9b4cd545 (patch) | |
tree | 711387c202fcb8724dfa8ea9ace43eb8246e7462 | |
parent | 6471204afda1de1bad014635bfd0fccc18f15946 (diff) |
import date cells from OOXML
Change-Id: Id0b9ec034d559d489ca4ee2d1d6aca1bdf1beb9d
-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() ) { |