diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-15 15:39:51 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-15 15:41:24 -0400 |
commit | 20d55ad66f0f94c9f6a583b5406a39717c1c6d46 (patch) | |
tree | 56c3f2233c75f736702af04bc0e132f56a2acdb0 /sc | |
parent | 4703758a075c56f308f9ddd7f970c1e8d928373c (diff) |
Consolidated file-local functions.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dpcache.cxx | 162 |
1 files changed, 79 insertions, 83 deletions
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 140885e73e30..08b0d2548475 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -62,89 +62,6 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; -namespace { - -void getItemValue( - ScDPItemData& rData, const Reference<sdbc::XRow>& xRow, sal_Int32 nType, - long nCol, const Date& rNullDate, short& rNumType) -{ - rNumType = NUMBERFORMAT_NUMBER; - try - { - double fValue = 0.0; - switch (nType) - { - case sdbc::DataType::BIT: - case sdbc::DataType::BOOLEAN: - { - rNumType = NUMBERFORMAT_LOGICAL; - fValue = xRow->getBoolean(nCol) ? 1 : 0; - rData.SetValue(fValue); - break; - } - case sdbc::DataType::TINYINT: - case sdbc::DataType::SMALLINT: - case sdbc::DataType::INTEGER: - case sdbc::DataType::BIGINT: - case sdbc::DataType::FLOAT: - case sdbc::DataType::REAL: - case sdbc::DataType::DOUBLE: - case sdbc::DataType::NUMERIC: - case sdbc::DataType::DECIMAL: - { - //! do the conversion here? - fValue = xRow->getDouble(nCol); - rData.SetValue(fValue); - break; - } - case sdbc::DataType::DATE: - { - rNumType = NUMBERFORMAT_DATE; - - util::Date aDate = xRow->getDate(nCol); - fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate; - rData.SetValue(fValue); - break; - } - case sdbc::DataType::TIME: - { - rNumType = NUMBERFORMAT_TIME; - - util::Time aTime = xRow->getTime(nCol); - fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + - aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; - rData.SetValue(fValue); - break; - } - case sdbc::DataType::TIMESTAMP: - { - rNumType = NUMBERFORMAT_DATETIME; - - util::DateTime aStamp = xRow->getTimestamp(nCol); - fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) + - ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + - aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; - rData.SetValue(fValue); - break; - } - case sdbc::DataType::CHAR: - case sdbc::DataType::VARCHAR: - case sdbc::DataType::LONGVARCHAR: - case sdbc::DataType::SQLNULL: - case sdbc::DataType::BINARY: - case sdbc::DataType::VARBINARY: - case sdbc::DataType::LONGVARBINARY: - default: - rData.SetString(xRow->getString(nCol)); - } - } - catch (uno::Exception&) - { - } -} - -} - ScDPCache::GroupItems::GroupItems() {} ScDPCache::GroupItems::GroupItems(const ScDPNumGroupInfo& rInfo) : @@ -282,6 +199,85 @@ void initFromCell(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, ScDPItem } } +void getItemValue( + ScDPItemData& rData, const Reference<sdbc::XRow>& xRow, sal_Int32 nType, + long nCol, const Date& rNullDate, short& rNumType) +{ + rNumType = NUMBERFORMAT_NUMBER; + try + { + double fValue = 0.0; + switch (nType) + { + case sdbc::DataType::BIT: + case sdbc::DataType::BOOLEAN: + { + rNumType = NUMBERFORMAT_LOGICAL; + fValue = xRow->getBoolean(nCol) ? 1 : 0; + rData.SetValue(fValue); + break; + } + case sdbc::DataType::TINYINT: + case sdbc::DataType::SMALLINT: + case sdbc::DataType::INTEGER: + case sdbc::DataType::BIGINT: + case sdbc::DataType::FLOAT: + case sdbc::DataType::REAL: + case sdbc::DataType::DOUBLE: + case sdbc::DataType::NUMERIC: + case sdbc::DataType::DECIMAL: + { + //! do the conversion here? + fValue = xRow->getDouble(nCol); + rData.SetValue(fValue); + break; + } + case sdbc::DataType::DATE: + { + rNumType = NUMBERFORMAT_DATE; + + util::Date aDate = xRow->getDate(nCol); + fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate; + rData.SetValue(fValue); + break; + } + case sdbc::DataType::TIME: + { + rNumType = NUMBERFORMAT_TIME; + + util::Time aTime = xRow->getTime(nCol); + fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + + aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + rData.SetValue(fValue); + break; + } + case sdbc::DataType::TIMESTAMP: + { + rNumType = NUMBERFORMAT_DATETIME; + + util::DateTime aStamp = xRow->getTimestamp(nCol); + fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) + + ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + + aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + rData.SetValue(fValue); + break; + } + case sdbc::DataType::CHAR: + case sdbc::DataType::VARCHAR: + case sdbc::DataType::LONGVARCHAR: + case sdbc::DataType::SQLNULL: + case sdbc::DataType::BINARY: + case sdbc::DataType::VARBINARY: + case sdbc::DataType::LONGVARBINARY: + default: + rData.SetString(xRow->getString(nCol)); + } + } + catch (uno::Exception&) + { + } +} + struct Bucket { ScDPItemData maValue; |