[Libreoffice-commits] core.git: sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sat Mar 1 07:37:26 PST 2014
sc/source/filter/inc/sheetdatabuffer.hxx | 2 ++
sc/source/filter/oox/sheetdatabuffer.cxx | 13 +++++++++++++
sc/source/filter/oox/sheetdatacontext.cxx | 3 +++
3 files changed, 18 insertions(+)
New commits:
commit dff29fadfe418421f2af9fd4f1dccc8a9b4cd545
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Mar 1 16:36:18 2014 +0100
import date cells from OOXML
Change-Id: Id0b9ec034d559d489ca4ee2d1d6aca1bdf1beb9d
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx
index ceb3a80..f84f91c 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 b4839b2..668a74e 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 227c1d9..c22930f 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() )
{
More information about the Libreoffice-commits
mailing list