Kaydet (Commit) a1817251 authored tarafından Jianyuan Li's avatar Jianyuan Li

#121071#: [Regression]Item lists are incorrectly imported into AOO in DataPilot table

Reported by: Terry Yang
Reviewed by: sunying
patched by: Jianyuan Li
üst 5d9d5362
...@@ -853,17 +853,20 @@ bool XclImpPivotCache::IsRefreshOnLoad() const ...@@ -853,17 +853,20 @@ bool XclImpPivotCache::IsRefreshOnLoad() const
// Pivot table // Pivot table
// ============================================================================ // ============================================================================
XclImpPTItem::XclImpPTItem( const XclImpPCField* pCacheField ) : XclImpPTItem::XclImpPTItem( const XclImpPTField& rPTField ) :
mpCacheField( pCacheField ) mrPTField( rPTField )
{ {
} }
const String* XclImpPTItem::GetItemName() const const String* XclImpPTItem::GetItemName() const
{ {
if( mpCacheField ) if( const XclImpPCField * mpCacheField = mrPTField.GetCacheField() )
{
if( const XclImpPCItem* pCacheItem = mpCacheField->GetItem( maItemInfo.mnCacheIdx ) ) if( const XclImpPCItem* pCacheItem = mpCacheField->GetItem( maItemInfo.mnCacheIdx ) )
//! TODO: use XclImpPCItem::ConvertToText(), if all conversions are available {
return pCacheItem->IsEmpty() ? &String::EmptyString() : pCacheItem->GetText(); return pCacheItem->GetItemName();
}
}
return 0; return 0;
} }
...@@ -948,7 +951,7 @@ void XclImpPTField::ReadSxvdex( XclImpStream& rStrm ) ...@@ -948,7 +951,7 @@ void XclImpPTField::ReadSxvdex( XclImpStream& rStrm )
void XclImpPTField::ReadSxvi( XclImpStream& rStrm ) void XclImpPTField::ReadSxvi( XclImpStream& rStrm )
{ {
XclImpPTItemRef xItem( new XclImpPTItem( GetCacheField() ) ); XclImpPTItemRef xItem( new XclImpPTItem( *this ) );
maItems.push_back( xItem ); maItems.push_back( xItem );
xItem->ReadSxvi( rStrm ); xItem->ReadSxvi( rStrm );
} }
......
...@@ -158,6 +158,37 @@ const bool* XclPCItem::GetBool() const ...@@ -158,6 +158,37 @@ const bool* XclPCItem::GetBool() const
return (meType == EXC_PCITEM_BOOL) ? &mbValue : 0; return (meType == EXC_PCITEM_BOOL) ? &mbValue : 0;
} }
const String* XclPCItem::GetItemName() const
{
//! TODO: use XclImpPCItem::ConvertToText(), if all conversions are available
if( EXC_PCITEM_BOOL == this->GetType() )
{
static String szBool[] = { String::CreateFromAscii("FALSE"), String::CreateFromAscii("TRUE") };
if( const bool* pBool = this->GetBool() )
{
return &(!!*pBool)[szBool];
}
else
{
return &0[szBool];
}
}
else
{
if( this->IsEmpty())
{
static String aEmptyString( String::EmptyString() );
return &aEmptyString;
}
else
return this->GetText();
}
return NULL;
}
// Field settings ============================================================= // Field settings =============================================================
XclPCFieldInfo::XclPCFieldInfo() : XclPCFieldInfo::XclPCFieldInfo() :
......
...@@ -199,13 +199,14 @@ typedef ScfRef< XclImpPivotCache > XclImpPivotCacheRef; ...@@ -199,13 +199,14 @@ typedef ScfRef< XclImpPivotCache > XclImpPivotCacheRef;
// ============================================================================ // ============================================================================
class XclImpPivotTable; class XclImpPivotTable;
class XclImpPTField;
// ============================================================================ // ============================================================================
class XclImpPTItem class XclImpPTItem
{ {
public: public:
explicit XclImpPTItem( const XclImpPCField* pCacheField ); explicit XclImpPTItem( const XclImpPTField & );
/** Returns the internal name of the item or 0, if no name could be found. */ /** Returns the internal name of the item or 0, if no name could be found. */
const String* GetItemName() const; const String* GetItemName() const;
...@@ -220,7 +221,8 @@ public: ...@@ -220,7 +221,8 @@ public:
private: private:
XclPTItemInfo maItemInfo; /// General data for this item. XclPTItemInfo maItemInfo; /// General data for this item.
const XclImpPCField* mpCacheField; /// Corresponding pivot cache field. //const XclImpPCField* mpCacheField; /// Corresponding pivot cache field.
const XclImpPTField & mrPTField;
}; };
typedef ScfRef< XclImpPTItem > XclImpPTItemRef; typedef ScfRef< XclImpPTItem > XclImpPTItemRef;
......
...@@ -447,6 +447,7 @@ public: ...@@ -447,6 +447,7 @@ public:
const sal_uInt16* GetError() const; const sal_uInt16* GetError() const;
/** Returns pointer to Boolean value, if the item type is 'boolean', otherwise 0. */ /** Returns pointer to Boolean value, if the item type is 'boolean', otherwise 0. */
const bool* GetBool() const; const bool* GetBool() const;
const String * GetItemName() const;
private: private:
XclPCItemType meType; /// Type of the item. XclPCItemType meType; /// Type of the item.
......
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