Kaydet (Commit) 8f6e3118 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Allow dumping of internal states of pivot table objects for debugging.

Change-Id: I5021ef61d9238da352e13bdd81a2f3607d0fb4aa
üst eebc75ea
...@@ -406,6 +406,10 @@ public: ...@@ -406,6 +406,10 @@ public:
bool IntersectsTableByRows( SCCOL nCol, SCROW nRow1, SCROW nRow2, SCTAB nTab ) const; bool IntersectsTableByRows( SCCOL nCol, SCROW nRow1, SCROW nRow2, SCTAB nTab ) const;
bool HasTable( const ScRange& rRange ) const; bool HasTable( const ScRange& rRange ) const;
#if DEBUG_PIVOT_TABLE
void DumpTables() const;
#endif
private: private:
/** Only to be called from ScDPCache::RemoveReference(). */ /** Only to be called from ScDPCache::RemoveReference(). */
void RemoveCache(const ScDPCache* pCache); void RemoveCache(const ScDPCache* pCache);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <sal/types.h> #include <sal/types.h>
#include "scdllapi.h" #include "scdllapi.h"
#include "calcmacros.hxx"
namespace com { namespace sun { namespace star { namespace sheet { namespace com { namespace sun { namespace star { namespace sheet {
struct DataPilotFieldReference; struct DataPilotFieldReference;
...@@ -85,6 +86,10 @@ public: ...@@ -85,6 +86,10 @@ public:
void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xMember, void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xMember,
sal_Int32 nPosition ); sal_Int32 nPosition );
#if DEBUG_PIVOT_TABLE
void Dump(int nIndent = 0) const;
#endif
}; };
...@@ -222,6 +227,10 @@ public: ...@@ -222,6 +227,10 @@ public:
bool HasInvisibleMember() const; bool HasInvisibleMember() const;
void RemoveObsoleteMembers(const MemberSetType& rMembers); void RemoveObsoleteMembers(const MemberSetType& rMembers);
#if DEBUG_PIVOT_TABLE
void Dump(int nIndent = 0) const;
#endif
}; };
...@@ -357,6 +366,10 @@ public: ...@@ -357,6 +366,10 @@ public:
*/ */
SC_DLLPUBLIC bool HasInvisibleMember(const OUString& rDimName) const; SC_DLLPUBLIC bool HasInvisibleMember(const OUString& rDimName) const;
#if DEBUG_PIVOT_TABLE
void Dump() const;
#endif
private: private:
void CheckDuplicateName(ScDPSaveDimension& rDim); void CheckDuplicateName(ScDPSaveDimension& rDim);
void RemoveDuplicateNameCount(const OUString& rName); void RemoveDuplicateNameCount(const OUString& rName);
......
...@@ -3640,6 +3640,34 @@ bool ScDPCollection::HasTable( const ScRange& rRange ) const ...@@ -3640,6 +3640,34 @@ bool ScDPCollection::HasTable( const ScRange& rRange ) const
maTables.begin(), maTables.end(), FindIntersectingTable(rRange)) != maTables.end(); maTables.begin(), maTables.end(), FindIntersectingTable(rRange)) != maTables.end();
} }
#if DEBUG_PIVOT_TABLE
namespace {
struct DumpTable : std::unary_function<ScDPObject, void>
{
void operator() (const ScDPObject& rObj) const
{
cout << "-- '" << rObj.GetName() << "'" << endl;
ScDPSaveData* pSaveData = rObj.GetSaveData();
if (!pSaveData)
return;
pSaveData->Dump();
cout << endl; // blank line
}
};
}
void ScDPCollection::DumpTables() const
{
std::for_each(maTables.begin(), maTables.end(), DumpTable());
}
#endif
void ScDPCollection::RemoveCache(const ScDPCache* pCache) void ScDPCollection::RemoveCache(const ScDPCache* pCache)
{ {
if (maSheetCaches.remove(pCache)) if (maSheetCaches.remove(pCache))
......
...@@ -164,6 +164,30 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb ...@@ -164,6 +164,30 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
} }
} }
#if DEBUG_PIVOT_TABLE
void ScDPSaveMember::Dump(int nIndent) const
{
std::string aIndent(nIndent*4, ' ');
cout << aIndent << "* member name: '" << aName << "'" << endl;
cout << aIndent << " + layout name: ";
if (mpLayoutName)
cout << "'" << *mpLayoutName << "'";
else
cout << "(none)";
cout << endl;
cout << aIndent << " + visibility: ";
if (nVisibleMode == SC_DPSAVEMODE_DONTKNOW)
cout << "(unknown)";
else
cout << (nVisibleMode ? "visible" : "hidden");
cout << endl;
}
#endif
ScDPSaveDimension::ScDPSaveDimension(const OUString& rName, bool bDataLayout) : ScDPSaveDimension::ScDPSaveDimension(const OUString& rName, bool bDataLayout) :
aName( rName ), aName( rName ),
mpLayoutName(NULL), mpLayoutName(NULL),
...@@ -702,6 +726,51 @@ void ScDPSaveDimension::RemoveObsoleteMembers(const MemberSetType& rMembers) ...@@ -702,6 +726,51 @@ void ScDPSaveDimension::RemoveObsoleteMembers(const MemberSetType& rMembers)
maMemberList.swap(aNew); maMemberList.swap(aNew);
} }
#if DEBUG_PIVOT_TABLE
void ScDPSaveDimension::Dump(int nIndent) const
{
static const char* pOrientNames[] = { "hidden", "column", "row", "page", "data" };
std::string aIndent(nIndent*4, ' ');
cout << aIndent << "* dimension name: '" << aName << "'" << endl;
cout << aIndent << " + orientation: ";
if (nOrientation <= 4)
cout << pOrientNames[nOrientation];
else
cout << "(invalid)";
cout << endl;
cout << aIndent << " + layout name: ";
if (mpLayoutName)
cout << "'" << *mpLayoutName << "'";
else
cout << "(none)";
cout << endl;
cout << aIndent << " + subtotal name: ";
if (mpSubtotalName)
cout << "'" << *mpSubtotalName << "'";
else
cout << "(none)";
cout << endl;
cout << aIndent << " + is data layout: " << (bIsDataLayout ? "yes" : "no") << endl;
cout << aIndent << " + is duplicate: " << (bDupFlag ? "yes" : "no") << endl;
MemberList::const_iterator itMem = maMemberList.begin(), itMemEnd = maMemberList.end();
for (; itMem != itMemEnd; ++itMem)
{
ScDPSaveMember* pMem = *itMem;
pMem->Dump(nIndent+1);
}
cout << endl; // blank line
}
#endif
ScDPSaveData::ScDPSaveData() : ScDPSaveData::ScDPSaveData() :
pDimensionData( NULL ), pDimensionData( NULL ),
nColumnGrandMode( SC_DPSAVEMODE_DONTKNOW ), nColumnGrandMode( SC_DPSAVEMODE_DONTKNOW ),
...@@ -1354,6 +1423,20 @@ bool ScDPSaveData::HasInvisibleMember(const OUString& rDimName) const ...@@ -1354,6 +1423,20 @@ bool ScDPSaveData::HasInvisibleMember(const OUString& rDimName) const
return pDim->HasInvisibleMember(); return pDim->HasInvisibleMember();
} }
#if DEBUG_PIVOT_TABLE
void ScDPSaveData::Dump() const
{
DimsType::const_iterator itDim = aDimList.begin(), itDimEnd = aDimList.end();
for (; itDim != itDimEnd; ++itDim)
{
const ScDPSaveDimension& rDim = *itDim;
rDim.Dump();
}
}
#endif
void ScDPSaveData::CheckDuplicateName(ScDPSaveDimension& rDim) void ScDPSaveData::CheckDuplicateName(ScDPSaveDimension& rDim)
{ {
const OUString aName = ScDPUtil::getSourceDimensionName(rDim.GetName()); const OUString aName = ScDPUtil::getSourceDimensionName(rDim.GetName());
......
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