Commit e01c09bc authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - olap ..

parent 069544bf
......@@ -53,7 +53,6 @@ BaseObjectPtr SXStreamID::clone()
void SXStreamID::readFields(CFRecord& record)
{
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
record >> idStm;
}
......
......@@ -60,7 +60,7 @@ void SXTH::readFields(CFRecord& record)
record >> stUnique >> stDisplay >> stDefault >> stAll >> stDimension;
record >> cisxvd;
for (int i = 0; i < cisxvd; i++)
for (_UINT32 i = 0; i < cisxvd; i++)
{
if (record.getRdPtr() + 4 > record.getDataSize())
break;
......@@ -69,7 +69,7 @@ void SXTH::readFields(CFRecord& record)
rgisxvd.push_back(val);
}
record >> cHiddenMemberSets;
for (int i = 0; i < cHiddenMemberSets; i++)
for (_UINT32 i = 0; i < cHiddenMemberSets; i++)
{
HiddenMemberSet val;
record >> val;
......@@ -94,5 +94,82 @@ void SXTH::readFields(CFRecord& record)
fDragToHide = GETBIT(flags2, 4);
}
int SXTH::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"cacheHierarchy")
{
CP_XML_ATTR(L"uniqueName", stUnique.value());
CP_XML_ATTR(L"caption", stDisplay.value());
if (fMeasure)
{
CP_XML_ATTR(L"measure", true);
//CP_XML_ATTR(L"measureGroup", stDimension.value());
if (cisxvd > 0)
CP_XML_ATTR(L"oneField", cisxvd);
}
else
{
CP_XML_ATTR(L"attribute", !fKeyAttributeHierarchy);
//keyAttribute
CP_XML_ATTR(L"defaultMemberUniqueName", stDefault.value());
CP_XML_ATTR(L"allUniqueName", stAll.value());
CP_XML_ATTR(L"dimensionUniqueName", stDimension.value());
CP_XML_ATTR(L"unbalanced", 0);//SXAddl_SXCHierarchy_SXDInfo12
//hidden
}
CP_XML_ATTR(L"count", 0);//levels in this hierarchy.
if (cisxvd > 0)
{
CP_XML_NODE(L"fieldsUsage")
{
CP_XML_ATTR(L"count", cisxvd);
for (size_t i = 0; i < rgisxvd.size(); i++)
{
CP_XML_NODE(L"fieldUsage")
{
CP_XML_ATTR(L"x", rgisxvd[i]);
}
}
}
}
}
}
//bool fMeasure;
//bool fOutlineMode;
//bool fEnableMultiplePageItems;
//bool fSubtotalAtTop;
//bool fSet;
//bool fDontShowFList;
//bool fAttributeHierarchy;
//bool fTimeHierarchy;
//bool fFilterInclusive;
//bool fKeyAttributeHierarchy;
//bool fKPI;
//SXAxis sxaxis;
//_INT32 isxvd;
//_INT32 csxvdXl;
//bool fDragToRow;
//bool fDragToColumn;
//bool fDragToPage;
//bool fDragToData;
//bool fDragToHide;
//XLUnicodeString stUnique;
//XLUnicodeString stDisplay;
//XLUnicodeString stDefault;
//XLUnicodeString stAll;
//XLUnicodeString stDimension;
//
//_UINT32 cisxvd;
//std::vector<_INT32> rgisxvd;
//_UINT32 cHiddenMemberSets;
//std::vector<HiddenMemberSet> rgHiddenMemberSets;
return 0;
}
} // namespace XLS
......@@ -52,6 +52,7 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXTH;
......
......@@ -40,6 +40,9 @@
#include "../Biff_records/ExtString.h"
#include "../Biff_records/DConn.h"
#include "../Biff_structures/DConnConnectionWeb.h"
#include "../Biff_structures/DConnConnectionOleDb.h"
namespace XLS
{
......@@ -190,20 +193,9 @@ const bool DBQUERY::loadContent(BinProcessor& proc)
int DBQUERY::serialize(std::wostream & strm)
{
std::wstring name, desc;
if (global_info->connectionId < global_info->arDConn.size())
//todooo + поиск по совпадению типа
{
DConn* dcon = dynamic_cast<DConn*>(global_info->arDConn[global_info->connectionId].get());
if (dcon)
{
name = dcon->rgchConnectionName.strTotal;
desc = dcon->rgchConnectionDesc.strTotal;
}
}
std::wstring name;
int connectionId = serialize_connection(name, desc);
int connectionId = serialize_connection(name);
CP_XML_WRITER(strm)
{
......@@ -216,28 +208,43 @@ int DBQUERY::serialize(std::wostream & strm)
return 0;
}
int DBQUERY::serialize_connection(std::wstring & name, std::wstring desc)
int DBQUERY::serialize_connection(std::wstring & name)
{
DbOrParamQry* dbQry = dynamic_cast<DbOrParamQry*>(m_DbQry.get());
if (!dbQry) return -1;
DConn* dcon = dynamic_cast<DConn*>(m_DConn.get());
++global_info->connectionId;
if (dcon && name.empty())
{
name = dcon->rgchConnectionName.strTotal;
}
if (name.empty())
name = L"Connection" + std::to_wstring(global_info->connectionId);
DBQUERYEXT *query_ext = dynamic_cast<DBQUERYEXT*>(m_DBQUERYEXT.get());
DBQueryExt *dbQry_ext = query_ext ? dynamic_cast<DBQueryExt*>(query_ext->m_DBQueryExt.get()) : NULL;
DConnConnectionWeb *webDb = dcon ? dynamic_cast<DConnConnectionWeb*>(dcon->connection.get()) : NULL;
DConnConnectionOleDb *oleDb = dcon ? dynamic_cast<DConnConnectionOleDb*>(dcon->connection.get()) : NULL;
XLUnicodeStringSegmented*adoDb = dcon ? dynamic_cast<XLUnicodeStringSegmented*>(dcon->connection.get()) : NULL;
CP_XML_WRITER(global_info->connections_stream)
{
CP_XML_NODE(L"connection")
{
CP_XML_ATTR(L"id", global_info->connectionId);
if ( dbQry->query.dbt == 5 )
{
CP_XML_ATTR(L"keepAlive", 1);
}
CP_XML_ATTR(L"name", name);
if (!desc.empty())
if ((dcon) && (!dcon->rgchConnectionDesc.strTotal.empty()))
{
CP_XML_ATTR(L"description", desc);
CP_XML_ATTR(L"description", dcon->rgchConnectionDesc.strTotal);
}
CP_XML_ATTR(L"type", dbQry->query.dbt);
......@@ -291,6 +298,7 @@ int DBQUERY::serialize_connection(std::wstring & name, std::wstring desc)
else
{
size_t index = 0;
size_t commandType = 1;
CP_XML_NODE(L"dbPr")
{
......@@ -322,6 +330,16 @@ int DBQUERY::serialize_connection(std::wstring & name, std::wstring desc)
CP_XML_ATTR(L"connection", connection);
CP_XML_ATTR(L"command", command);
if (commandType > 0)
CP_XML_ATTR(L"commandType", commandType);
}
if (oleDb)
{
CP_XML_NODE(L"olapPr")
{
CP_XML_ATTR(L"sendLocale", 1);
CP_XML_ATTR(L"rowDrillCount", oleDb->nDrillthroughRows);
}
}
}
}
......
......@@ -56,7 +56,7 @@ public:
int serialize(std::wostream & stream);
int serialize_connection(std::wstring & name, std::wstring desc);
int serialize_connection(std::wstring & name);
BaseObjectPtr m_DbQry;
......@@ -66,6 +66,8 @@ public:
std::vector<std::wstring> m_arSXString;
//------------------------------------------------------
BaseObjectPtr m_DBQUERYEXT;
BaseObjectPtr m_DConn;
GlobalWorkbookInfoPtr global_info;
};
......
......@@ -31,19 +31,19 @@
*/
#include "DVAXIS.h"
#include <Logic/Biff_records/Axis.h>
#include <Logic/Biff_records/Begin.h>
#include <Logic/Biff_records/ValueRange.h>
#include <Logic/Biff_unions/AXM.h>
#include <Logic/Biff_unions/AXS.h>
#include <Logic/Biff_unions/CRTMLFRT.h>
#include <Logic/Biff_records/End.h>
#include <Logic/Biff_records/CatSerRange.h>
#include <Logic/Biff_records/Tick.h>
#include <Logic/Biff_records/FontX.h>
#include <Logic/Biff_records/AxisLine.h>
#include <Logic/Biff_records/LineFormat.h>
#include "AXM.h"
#include "AXS.h"
#include "CRTMLFRT.h"
#include "../Biff_records/Axis.h"
#include "../Biff_records/Begin.h"
#include "../Biff_records/ValueRange.h"
#include "../Biff_records/End.h"
#include "../Biff_records/CatSerRange.h"
#include "../Biff_records/Tick.h"
#include "../Biff_records/FontX.h"
#include "../Biff_records/AxisLine.h"
#include "../Biff_records/LineFormat.h"
namespace XLS
{
......
......@@ -35,10 +35,12 @@
#include "SXFMLA_bu.h"
#include "SXOPER.h"
#include "SXRANGE.h"
#include "PIVOTTH.h"
#include "../Biff_records/SXVDTEx.h"
#include "../Biff_records/SXFDB.h"
#include "../Biff_records/SXFDBType.h"
#include "../Biff_records/SxIsxoper.h"
#include "../Biff_records/SXTH.h"
namespace XLS
{
......@@ -103,8 +105,7 @@ const bool FDB::loadContent(BinProcessor& proc)
{
return false;
}
m_SXFDB = elements_.back();
elements_.pop_back();
m_SXFDB = elements_.back(); elements_.pop_back();
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
......@@ -190,6 +191,21 @@ int FDB::serialize(std::wostream & strm, bool bSql, bool bDBB)
{
CP_XML_ATTR(L"name", fdb->stFieldName.value());
if (m_SXVDTEx)
{
SXVDTEx *olap_info = dynamic_cast<SXVDTEx*>(m_SXVDTEx.get());
if ((olap_info) && (olap_info->isxth >= 0))
{
CP_XML_ATTR(L"hierarchy", olap_info->isxth);
CP_XML_ATTR(L"level", olap_info->isxtl);
PIVOTTH* ht = dynamic_cast<PIVOTTH*>(m_arPIVOTTH[olap_info->isxth].get());
SXTH* sxTH = dynamic_cast<SXTH*>(ht->m_SXTH.get());
CP_XML_ATTR(L"caption", sxTH->stDisplay.value());
}
}
if (bSql)
{
CP_XML_ATTR(L"numFmtId", 0);
......
......@@ -67,9 +67,11 @@ public:
bool bEmpty;
bool bInteger;
bool bBool;
//-----------------------------------------------------------
int index;
GlobalWorkbookInfoPtr global_info;
BaseObjectPtr m_SXVDTEx; // olap info
std::vector<BaseObjectPtr> m_arPIVOTTH;//olap captions
};
} // namespace XLS
......
......@@ -31,8 +31,8 @@
*/
#include "MDBLOCK.h"
#include <Logic/Biff_records/MDB.h>
#include <Logic/Biff_records/ContinueFrt12.h>
#include "../Biff_records/MDB.h"
#include "../Biff_records/ContinueFrt12.h"
namespace XLS
{
......@@ -61,6 +61,7 @@ const bool MDBLOCK::loadContent(BinProcessor& proc)
{
return false;
}
m_MDB = elements_.back(); elements_.pop_back();
proc.repeated<ContinueFrt12>(0, 0);
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of MDBLOCK union of records
class MDBLOCK: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(MDBLOCK)
......@@ -50,6 +48,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeMDBLOCK;
BaseObjectPtr m_MDB;
};
} // namespace XLS
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of MDTINFO union of records
class MDTINFO: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(MDTINFO)
......@@ -50,6 +48,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeMDTINFO;
BaseObjectPtr m_MDTInfo;
};
} // namespace XLS
......
......@@ -61,6 +61,7 @@ const bool MDTINFO::loadContent(BinProcessor& proc)
{
return false;
}
m_MDTInfo = elements_.back(); elements_.pop_back();
proc.repeated<ContinueFrt12>(0, 0);
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of MDXSTR union of records
class MDXSTR: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(MDXSTR)
......@@ -50,6 +48,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeMDXSTR;
BaseObjectPtr m_MDXStr;
};
} // namespace XLS
......
......@@ -31,8 +31,8 @@
*/
#include "MDXSTR.h"
#include <Logic/Biff_records/MDXStr.h>
#include <Logic/Biff_records/ContinueFrt12.h>
#include "../Biff_records/MDXStr.h"
#include "../Biff_records/ContinueFrt12.h"
namespace XLS
{
......@@ -61,6 +61,8 @@ const bool MDXSTR::loadContent(BinProcessor& proc)
{
return false;
}
m_MDXStr = elements_.back(); elements_.pop_back();
proc.repeated<ContinueFrt12>(0, 0);
return true;
}
......
......@@ -31,9 +31,10 @@
*/
#include "MDXTUPLESET.h"
#include <Logic/Biff_records/MDXTuple.h>
#include <Logic/Biff_records/MDXSet.h>
#include <Logic/Biff_records/ContinueFrt12.h>
#include "../Biff_records/MDXTuple.h"
#include "../Biff_records/MDXSet.h"
#include "../Biff_records/ContinueFrt12.h"
namespace XLS
{
......@@ -65,6 +66,8 @@ const bool MDXTUPLESET::loadContent(BinProcessor& proc)
return false;
}
}
m_MDXVarious = elements_.back(); elements_.pop_back();
proc.repeated<ContinueFrt12>(0, 0);
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of MDXTUPLESET union of records
class MDXTUPLESET: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(MDXTUPLESET)
......@@ -50,6 +48,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeMDXTUPLESET;
BaseObjectPtr m_MDXVarious;
};
} // namespace XLS
......
......@@ -31,12 +31,13 @@
*/
#include "METADATA.h"
#include <Logic/Biff_unions/MDTINFO.h>
#include <Logic/Biff_unions/MDXSTR.h>
#include <Logic/Biff_unions/MDBLOCK.h>
#include <Logic/Biff_unions/MDXTUPLESET.h>
#include <Logic/Biff_records/MDXProp.h>
#include <Logic/Biff_records/MDXKPI.h>
#include "MDTINFO.h"
#include "MDXSTR.h"
#include "MDBLOCK.h"
#include "MDXTUPLESET.h"
#include "../Biff_records/MDXProp.h"
#include "../Biff_records/MDXKPI.h"
namespace XLS
{
......@@ -51,7 +52,6 @@ METADATA::~METADATA()
{
}
class Parenthesis_METADATA_1: public ABNFParenthesis
{
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_METADATA_1)
......@@ -86,11 +86,34 @@ BaseObjectPtr METADATA::clone()
// METADATA = *MDTINFO *MDXSTR *(MDXTUPLESET / MDXProp / MDXKPI) *MDBLOCK
const bool METADATA::loadContent(BinProcessor& proc)
{
if(
proc.repeated<MDTINFO>(0, 0) ||
proc.repeated<MDXSTR>(0, 0) ||
proc.repeated<Parenthesis_METADATA_1>(0, 0) ||
proc.repeated<MDBLOCK>(0, 0))
int count1 = proc.repeated<MDTINFO>(0, 0);
while(!elements_.empty())
{
m_arMDTINFO.insert(m_arMDTINFO.begin(), elements_.back());
elements_.pop_back();
}
int count2 = proc.repeated<MDXSTR>(0, 0);
while(!elements_.empty())
{
m_arMDXSTR.insert(m_arMDTINFO.begin(), elements_.back());
elements_.pop_back();
}
int count3 = proc.repeated<Parenthesis_METADATA_1>(0, 0);
while(!elements_.empty())
{
m_arMDTSET.insert(m_arMDTINFO.begin(), elements_.back());
elements_.pop_back();
}
int count4 = proc.repeated<MDBLOCK>(0, 0);
while(!elements_.empty())
{
m_arMDBLOCK.insert(m_arMDTINFO.begin(), elements_.back());
elements_.pop_back();
}
if (count1 > 0 || count2 > 0 || count3 > 0 || count4 > 0)
{
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of METADATA union of records
class METADATA: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(METADATA)
......@@ -50,6 +48,12 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeMETADATA;
std::vector<BaseObjectPtr> m_arMDTINFO;
std::vector<BaseObjectPtr> m_arMDXSTR;
std::vector<BaseObjectPtr> m_arMDTSET;
std::vector<BaseObjectPtr> m_arMDBLOCK;
};
} // namespace XLS
......
......@@ -35,6 +35,9 @@
#include "SXSRC.h"
#include "SXADDLCACHE.h"
#include "FDB.h"
#include "DBQUERY.h"
#include "PIVOTVIEWEX.h"
#include "PIVOTVDTEX.h"
#include "../Biff_records/SXStreamID.h"
#include "../Biff_records/SXVS.h"
......@@ -93,6 +96,7 @@ const bool PIVOTCACHEDEFINITION::loadContent(BinProcessor& proc)
m_SXADDLCACHE = elements_.back();
elements_.pop_back();
}
return true;
}
int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
......@@ -123,6 +127,18 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
bool bSql = src ? src->bSql : false;
bool bOLAP = src ? src->bOLAP : false;
DBQUERY * db_query = src ? dynamic_cast<DBQUERY *>(src->m_source.get()) : NULL;
if (db_query)
{
std::map<int, BaseObjectPtr>::iterator pFind = global_info_->mapIdConnection.find(streamId->idStm);
if (pFind != global_info_->mapIdConnection.end())
{
db_query->m_DConn = pFind->second;
}
}
PIVOTVIEWEX *olap_view = bOLAP ? dynamic_cast<PIVOTVIEWEX *>(m_PIVOTVIEWEX.get()) : NULL;
CP_XML_WRITER(strm)
{
......@@ -160,6 +176,14 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get());
if (!field) continue;
if (olap_view)
{
PIVOTVDTEX *ex = dynamic_cast<PIVOTVDTEX*>(olap_view->m_arPIVOTVDTEX[i].get());
field->m_SXVDTEx = ex->m_SXVDTEx;
field->m_arPIVOTTH = olap_view->m_arPIVOTTH;
}
field->serialize(CP_XML_STREAM(), bSql, !pivot_cache->m_arDBB.empty());
}
}
......@@ -176,6 +200,10 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
}
}
}
if (bOLAP)
{
olap_view->serialize(CP_XML_STREAM());
}
}
}
return 0;
......
......@@ -58,8 +58,9 @@ public:
BaseObjectPtr m_SXVS;
BaseObjectPtr m_SXSRC;
BaseObjectPtr m_SXADDLCACHE;
//--------------------------------------------------------------------------
GlobalWorkbookInfoPtr global_info_;
BaseObjectPtr m_PIVOTVIEWEX;
};
} // namespace XLS
......
......@@ -43,7 +43,7 @@
namespace XLS
{
PIVOTCORE::PIVOTCORE()
PIVOTCORE::PIVOTCORE() : bOLAP( false)
{
}
......@@ -102,11 +102,6 @@ const bool PIVOTCORE::loadContent(BinProcessor& proc)
{
m_arPIVOTLI.push_back(elements_.front()); elements_.pop_front();
}
//count = proc.repeated<PIVOTLI>(0, 0);
//while(count--)
//{
// m_arPIVOTLI.push_back(elements_.front()); elements_.pop_front();
//}
if (proc.mandatory<PIVOTEX>())
{
......
......@@ -56,7 +56,8 @@ public:
std::vector<BaseObjectPtr> m_arSXDI;
std::vector<BaseObjectPtr> m_arPIVOTLI;
BaseObjectPtr m_PIVOTEX;
//--------------------------------------------------
bool bOLAP;
};
} // namespace XLS
......
......@@ -31,8 +31,9 @@
*/
#include "PIVOTTH.h"
#include <Logic/Biff_records/SXTH.h>
#include <Logic/Biff_records/ContinueFrt.h>
#include "../Biff_records/SXTH.h"
#include "../Biff_records/ContinueFrt.h"
namespace XLS
{
......@@ -61,8 +62,14 @@ const bool PIVOTTH::loadContent(BinProcessor& proc)
{
return false;
}
proc.repeated<ContinueFrt>(0, 0);
m_SXTH = elements_.front(); elements_.pop_front();
int count = proc.repeated<ContinueFrt>(0, 0);
while(count--)
{
m_arContinueFrt.insert(m_arContinueFrt.begin(), elements_.back());
elements_.pop_back();
}
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of PIVOTTH union of records
class PIVOTTH: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTTH)
......@@ -50,6 +48,10 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typePIVOTTH;
BaseObjectPtr m_SXTH;
std::vector<BaseObjectPtr> m_arContinueFrt;
};
} // namespace XLS
......
......@@ -31,8 +31,8 @@
*/
#include "PIVOTVDTEX.h"
#include <Logic/Biff_records/SXVDTEx.h>
#include <Logic/Biff_records/ContinueFrt.h>
#include "../Biff_records/SXVDTEx.h"
#include "../Biff_records/ContinueFrt.h"
namespace XLS
{
......@@ -61,6 +61,8 @@ const bool PIVOTVDTEX::loadContent(BinProcessor& proc)
{
return false;
}
m_SXVDTEx = elements_.back(); elements_.pop_back();
proc.repeated<ContinueFrt>(0, 0);
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of PIVOTVDTEX union of records
class PIVOTVDTEX: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTVDTEX)
......@@ -50,6 +48,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typePIVOTVDTEX;
BaseObjectPtr m_SXVDTEx;
};
} // namespace XLS
......
......@@ -53,6 +53,7 @@
#include "../Biff_records/SxDXF.h"
#include "../Biff_records/SXViewEx9.h"
#include "../Biff_records/SXStreamID.h"
#include "../Biff_records/QsiSXTag.h"
namespace XLS
{
......@@ -111,10 +112,18 @@ const bool PIVOTVIEW::loadContent(BinProcessor& proc)
PIVOTFRT9* frt9 = frt ? dynamic_cast<PIVOTFRT9*>(frt->m_PIVOTFRT9.get()) : NULL;
DBQUERY * db_query = dynamic_cast<DBQUERY *>(src->m_source.get());
if (frt9)
DBQUERY * db_query = dynamic_cast<DBQUERY*>(src->m_source.get());
if (db_query && frt9)
{
QsiSXTag *qsiTag =dynamic_cast<QsiSXTag*>(frt9->m_QsiSXTag.get());
if (qsiTag->fTensorEx)
{
//OLAP !!!
src->bOLAP = true;
core->bOLAP = true;
}
db_query->m_DBQUERYEXT = frt9->m_DBQUERYEXT;
pivot_cache->m_PIVOTVIEWEX = frt9->m_PIVOTVIEWEX;
}
}
}
......@@ -227,8 +236,8 @@ int PIVOTVIEW::serialize(std::wostream & strm)
}
}
}
int index_ivd = 0;
int index_tli = 0;
size_t index_ivd = 0;
size_t index_tli = 0;
if (view->cDimRw > 0 && index_ivd < core->m_arPIVOTIVD.size())
{
......
......@@ -31,10 +31,13 @@
*/
#include "PIVOTVIEWEX.h"
#include <Logic/Biff_records/SXViewEx.h>
#include <Logic/Biff_records/SXPIEx.h>
#include <Logic/Biff_unions/PIVOTTH.h>
#include <Logic/Biff_unions/PIVOTVDTEX.h>
#include "PIVOTTH.h"
#include "PIVOTVDTEX.h"
#include "../Biff_records/SXTH.h"
#include "../Biff_records/SXViewEx.h"
#include "../Biff_records/SXPIEx.h"
#include "../Biff_records/SXVDTEx.h"
namespace XLS
{
......@@ -59,8 +62,7 @@ const bool PIVOTVIEWEX::loadContent(BinProcessor& proc)
{
return false;
}
m_SXViewEx = elements_.back();
elements_.pop_back();
m_SXViewEx = elements_.back(); elements_.pop_back();
int count = 0;
count = proc.repeated<PIVOTTH>(0, 0);
......@@ -83,6 +85,143 @@ const bool PIVOTVIEWEX::loadContent(BinProcessor& proc)
return true;
}
int PIVOTVIEWEX::serialize(std::wostream & strm)
{
if (m_arPIVOTTH.empty()) return 0;
std::unordered_map<std::wstring, std::vector<int>> mapDimensions;
std::unordered_map<std::wstring, std::vector<int>> mapMeasures;
std::unordered_map<std::wstring, std::vector<int>> mapKpis;
std::unordered_map<std::wstring, std::vector<int>> mapNamed;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"cacheHierarchies")
{
CP_XML_ATTR(L"count", m_arPIVOTTH.size());
for (size_t i = 0; i < m_arPIVOTTH.size(); i++)
{
PIVOTTH* ht = dynamic_cast<PIVOTTH*>(m_arPIVOTTH[i].get());
SXTH* szTH = dynamic_cast<SXTH*>(ht->m_SXTH.get());
if (szTH->fKPI)
{
std::unordered_map<std::wstring, std::vector<int>>::iterator pFind = mapKpis.find(szTH->stUnique.value());
if (pFind == mapKpis.end())
{
std::vector<int> v; v.push_back(i);
mapKpis.insert(std::make_pair(szTH->stUnique.value(), v));
}
else
{
pFind->second.push_back(i);
}
}
else if (szTH->fMeasure && !szTH->fSet && !szTH->fKPI)
{
std::unordered_map<std::wstring, std::vector<int>>::iterator pFind = mapMeasures.find(szTH->stUnique.value());
if (pFind == mapMeasures.end())
{
std::vector<int> v; v.push_back(i);
mapMeasures.insert(std::make_pair(szTH->stUnique.value(), v));
}
else
{
pFind->second.push_back(i);
}
}
else if (szTH->fSet && !szTH->fMeasure && !szTH->fKPI)
{
std::unordered_map<std::wstring, std::vector<int>>::iterator pFind = mapNamed.find(szTH->stUnique.value());
if (pFind == mapNamed.end())
{
std::vector<int> v; v.push_back(i);
mapNamed.insert(std::make_pair(szTH->stUnique.value(), v));
}
else
{
pFind->second.push_back(i);
}
}
if (!szTH->stDimension.value().empty())
{
std::unordered_map<std::wstring, std::vector<int>>::iterator pFind = mapDimensions.find(szTH->stDimension.value());
if (pFind == mapDimensions.end())
{
std::vector<int> v; v.push_back(i);
mapDimensions.insert(std::make_pair(szTH->stDimension.value(), v));
}
else
{
pFind->second.push_back(i);
}
}
szTH->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"kpis")
{
CP_XML_ATTR(L"count", mapKpis.size());
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapKpis.begin(); it != mapKpis.end(); it++)
{
CP_XML_NODE(L"kpi")
{
CP_XML_ATTR(L"uniqueName", it->first);
//measureGroup
//value
//goal
//status
//trend
//weight
//time
//parent
}
}
}
CP_XML_NODE(L"dimensions")
{
CP_XML_ATTR(L"count", mapDimensions.size());
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapDimensions.begin(); it != mapDimensions.end(); it++)
{
CP_XML_NODE(L"dimension")
{
CP_XML_ATTR(L"name", it->first.substr(1, it->first.length() - 2));
CP_XML_ATTR(L"uniqueName", it->first);
//if (szTH->fMeasure)
// CP_XML_ATTR(L"measure", true);
}
}
}
CP_XML_NODE(L"measureGroups")
{
CP_XML_ATTR(L"count", mapMeasures.size());
for (std::unordered_map<std::wstring, std::vector<int>>::iterator it = mapMeasures.begin(); it != mapMeasures.end(); it++)
{
CP_XML_ATTR(L"name", it->first.substr(1, it->first.length() - 2));
}
//CP_XML_ATTR(L"count", m_arPIVOTVDTEX.size());
//for (size_t i = 0; i < m_arPIVOTVDTEX.size(); i++)
//{
// PIVOTVDTEX *VDTEX = dynamic_cast<PIVOTVDTEX*>(m_arPIVOTVDTEX[i].get());
// SXVDTEx *ex = dynamic_cast<SXVDTEx*>(VDTEX->m_SXVDTEx.get());
//
// PIVOTTH* ht = dynamic_cast<PIVOTTH*>(m_arPIVOTTH[ex->isxth].get());
// SXTH* szTH = dynamic_cast<SXTH*>(ht->m_SXTH.get());
//
// CP_XML_NODE(L"measureGroup")
// {
// CP_XML_ATTR(L"name", szTH->stDimension.value());
// }
//}
}
}
return 0;
}
} // namespace XLS
......@@ -46,6 +46,7 @@ public:
BaseObjectPtr clone();
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typePIVOTVIEWEX;
......
......@@ -109,7 +109,7 @@ int QUERYTABLE::serialize(std::wostream & strm)
std::wstring name = info->rgchName.value();
query->m_DBQUERYEXT = m_DBQUERYEXT;
int connectionId = query->serialize_connection(name, L"");
int connectionId = query->serialize_connection(name);
if (connectionId < 1) return 0;
......
......@@ -41,6 +41,7 @@ namespace XLS
SXSRC::SXSRC()
{
bSql = false;
bOLAP = false;
}
......
......@@ -53,6 +53,7 @@ public:
BaseObjectPtr m_source;
bool bSql;
bool bOLAP;
};
} // namespace XLS
......
......@@ -106,12 +106,14 @@ public:
unsigned int last_Axes_id;
unsigned int last_Extern_id;
std::map<std::wstring, BaseObjectPtr> mapStrConnection;
std::map<int, BaseObjectPtr> mapIdConnection;
short idPivotCache;
std::map<int, int> mapPivotCacheIndex; //streamIdCache, write index order
std::unordered_map<int, BaseObjectPtr> mapPivotCacheStream;//streamIdCache, object
std::vector<BaseObjectPtr> arPIVOTCACHEDEFINITION;
std::vector<BaseObjectPtr> arDConn;
std::vector<bool> arPivotCacheFields;
std::vector<bool> arPivotCacheFieldShortSize;
......
......@@ -387,8 +387,22 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
count--;
}
}break;
case rt_MDTInfo: proc.optional<METADATA>(); break;
case rt_MTRSettings: proc.optional<MTRSettings>(); break;
case rt_MDTInfo:
{
if (proc.optional<METADATA>())
{
m_METADATA = elements_.back();
elements_.pop_back();
}
}break;
case rt_MTRSettings:
{
if (proc.optional<MTRSettings>())
{
m_MTRSettings = elements_.back();
elements_.pop_back();
}
}break;
case rt_ForceFullCalculation: proc.optional<ForceFullCalculation>(); break;
case rt_SupBook:
{
......@@ -473,7 +487,19 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
count = proc.repeated<DConn>(0, 0);
while(count > 0)
{
global_info_->arDConn.insert(global_info_->arDConn.begin(), elements_.back());
DConn *conn = dynamic_cast<DConn*>(elements_.back().get());
if (conn)
{
if (conn->id.bType == 1)
{
global_info_->mapStrConnection.insert(std::make_pair(conn->id.string.strTotal, elements_.back()));
}
else if (conn->id.bType == 2)
{
global_info_->mapIdConnection.insert(std::make_pair(conn->id.sxStreamID.idStm, elements_.back()));
}
}
m_arDConn.insert(m_arDConn.begin(), elements_.back());
elements_.pop_back();
count--;
}
......@@ -555,7 +581,7 @@ void GlobalsSubstream::LoadHFPicture()
{
if (m_arHFPicture.empty()) return;
int current_size_hf = 0, j = 0;
size_t current_size_hf = 0, j = 0;
for ( size_t i = 0; i < m_arHFPicture.size(); i++)
{
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
......
......@@ -70,6 +70,8 @@ public:
BaseObjectPtr m_FNGROUPS;
BaseObjectPtr m_BookExt;
BaseObjectPtr m_CodeName;
BaseObjectPtr m_METADATA;
BaseObjectPtr m_MTRSettings;
std::vector<BaseObjectPtr> m_arHFPicture;
std::vector<BaseObjectPtr> m_arLBL;
......@@ -79,7 +81,7 @@ public:
std::vector<BaseObjectPtr> m_arBUNDLESHEET;
std::vector<BaseObjectPtr> m_arSUPBOOK;
//std::vector<BaseObjectPtr> m_arPIVOTCACHEDEFINITION; -> GlobalWorkbookInfo
//std::vector<BaseObjectPtr> m_arDConn;
std::vector<BaseObjectPtr> m_arDConn;
std::vector<BiffStructurePtr> m_arHFPictureDrawing;
......
......@@ -191,7 +191,11 @@ XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring
int last_index = 0;
for (std::list<std::wstring>::iterator it = listStream.begin(); it != listStream.end(); it++)
{
XLS::CFStreamCacheReader pivot_cache_reader(xls_file->getNamedStream(L"_SX_DB_CUR/" + *it), xls_global_info);
XLS::CFStreamPtr pivot_cache_stream = xls_file->getNamedStream(L"_SX_DB_CUR/" + *it);
if (pivot_cache_stream->getStreamSize() < 1) continue;
XLS::CFStreamCacheReader pivot_cache_reader(pivot_cache_stream, xls_global_info);
XLS::BaseObjectPtr pivot_cache = boost::shared_ptr<XLS::PIVOTCACHE>(new XLS::PIVOTCACHE());
XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true);
......
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