Kaydet (Commit) 98b4beeb authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Kohei Yoshida

Date field is now determined outside of ScDPItemData.

üst 244a9ef6
...@@ -84,8 +84,6 @@ public: ...@@ -84,8 +84,6 @@ public:
const rtl::OUString& GetString() const; const rtl::OUString& GetString() const;
double GetValue() const ; double GetValue() const ;
bool HasStringData() const ; bool HasStringData() const ;
bool IsDate() const;
void SetDate( bool b ) ;
sal_uInt8 GetType() const; sal_uInt8 GetType() const;
}; };
......
...@@ -94,9 +94,7 @@ bool ScDPItemData::operator==( const ScDPItemData& r ) const ...@@ -94,9 +94,7 @@ bool ScDPItemData::operator==( const ScDPItemData& r ) const
{ {
if ( IsValue() ) if ( IsValue() )
{ {
if ( IsDate() != r.IsDate() ) if ( r.IsValue() )
return false;
else if ( r.IsValue() )
return rtl::math::approxEqual( mfValue, r.mfValue ); return rtl::math::approxEqual( mfValue, r.mfValue );
else else
return false; return false;
...@@ -114,19 +112,7 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA, ...@@ -114,19 +112,7 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA,
if ( rA.IsValue() ) if ( rA.IsValue() )
{ {
if ( rB.IsValue() ) if ( rB.IsValue() )
{ return rA.mfValue < rB.mfValue ? -1 : 1;
if ( rtl::math::approxEqual( rA.mfValue, rB.mfValue ) )
{
if ( rA.IsDate() == rB.IsDate() )
return 0;
else
return rA.IsDate() ? 1: -1;
}
else if ( rA.mfValue < rB.mfValue )
return -1;
else
return 1;
}
else else
return -1; // values first return -1; // values first
} }
...@@ -178,17 +164,6 @@ bool ScDPItemData::HasStringData() const ...@@ -178,17 +164,6 @@ bool ScDPItemData::HasStringData() const
return IsHasData()&&!IsHasErr()&&!IsValue(); return IsHasData()&&!IsHasErr()&&!IsValue();
} }
bool ScDPItemData::IsDate() const
{
return !!(mbFlag&MK_DATE);
}
void ScDPItemData::SetDate( bool b )
{
b ? ( mbFlag |= MK_DATE ) : ( mbFlag &= ~MK_DATE );
}
ScDPItemDataPool::ScDPItemDataPool() ScDPItemDataPool::ScDPItemDataPool()
{ {
} }
......
...@@ -790,11 +790,16 @@ bool ScDPCache::IsDateDimension( long nDim ) const ...@@ -790,11 +790,16 @@ bool ScDPCache::IsDateDimension( long nDim ) const
if (nDim >= mnColumnCount) if (nDim >= mnColumnCount)
return false; return false;
const DataListType& rItems = maFields[nDim].maItems; SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
if (rItems.empty()) if (!pFormatter)
return false;
const std::vector<sal_uLong>& rNumFormats = maFields[nDim].maNumFormats;
if (rNumFormats.empty())
return false; return false;
return rItems[0].IsDate(); short eType = pFormatter->GetType(rNumFormats[0]);
return (eType == NUMBERFORMAT_DATE) || (eType == NUMBERFORMAT_DATETIME);
} }
SCROW ScDPCache::GetDimMemberCount( SCCOL nDim ) const SCROW ScDPCache::GetDimMemberCount( SCCOL nDim ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment