diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-04-26 17:14:11 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-04-26 17:14:11 -0400 |
commit | b26ccbb70a2337d1f5289d20d72049940be13f20 (patch) | |
tree | 5974d8de6febbfe1b7b2a12a0e19ecd676231808 /sc | |
parent | 597bd66fc63ad5517bfe9f53b7244191274ba2cc (diff) |
n#677917: Try a bit harder to determine the number format of a dimension.
The old code always took the number format of the first member of the
dimension. We should at least try the first 10 members to determine
what number format to use.
BTW this is just a stop-gap measure; to fix it properly we need to
use a better cache table structure that properly marks empty cells.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dptablecache.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index d6981cfa85c8..6039d87235c1 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -932,7 +932,22 @@ sal_uLong ScDPCache::GetNumberFormat( long nDim ) const if (maTableDataValues[nDim].empty()) return 0; - return maTableDataValues[nDim][0].nNumFormat; + // TODO: This is very ugly, but the best we can do right now. Check the + // first 10 dimension members, and take the first non-zero number format, + // else return the default number format (of 0). For the long-term, we + // need to redo this cache structure to properly indicate empty cells, and + // skip them when trying to determine the representative number format for + // a dimension. + size_t nCount = maTableDataValues[nDim].size(); + if (nCount > 10) + nCount = 10; + for (size_t i = 0; i < nCount; ++i) + { + sal_uLong n = maTableDataValues[nDim][i].nNumFormat; + if (n) + return n; + } + return 0; } bool ScDPCache::IsDateDimension( long nDim ) const |