Commit 83c0ba9d authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - table parts

parent a2443dad
......@@ -46,7 +46,7 @@ static inline void trim(std::wstring &s)
if (s[i] != 0) break;
else new_size--;
}
if (new_size < s.length())
if (new_size < (int)s.length())
s.erase(new_size);
}
......@@ -93,13 +93,13 @@ void AutoFilter::readFields(CFRecord& record)
record >> doper2;
}
if ((doper1.vt == BIFF_BYTE(0)) && (doper2.vt == BIFF_BYTE(0)))
if (doper1.vt == 0 && doper2.vt == 0)
{
m_bAutoFilter12 = true;
return;
}
if (doper1.vt == BIFF_BYTE(0x06))
if (doper1.vt == 0x06)
{
XLUnicodeStringNoCch s;
s.setSize(doper1.vtValueStr.cch);
......@@ -109,7 +109,7 @@ void AutoFilter::readFields(CFRecord& record)
trim(str1);
}
if (doper2.vt == BIFF_BYTE(0x06))
if (doper2.vt == 0x06)
{
XLUnicodeStringNoCch s;
s.setSize(doper2.vtValueStr.cch);
......
......@@ -58,14 +58,6 @@ void AutoFilter12::readFields(CFRecord& record)
record >> frtRefHeader >> iEntry >> fHideArrow >> ft >> cft >> cCriteria >> cDateGroupings >> flags >> unused2 >> idList;
_UINT16 _iEntry = iEntry;
_UINT32 _fHideArrow = fHideArrow;
_UINT32 _ft = ft;
_UINT32 _cft = cft;
_UINT32 _cCriteria = cCriteria;
_UINT32 _cDateGroupings = cDateGroupings;
_UINT32 _idList = idList;
// TODO доделать
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
......@@ -82,11 +74,12 @@ void AutoFilter12::readFields(CFRecord& record)
record >> frtRefHeaderContinue;
if (frtRefHeaderContinue.rt == 0x087F)
{
if ( (ft == BIFF_DWORD(0)) && (cCriteria > 0) )
if ( ft == 0 && cCriteria > 0)
{
AF12CriteriaPtr item(new AF12Criteria);
item->load(record);
rgbAF12Criteries.push_back(item);
arAF12Criteries.push_back(item);
}
}
}
......
......@@ -32,17 +32,16 @@
#pragma once
#include "BiffRecordContinued.h"
#include <Logic/Biff_structures/FrtRefHeader.h>
#include <Logic/Biff_structures/BiffString.h>
#include <Logic/Biff_structures/FrtRefHeader.h>
#include <Logic/Biff_structures/AFDOper.h>
#include <Logic/Biff_structures/AF12Criteria.h>
#include "../Biff_structures/FrtRefHeader.h"
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/FrtRefHeader.h"
#include "../Biff_structures/AFDOper.h"
#include "../Biff_structures/AF12Criteria.h"
namespace XLS
{
// Logical representation of AutoFilter12 record in BIFF8
class AutoFilter12: public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(AutoFilter12)
......@@ -53,21 +52,21 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeAutoFilter12;
FrtRefHeader frtRefHeader;
_UINT16 iEntry;
BIFF_DWORD fHideArrow;
BIFF_DWORD ft;
BIFF_DWORD cft;
BIFF_DWORD cCriteria;
BIFF_DWORD cDateGroupings;
BIFF_DWORD idList;
_UINT32 fHideArrow;
_UINT32 ft;
_UINT32 cft;
_UINT32 cCriteria;
_UINT32 cDateGroupings;
_UINT32 idList;
BiffStructurePtrVector rgbAF12Criteries;
BiffStructurePtrVector arAF12Criteries;
};
} // namespace XLS
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of BookBool record in BIFF8
class BookBool: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(BookBool)
......@@ -47,20 +45,18 @@ public:
~BookBool();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeBookBool;
//-----------------------------
bool fNoSaveSup;
bool fHasEnvelope;
bool fEnvelopeVisible;
bool fEnvelopeInitDone;
bool fHideBorderUnselLists;
BIFF_BSTR grUpdateLinks;
std::wstring grUpdateLinks;
};
} // namespace XLS
......
......@@ -56,6 +56,7 @@ void BopPop::readFields(CFRecord& record)
{
unsigned short flags;
record >> pst >> fAutoSplit >> split >> iSplitPos >> pcSplitPercent >> pcPie2Size >> pcGap >> numSplitValue >> flags;
fHasShadow = GETBIT(flags, 0);
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of BopPop record in BIFF8
class BopPop: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(BopPop)
......@@ -47,7 +45,6 @@ public:
~BopPop();
BaseObjectPtr clone();
void readFields(CFRecord& record);
......@@ -57,7 +54,7 @@ public:
//-----------------------------
unsigned char pst;
unsigned char fAutoSplit;
bool fAutoSplit;
_UINT16 split;
_INT16 iSplitPos;
_INT16 pcSplitPercent;
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of CalcMode record in BIFF8
class CalcMode: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CalcMode)
......@@ -53,8 +51,7 @@ public:
static const ElementType type = typeCalcMode;
//-----------------------------
BIFF_BSTR fAutoRecalc;
std::wstring fAutoRecalc;
};
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of CalcRefMode record in BIFF8
class CalcRefMode: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CalcRefMode)
......@@ -47,14 +45,12 @@ public:
~CalcRefMode();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeCalcRefMode;
//-----------------------------
BIFF_BSTR fRefA1;
std::wstring fRefA1;
};
......
......@@ -36,9 +36,6 @@
namespace XLS
{
// Logical representation of CondFmt record in BIFF8
class CondFmt: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CondFmt)
......@@ -48,20 +45,18 @@ public:
~CondFmt();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeCondFmt;
static const ElementType type = typeCondFmt;
const CellRef getLocation() const;
//-----------------------------
_UINT16 ccf;
bool fToughRecalc;
_UINT16 nID;
SqRefU sqref;
BIFF_BSTR refBound;
_UINT16 ccf;
bool fToughRecalc;
_UINT16 nID;
SqRefU sqref;
std::wstring refBound;
};
typedef boost::shared_ptr<CondFmt> CondFmtPtr;
......
......@@ -35,9 +35,6 @@
namespace XLS
{
// Logical representation of CrtLayout12 record in BIFF8
class CrtLayout12: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CrtLayout12)
......
......@@ -31,7 +31,7 @@
*/
#include "Feat.h"
#include <Logic/Biff_structures/FrtHeader.h>
#include "../Biff_structures/FrtHeader.h"
namespace XLS
{
......@@ -54,20 +54,21 @@ BaseObjectPtr Feat::clone()
void Feat::readFields(CFRecord& record)
{
FrtHeader frtHeader(rt_Feat);
record >> frtHeader;
record >> isf;
record >> frtHeader >> isf;
record.skipNunBytes(5); // reserved
record >> cref >> cbFeatData;
record.skipNunBytes(2); // reserved
std::wstring sqref_str;
for (int i = 0; i < cref ; ++i)
{
Ref8U reff;
record >> reff;
refs.push_back(BiffStructurePtr(new Ref8U(reff)));
sqref_str += std::wstring (reff.toString().c_str()) + ((i == cref - 1) ? L"" : L" ");
sqref += reff.toString() + ((i == cref - 1) ? L"" : L" ");
}
sqref = sqref_str;
switch(isf)
{
......
......@@ -32,16 +32,14 @@
#pragma once
#include "BiffRecordContinued.h"
#include <Logic/Biff_structures/CellRangeRef.h>
#include <Logic/Biff_structures/FeatProtection.h>
#include <Logic/Biff_structures/FeatFormulaErr2.h>
#include <Logic/Biff_structures/FeatSmartTag.h>
#include "../Biff_structures/CellRangeRef.h"
#include "../Biff_structures/FeatProtection.h"
#include "../Biff_structures/FeatFormulaErr2.h"
#include "../Biff_structures/FeatSmartTag.h"
namespace XLS
{
// Logical representation of Feat record in BIFF8
class Feat: public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Feat)
......@@ -51,22 +49,20 @@ public:
~Feat();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeFeat;
//-----------------------------
SharedFeatureType isf;
_UINT16 cref;
_UINT32 cbFeatData;
SharedFeatureType isf;
_UINT16 cref;
_UINT32 cbFeatData;
BiffStructurePtrVector refs;
BIFF_BSTR sqref;
std::wstring sqref;
FeatProtection protection;
FeatFormulaErr2 formula_err;
FeatSmartTag smart_tag;
FeatProtection protection;
FeatFormulaErr2 formula_err;
FeatSmartTag smart_tag;
};
......
......@@ -50,21 +50,17 @@ public:
~Feature11();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeFeature11;
public:
FrtRefHeaderU frtRefHeaderU;
_UINT16 isf;
_UINT16 cref2;
_UINT32 cbFeatData;
BiffStructurePtrVector refs2;
BIFF_BSTR sqref;
std::wstring sqref;
TableFeatureType rgbFeat;
};
......
......@@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/BiffString.h>
#include "../Biff_structures/BiffString.h"
namespace XLS
{
// Logical representation of FileSharing record in BIFF8
class FileSharing: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(FileSharing)
......@@ -48,16 +46,14 @@ public:
~FileSharing();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeFileSharing;
//-----------------------------
Boolean<unsigned short> fReadOnlyRec;
unsigned short wResPassNum;
BIFF_BSTR wResPass;
std::wstring wResPass;
_UINT16 iNoResPass;
XLUnicodeString stUNUsername;
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of HLinkTooltip record in BIFF8
class HLinkTooltip: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(HLinkTooltip)
......@@ -47,15 +45,13 @@ public:
~HLinkTooltip();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeHLinkTooltip;
static const ElementType type = typeHLinkTooltip;
//-----------------------------
BIFF_BSTR wzTooltip;
BackwardOnlyParam<std::wstring > ref_;
std::wstring wzTooltip;
BackwardOnlyParam<std::wstring > ref_;
};
} // namespace XLS
......
......@@ -80,12 +80,9 @@ int LabelSst::serialize(std::wostream & stream)
CP_XML_ATTR(L"t", L"s");
if (isst.value())
CP_XML_NODE(L"v")
{
CP_XML_NODE(L"v")
{
CP_XML_STREAM() << isst;
}
CP_XML_STREAM() << isst;
}
}
}
......
......@@ -62,7 +62,7 @@ public:
CellOffsetResender resender;
Cell cell;
BIFF_DWORD isst;
_UINT32 isst;
};
......
......@@ -44,8 +44,7 @@ const wchar_t* const AutoFilterDefineNames[] =
};
Lbl::Lbl()
: rgce(false), fGrp(0)
Lbl::Lbl() : rgce(false), fGrp(0)
{
}
......@@ -167,10 +166,6 @@ void Lbl::readFields(CFRecord& record)
}
}
const XLUnicodeStringNoCch Lbl::getName() const
{
return Name_bin;
}
} // namespace XLS
......@@ -39,8 +39,6 @@
namespace XLS
{
// Logical representation of Lbl record in BIFF8
class Lbl: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Lbl)
......@@ -51,15 +49,10 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeLbl;
const XLUnicodeStringNoCch getName() const;
//-----------------------------
bool fHidden;
bool fFunc;
bool fOB;
......@@ -70,11 +63,11 @@ public:
bool fPublished;
bool fWorkbookParam;
unsigned char chKey;
_UINT16 itab;
XLUnicodeStringNoCch Name_bin;
BIFF_BSTR Name;
NameParsedFormula rgce;
unsigned char chKey;
_UINT16 itab;
XLUnicodeStringNoCch Name_bin;
std::wstring Name;
NameParsedFormula rgce;
};
......
......@@ -32,6 +32,10 @@
#include "List12.h"
#include "../Biff_structures/List12BlockLevel.h"
#include "../Biff_structures/List12TableStyleClientInfo.h"
#include "../Biff_structures/List12DisplayName.h"
namespace XLS
{
......@@ -56,20 +60,20 @@ void List12::readFields(CFRecord& record)
record >> lsd;
record >> idList;
unsigned short _lsd = lsd;
switch (lsd)
{
case 0:
record >> rgbList12BlockLevel;
rgbList12 = BiffStructurePtr(new List12BlockLevel);
break;
case 1:
record >> rgbList12TableStyleClientInfo;
rgbList12 = BiffStructurePtr(new List12TableStyleClientInfo);
break;
case 2:
record >> rgbList12DisplayName;
rgbList12 = BiffStructurePtr(new List12DisplayName);
break;
}
if (rgbList12)
rgbList12->load(record);
}
} // namespace XLS
......
......@@ -32,16 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/FrtHeader.h>
#include <Logic/Biff_structures/List12BlockLevel.h>
#include <Logic/Biff_structures/List12TableStyleClientInfo.h>
#include <Logic/Biff_structures/List12DisplayName.h>
#include "../Biff_structures/FrtHeader.h"
namespace XLS
{
// Logical representation of List12 record in BIFF8
class List12: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(List12)
......@@ -51,19 +47,16 @@ public:
~List12();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeList12;
static const ElementType type = typeList12;
FrtHeader frtHeader;
_UINT16 lsd;
_UINT32 idList;
List12BlockLevel rgbList12BlockLevel;
List12TableStyleClientInfo rgbList12TableStyleClientInfo;
List12DisplayName rgbList12DisplayName;
BiffStructurePtr rgbList12;
};
} // namespace XLS
......
......@@ -38,8 +38,6 @@
namespace XLS
{
// Logical representation of Pane record in BIFF8
class Pane: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Pane)
......@@ -49,20 +47,18 @@ public:
~Pane();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typePane;
static const ElementType type = typePane;
//-----------------------------
_UINT16 x;
_UINT16 y;
_UINT16 rwTop;
_UINT16 colLeft;
PaneType pnnAcct;
BIFF_BSTR topLeftCell;
std::wstring topLeftCell;
};
} // namespace XLS
......
......@@ -84,14 +84,14 @@ int Selection::serialize(std::wostream & stream)
// default: CP_XML_ATTR(L"pane", L"topLeft");
}
if (*activeCell.value() != L"A1")
CP_XML_ATTR(L"activeCell", *activeCell.value());
if (activeCell != L"A1")
CP_XML_ATTR(L"activeCell", activeCell);
if (irefAct != 0)
CP_XML_ATTR(L"activeCellId", irefAct);
if (*sqref.value() != L"A1")
CP_XML_ATTR(L"sqref", *sqref.value());
if (sqref != L"A1")
CP_XML_ATTR(L"sqref", sqref);
}
}
return 0;
......
......@@ -38,8 +38,6 @@
namespace XLS
{
// Logical representation of Selection record in BIFF8
class Selection: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Selection)
......@@ -49,7 +47,6 @@ public:
~Selection();
BaseObjectPtr clone();
void readFields(CFRecord& record);
......@@ -57,15 +54,14 @@ public:
int serialize(std::wostream & stream);
//-----------------------------
PaneType pnn;
R_RwU rwAct;
ColU colAct;
_INT16 irefAct;
R_RwU rwAct;
ColU colAct;
_INT16 irefAct;
BIFF_BSTR sqref;
BIFF_BSTR activeCell;
std::wstring sqref;
std::wstring activeCell;
};
} // namespace XLS
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of SerAuxErrBar record in BIFF8
class SerAuxErrBar: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(SerAuxErrBar)
......
......@@ -58,8 +58,8 @@ public:
bool fAltMethod;
unsigned char sfp;
BIFF_DWORD cconditions;
BIFF_DWORD idParent;
_UINT32 cconditions;
_UINT32 idParent;
BiffStructurePtrVector sortCond12Array;
FrtHeader frtHeader;
......
......@@ -37,8 +37,6 @@
namespace XLS
{
// Logical representation of Table record in BIFF8
class Table: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Table)
......@@ -54,7 +52,6 @@ public:
static const ElementType type = typeTable;
//-----------------------------
Ref ref_;
bool fAlwaysCalc;
......@@ -63,8 +60,8 @@ public:
bool fDeleted1;
bool fDeleted2;
BIFF_BSTR r1;
BIFF_BSTR r2;
std::wstring r1;
std::wstring r2;
};
......
......@@ -58,10 +58,10 @@ public:
_UINT16 tabId;
std::wstring guid;
BIFF_DWORD x;
BIFF_DWORD y;
BIFF_DWORD dx;
BIFF_DWORD dy;
_UINT32 x;
_UINT32 y;
_UINT32 dx;
_UINT32 dy;
_UINT16 wTabRatio;
......
......@@ -46,7 +46,6 @@ UserSViewBegin::~UserSViewBegin()
{
}
BaseObjectPtr UserSViewBegin::clone()
{
return BaseObjectPtr(new UserSViewBegin(*this));
......
......@@ -56,7 +56,7 @@ public:
//-----------------------------
std::wstring guid;
TabId iTabid;
BIFF_DWORD wScale;
_UINT32 wScale;
Icv icvHdr;
PaneType pnnSel;
......
......@@ -37,8 +37,6 @@
namespace XLS
{
// Logical representation of Window2 record in BIFF8
class Window2: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Window2)
......@@ -53,7 +51,6 @@ public:
static const ElementType type = typeWindow2;
//-----------------------------
bool fDspFmlaRt;
bool fDspGridRt;
bool fDspRwColRt;
......@@ -76,7 +73,7 @@ public:
_UINT16 wScaleSLV;
_UINT16 wScaleNormal;
BIFF_BSTR topLeftCell;
std::wstring topLeftCell;
};
} // namespace XLS
......
......@@ -56,7 +56,7 @@ void AF12Criteria::load(CFRecord& record)
doper.m_bAutoFilter = false;
record >> doper;
if (doper.vt == BIFF_BYTE(0x06))
if (doper.vt == 0x06)
{
unsigned char _cch = doper.vtValueStr.cch;
......
......@@ -54,7 +54,6 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeAFDOper;
unsigned char vt;
......
......@@ -52,7 +52,6 @@ public:
virtual void load(CFRecord& record);
unsigned char cch;
unsigned char fCompare;
......
......@@ -78,9 +78,7 @@ typedef unsigned char FillPattern;
typedef BiffAttributeSimple<unsigned char> BIFF_BYTE;
typedef BiffAttributeSimple<_UINT16> BIFF_WORD;
typedef BiffAttributeSimple<_UINT32> BIFF_DWORD;
typedef BiffAttributeSimple<_INT32> BIFF_LONG;
typedef BiffAttributeSimple<double> BIFF_DOUBLE;
typedef BiffAttributeSimple<std::wstring> BIFF_BSTR;
struct PtgAttrSpaceType : public BiffStructure_NoVtbl
......
......@@ -50,7 +50,6 @@ public:
virtual void load(CFRecord& record);
unsigned short icf;
unsigned char cp;
unsigned char icfTemplate;
......
......@@ -47,10 +47,10 @@ void ControlInfo::load(CFRecord& record)
unsigned short flags;
record >> flags;
fDefault = GETBIT(flags, 0);
fHelp = GETBIT(flags, 1);
fCancel = GETBIT(flags, 2);
fDismiss = GETBIT(flags, 3);
fDefault = GETBIT(flags, 0);
fHelp = GETBIT(flags, 1);
fCancel = GETBIT(flags, 2);
fDismiss = GETBIT(flags, 3);
record >> accel1;
record.skipNunBytes(2); // reserved2
......
......@@ -46,11 +46,12 @@ public:
virtual void load(CFRecord& record);
unsigned char fDefault;
unsigned char fHelp;
unsigned char fCancel;
unsigned char fDismiss;
_UINT16 accel1;
bool fDefault;
bool fHelp;
bool fCancel;
bool fDismiss;
_UINT16 accel1;
};
} // namespace XLS
......
......@@ -53,11 +53,10 @@ class DXFN : public BiffStructure
public:
BiffStructurePtr clone();
static const ElementType type = typeDXFN;
static const ElementType type = typeDXFN;
virtual void load(CFRecord& record);
int serialize(std::wostream & stream);
bool alchNinch;
......
......@@ -44,6 +44,7 @@ BiffStructurePtr DXFN12List::clone()
DXFN12List::DXFN12List()
{
size = -1;
}
......@@ -53,8 +54,20 @@ DXFN12List::~DXFN12List()
void DXFN12List::load(CFRecord& record)
{
record >> dxfn;
record >> xfext;
size_t pos_record = record.getRdPtr();
if (size < 0) size = record.getDataSize() - pos_record;
if (size > 0)
{
record >> dxfn;
size -= (record.getRdPtr() - pos_record);
}
if (size > 0)
{
record >> xfext;
size -= (record.getRdPtr() - pos_record);
}
}
......
......@@ -31,10 +31,10 @@
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include <Logic/Biff_structures/BiffString.h>
#include <Logic/Biff_structures/DXFN.h>
#include <Logic/Biff_structures/XFExtNoFRT.h>
#include "../Biff_records/BiffRecord.h"
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/DXFN.h"
#include "../Biff_structures/XFExtNoFRT.h"
namespace XLS
{
......@@ -52,9 +52,9 @@ public:
virtual void load(CFRecord& record);
DXFN dxfn;
XFExtNoFRT xfext;
int size;
DXFN dxfn;
XFExtNoFRT xfext;
};
typedef boost::shared_ptr<DXFN12List> DXFN12ListPtr;
......
......@@ -36,16 +36,12 @@
namespace XLS
{
BiffStructurePtr Feat11FieldDataItem::clone()
{
return BiffStructurePtr(new Feat11FieldDataItem(*this));
}
void Feat11FieldDataItem::load(CFRecord& record)
{
record >> idField;
record >> lfdt;
record >> lfxidt;
......@@ -56,15 +52,15 @@ void Feat11FieldDataItem::load(CFRecord& record)
_UINT32 flags;
record >> flags;
fAutoFilter = static_cast<unsigned char>(GETBIT(flags, 0));
fAutoFilterHidden = static_cast<unsigned char>(GETBIT(flags, 1));
fLoadXmapi = static_cast<unsigned char>(GETBIT(flags, 2));
fLoadFmla = static_cast<unsigned char>(GETBIT(flags, 3));
fLoadTotalFmla = static_cast<unsigned char>(GETBIT(flags, 7));
fLoadTotalArray = static_cast<unsigned char>(GETBIT(flags, 8));
fSaveStyleName = static_cast<unsigned char>(GETBIT(flags, 9));
fLoadTotalStr = static_cast<unsigned char>(GETBIT(flags, 10));
fAutoCreateCalcCol = static_cast<unsigned char>(GETBIT(flags, 11));
fAutoFilter = GETBIT(flags, 0);
fAutoFilterHidden = GETBIT(flags, 1);
fLoadXmapi = GETBIT(flags, 2);
fLoadFmla = GETBIT(flags, 3);
fLoadTotalFmla = GETBIT(flags, 7);
fLoadTotalArray = GETBIT(flags, 8);
fSaveStyleName = GETBIT(flags, 9);
fLoadTotalStr = GETBIT(flags, 10);
fAutoCreateCalcCol = GETBIT(flags, 11);
record >> cbFmtInsertRow;
record >> istnInsertRow;
......@@ -75,12 +71,69 @@ void Feat11FieldDataItem::load(CFRecord& record)
return;//125 Planilhas de Excel.xls
if (cbFmtAgg > 0)
{
dxfFmtAgg.size = cbFmtAgg;
record >> dxfFmtAgg;
}
if (cbFmtInsertRow > 0)
{
dxfFmtInsertRow.size = cbFmtInsertRow;
record >> dxfFmtInsertRow;
if (fAutoFilter == BIFF_BYTE(1))
}
if (fAutoFilter)
record >> AutoFilter;
}
//---------------------------------------------------------------------------------------------------------
BiffStructurePtr Feat11RgSharepointIdDel::clone()
{
return BiffStructurePtr(new Feat11RgSharepointIdDel(*this));
}
void Feat11RgSharepointIdDel::load(CFRecord& record)
{
record >> cId;
for (_UINT16 i = 0; i < cId; i++)
{
_UINT32 val;
record >> val;
rgId.push_back(val);
}
}
//---------------------------------------------------------------------------------------------------------
BiffStructurePtr Feat11RgSharepointIdChange::clone()
{
return BiffStructurePtr(new Feat11RgSharepointIdChange(*this));
}
void Feat11RgSharepointIdChange::load(CFRecord& record)
{
record >> cId;
for (_UINT16 i = 0; i < cId; i++)
{
_UINT32 val;
record >> val;
rgId.push_back(val);
}
}
//---------------------------------------------------------------------------------------------------------
BiffStructurePtr Feat11RgInvalidCells::clone()
{
return BiffStructurePtr(new Feat11RgInvalidCells(*this));
}
void Feat11RgInvalidCells::load(CFRecord& record)
{
record >> cCellInvalid;
for (_UINT16 i = 0; i < cCellInvalid; i++)
{
Feat11CellStruct val;
record >> val.idxRow >> val.idxField;
rgCellInvalid.push_back(val);
}
}
} // namespace XLS
......@@ -31,10 +31,9 @@
*/
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h>
#include <Logic/Biff_structures/DXFN12List.h>
#include <Logic/Biff_structures/Feat11FdaAutoFilter.h>
#include "BiffString.h"
#include "DXFN12List.h"
#include "Feat11FdaAutoFilter.h"
namespace XLS
{
......@@ -51,7 +50,6 @@ public:
virtual void load(CFRecord& record);
_UINT32 idField;
_UINT32 lfdt;
_UINT32 lfxidt;
......@@ -59,15 +57,15 @@ public:
_UINT32 cbFmtAgg;
_UINT32 istnAgg;
unsigned char fAutoFilter;
unsigned char fAutoFilterHidden;
unsigned char fLoadXmapi;
unsigned char fLoadFmla;
unsigned char fLoadTotalFmla;
unsigned char fLoadTotalArray;
unsigned char fSaveStyleName;
unsigned char fLoadTotalStr;
unsigned char fAutoCreateCalcCol;
bool fAutoFilter;
bool fAutoFilterHidden;
bool fLoadXmapi;
bool fLoadFmla;
bool fLoadTotalFmla;
bool fLoadTotalArray;
bool fSaveStyleName;
bool fLoadTotalStr;
bool fAutoCreateCalcCol;
_UINT32 cbFmtInsertRow;
_UINT32 istnInsertRow;
......@@ -82,6 +80,60 @@ public:
};
typedef boost::shared_ptr<Feat11FieldDataItem> Feat11FieldDataItemPtr;
//--------------------------------------------------------------------------------------------------
class Feat11RgSharepointIdDel : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11RgSharepointIdDel)
public:
BiffStructurePtr clone();
static const ElementType type = typeFeat11RgSharepointIdDel;
virtual void load(CFRecord& record);
_UINT16 cId;
std::vector<_UINT32> rgId;
};
typedef boost::shared_ptr<Feat11RgSharepointIdDel> Feat11RgSharepointIdDelPtr;
//--------------------------------------------------------------------------------------------------
class Feat11RgSharepointIdChange : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11RgSharepointIdChange)
public:
BiffStructurePtr clone();
static const ElementType type = typeFeat11RgSharepointIdChange;
virtual void load(CFRecord& record);
_UINT16 cId;
std::vector<_UINT32> rgId;
};
typedef boost::shared_ptr<Feat11RgSharepointIdChange> Feat11RgSharepointIdChangePtr;
//--------------------------------------------------------------------------------------------------
struct Feat11CellStruct
{
_UINT32 idxRow = 0;
_UINT32 idxField = 0;
};
class Feat11RgInvalidCells : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11RgInvalidCells)
public:
BiffStructurePtr clone();
static const ElementType type = typeFeat11RgInvalidCells;
virtual void load(CFRecord& record);
_UINT16 cCellInvalid;
std::vector<Feat11CellStruct> rgCellInvalid;
};
typedef boost::shared_ptr<Feat11RgInvalidCells> Feat11RgInvalidCellsPtr;
} // namespace XLS
......@@ -44,6 +44,15 @@ BiffStructurePtr List12BlockLevel::clone()
List12BlockLevel::List12BlockLevel()
{
cbdxfHeader = 0xffffffff;
istnHeader = 0xffffffff;
cbdxfData = 0xffffffff;
istnData = 0xffffffff;
cbdxfAgg = 0xffffffff;
istnAgg = 0xffffffff;
cbdxfBorder = 0xffffffff;
cbdxfHeaderBorder = 0xffffffff;
cbdxfAggBorder = 0xffffffff;
}
......@@ -64,17 +73,35 @@ void List12BlockLevel::load(CFRecord& record)
record >> cbdxfAggBorder;
if (cbdxfHeader)
{
dxfHeader.size = cbdxfHeader;
record >> dxfHeader;
}
if (cbdxfData)
{
dxfData.size = cbdxfData;
record >> dxfData;
}
if (cbdxfAgg)
{
dxfAgg.size = cbdxfAgg;
record >> dxfAgg;
}
if (cbdxfBorder)
{
dxfBorder.size = cbdxfBorder;
record >> dxfBorder;
}
if (cbdxfHeaderBorder)
{
dxfHeaderBorder.size = cbdxfHeaderBorder;
record >> dxfHeaderBorder;
}
if (cbdxfAggBorder)
{
dxfAggBorder.size = cbdxfAggBorder;
record >> dxfAggBorder;
}
if (istnHeader != -1)
record >> stHeader;
if (istnData != -1)
......
......@@ -31,9 +31,9 @@
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include <Logic/Biff_structures/BiffString.h>
#include <Logic/Biff_structures/DXFN12List.h>
#include "../Biff_records/BiffRecord.h"
#include "BiffString.h"
#include "DXFN12List.h"
namespace XLS
{
......@@ -51,7 +51,6 @@ public:
virtual void load(CFRecord& record);
_UINT32 cbdxfHeader;
_UINT32 istnHeader;
_UINT32 cbdxfData;
......
......@@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record)
unsigned short flags;
record >> flags;
fFirstColumn = static_cast<unsigned char>(GETBITS(flags, 0, 1));
fLastColumn = static_cast<unsigned char>(GETBITS(flags, 1, 2));
fRowStripes = static_cast<unsigned char>(GETBITS(flags, 3, 4));
fColumnStripes = static_cast<unsigned char>(GETBITS(flags, 5, 6));
fDefaultStyle = static_cast<unsigned char>(GETBITS(flags, 9, 10));
nFirstColumn = GETBITS(flags, 0, 1);
nLastColumn = GETBITS(flags, 1, 2);
nRowStripes = GETBITS(flags, 3, 4);
nColumnStripes = GETBITS(flags, 5, 6);
nDefaultStyle = GETBITS(flags, 9, 10);
record >> stListStyleName;
}
......
......@@ -47,16 +47,16 @@ public:
List12TableStyleClientInfo();
~List12TableStyleClientInfo();
static const ElementType type = typeList12TableStyleClientInfo;
static const ElementType type = typeList12TableStyleClientInfo;
virtual void load(CFRecord& record);
unsigned char nFirstColumn;
unsigned char nLastColumn;
unsigned char nRowStripes;
unsigned char nColumnStripes;
unsigned char nDefaultStyle;
unsigned char fFirstColumn;
unsigned char fLastColumn;
unsigned char fRowStripes;
unsigned char fColumnStripes;
unsigned char fDefaultStyle;
XLUnicodeString stListStyleName;
};
......
......@@ -32,6 +32,7 @@
#include "TableFeatureType.h"
#include <Binary/CFRecord.h>
#include "../Biff_structures/Feat11FieldDataItem.h"
namespace XLS
{
......@@ -53,7 +54,13 @@ TableFeatureType::~TableFeatureType()
void TableFeatureType::load(CFRecord& record)
{
record >> lt; // SourceType
record >> lt;
//LTRANGE 0x00000000 Range
//LTSHAREPOINT 0x00000001 Read/write Web-based data provider list
//LTXML 0x00000002 XML Mapper data
//LTEXTERNALDATA 0x00000003 External data source (query table)<180>
record >> idList; // Unique ID
record >> crwHeader; // 0 - Table has no header row, 1 - Table has a header row
record >> crwTotals; // 0 - Table has no total row, 1 - Table has a total row
......@@ -61,39 +68,31 @@ void TableFeatureType::load(CFRecord& record)
record >> cbFSData; // 64
record >> rupBuild; // Build number of the application
_UINT32 _lt = lt;
_UINT32 _idList = idList;
_UINT32 _crwHeader = crwHeader;
_UINT32 _crwTotals = crwTotals;
_UINT32 _idFieldNext = idFieldNext;
_UINT32 _cbFSData = cbFSData;
_UINT32 _rupBuild = rupBuild;
record.skipNunBytes(2); // unused1
_UINT16 flags;
record >> flags;
fAutoFilter = static_cast<unsigned char>(GETBIT(flags, 1));
fPersistAutoFilter = static_cast<unsigned char>(GETBIT(flags, 2));
fShowInsertRow = static_cast<unsigned char>(GETBIT(flags, 3));
fInsertRowInsCells = static_cast<unsigned char>(GETBIT(flags, 4));
fLoadPldwIdDeleted = static_cast<unsigned char>(GETBIT(flags, 5));
fShownTotalRow = static_cast<unsigned char>(GETBIT(flags, 6));
fNeedsCommit = static_cast<unsigned char>(GETBIT(flags, 8));
fSingleCell = static_cast<unsigned char>(GETBIT(flags, 9));
fApplyAutoFilter = static_cast<unsigned char>(GETBIT(flags, 11));
fForceInsertToBeVis = static_cast<unsigned char>(GETBIT(flags, 12));
fCompressedXml = static_cast<unsigned char>(GETBIT(flags, 13));
fLoadCSPName = static_cast<unsigned char>(GETBIT(flags, 14));
fLoadPldwIdChanged = static_cast<unsigned char>(GETBIT(flags, 15));
fAutoFilter = GETBIT(flags, 1);
fPersistAutoFilter = GETBIT(flags, 2);
fShowInsertRow = GETBIT(flags, 3);
fInsertRowInsCells = GETBIT(flags, 4);
fLoadPldwIdDeleted = GETBIT(flags, 5);
fShownTotalRow = GETBIT(flags, 6);
fNeedsCommit = GETBIT(flags, 8);
fSingleCell = GETBIT(flags, 9);
fApplyAutoFilter = GETBIT(flags, 11);
fForceInsertToBeVis = GETBIT(flags, 12);
fCompressedXml = GETBIT(flags, 13);
fLoadCSPName = GETBIT(flags, 14);
fLoadPldwIdChanged = GETBIT(flags, 15);
record >> flags;
verXL = static_cast<unsigned char>(GETBITS(flags, 0, 4));
fLoadEntryId = static_cast<unsigned char>(GETBIT(flags, 4));
fLoadPllstclInvalid = static_cast<unsigned char>(GETBIT(flags, 5));
fGoodRupBld = static_cast<unsigned char>(GETBIT(flags, 6));
fPublished = static_cast<unsigned char>(GETBIT(flags, 8));
verXL = GETBITS(flags, 0, 4);
fLoadEntryId = GETBIT(flags, 4);
fLoadPllstclInvalid = GETBIT(flags, 5);
fGoodRupBld = GETBIT(flags, 6);
fPublished = GETBIT(flags, 8);
if (lt != 1)
{
......@@ -106,24 +105,39 @@ void TableFeatureType::load(CFRecord& record)
record.skipNunBytes(16); // rgbHashParam
record >> rgbName;
record >> cFieldData;
int r = cFieldData;
record >> cFieldData; //from 1 to 100
if (fLoadCSPName)
record >> cSPName;
if (fLoadEntryId == BIFF_BYTE(1))
if (fLoadEntryId)
record >> entryId;
for (size_t i = 0; i < cFieldData; i++)
for (_UINT16 i = 0; i < cFieldData; i++)
{
if (record.getRdPtr() >= record.getDataSize())
return;
Feat11FieldDataItemPtr item(new Feat11FieldDataItem);
BiffStructurePtr item(new Feat11FieldDataItem);
item->load(record);
fieldData.push_back(item);
arFieldData.push_back(item);
}
if (fLoadPldwIdDeleted)
{
idDeleted = BiffStructurePtr (new Feat11RgSharepointIdDel);
idDeleted->load(record);
}
if (fLoadPldwIdChanged)
{
idChanged = BiffStructurePtr (new Feat11RgSharepointIdChange);
idChanged->load(record);
}
if (fLoadPllstclInvalid)
{
cellInvalid = BiffStructurePtr(new Feat11RgInvalidCells);
cellInvalid->load(record);
}
}
......
......@@ -31,10 +31,8 @@
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include <Logic/Biff_structures/BiffString.h>
#include <Logic/Biff_structures/Feat11FieldDataItem.h>
#include "../Biff_records/BiffRecord.h"
#include "../Biff_structures/BiffString.h"
namespace XLS
{
......@@ -48,11 +46,10 @@ public:
TableFeatureType();
~TableFeatureType();
static const ElementType type = typeTableFeatureType;
static const ElementType type = typeTableFeatureType;
virtual void load(CFRecord& record);
_UINT32 lt; // SourceType
_UINT32 idList;
_UINT32 crwHeader;
......@@ -61,36 +58,40 @@ public:
_UINT32 cbFSData;
_UINT16 rupBuild;
unsigned char fAutoFilter;
unsigned char fPersistAutoFilter;
unsigned char fShowInsertRow;
unsigned char fInsertRowInsCells;
unsigned char fLoadPldwIdDeleted;
unsigned char fShownTotalRow;
unsigned char fNeedsCommit;
unsigned char fSingleCell;
unsigned char fApplyAutoFilter;
unsigned char fForceInsertToBeVis;
unsigned char fCompressedXml;
unsigned char fLoadCSPName;
unsigned char fLoadPldwIdChanged;
unsigned char verXL;
unsigned char fLoadEntryId;
unsigned char fLoadPllstclInvalid;
unsigned char fGoodRupBld;
unsigned char fPublished;
bool fAutoFilter;
bool fPersistAutoFilter;
bool fShowInsertRow;
bool fInsertRowInsCells;
bool fLoadPldwIdDeleted;
bool fShownTotalRow;
bool fNeedsCommit;
bool fSingleCell;
bool fApplyAutoFilter;
bool fForceInsertToBeVis;
bool fCompressedXml;
bool fLoadCSPName;
bool fLoadPldwIdChanged;
bool fLoadEntryId;
bool fLoadPllstclInvalid;
bool fGoodRupBld;
bool fPublished;
_UINT32 lPosStmCache;
_UINT32 cbStmCache;
_UINT32 cchStmCache;
_UINT32 lem; // LEMMode
unsigned char verXL;
_UINT32 lPosStmCache;
_UINT32 cbStmCache;
_UINT32 cchStmCache;
_UINT32 lem; // LEMMode
XLUnicodeString rgbName;
_UINT16 cFieldData;
_UINT16 cFieldData;
XLUnicodeString cSPName;
XLUnicodeString entryId;
BiffStructurePtrVector fieldData;
BiffStructurePtrVector arFieldData;
BiffStructurePtr idDeleted;
BiffStructurePtr idChanged;
BiffStructurePtr cellInvalid;
};
typedef boost::shared_ptr<TableFeatureType> TableFeatureTypePtr;
......
......@@ -47,12 +47,10 @@ public:
XFExtNoFRT(CFRecord& record);
BiffStructurePtr clone();
static const ElementType type = typeXFExtNoFRT;
static const ElementType type = typeXFExtNoFRT;
virtual void load(CFRecord& record);
private:
std::vector<ExtProp> rgExt;
};
......
......@@ -220,9 +220,9 @@ int AUTOFILTER::serialize(std::wostream & stream)
AutoFilter12* af12 = dynamic_cast<AutoFilter12*>(itF->second[j].get());
if (af12 == NULL) continue;
for (size_t k = 0 ; k < af12->rgbAF12Criteries.size(); k++)
for (size_t k = 0 ; k < af12->arAF12Criteries.size(); k++)
{
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->rgbAF12Criteries[k].get());
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->arAF12Criteries[k].get());
if (af12Criteria == NULL) continue;
CP_XML_NODE(L"filter")
......
......@@ -42,6 +42,9 @@
#include "../Biff_structures/DConnConnectionWeb.h"
#include "../Biff_structures/DConnConnectionOleDb.h"
#include "../Biff_structures/ConnGrbitDbtWeb.h"
#include "../Biff_structures/ConnGrbitDbtOledb.h"
#include "../Biff_structures/ConnGrbitDbtAdo.h"
namespace XLS
{
......@@ -231,6 +234,10 @@ int DBQUERY::serialize_connection(std::wstring & name)
DConnConnectionOleDb *oleDb = dcon ? dynamic_cast<DConnConnectionOleDb*>(dcon->connection.get()) : NULL;
XLUnicodeStringSegmented*adoDb = dcon ? dynamic_cast<XLUnicodeStringSegmented*>(dcon->connection.get()) : NULL;
ConnGrbitDbtWeb *webGrDb = dcon ? dynamic_cast<ConnGrbitDbtWeb*>(dcon->grbitDbt.get()) : NULL;
ConnGrbitDbtOledb *oleGrDb = dcon ? dynamic_cast<ConnGrbitDbtOledb*>(dcon->grbitDbt.get()) : NULL;
ConnGrbitDbtAdo *adoGrDb = dcon ? dynamic_cast<ConnGrbitDbtAdo*>(dcon->grbitDbt.get()) : NULL;
CP_XML_WRITER(global_info->connections_stream)
{
CP_XML_NODE(L"connection")
......@@ -330,15 +337,28 @@ int DBQUERY::serialize_connection(std::wstring & name)
CP_XML_ATTR(L"connection", connection);
CP_XML_ATTR(L"command", command);
if (commandType > 0)
CP_XML_ATTR(L"commandType", commandType);
if (oleGrDb && commandType > 0)
{
//1. Query specifies a cube name
//2. Query specifies a SQL statement
//3. Query specifies a table name
//4. Query specifies that default information has been given, and it is up to the provider
//5. Query is against a web based List Data Provider.
CP_XML_ATTR(L"commandType", oleGrDb->dbost);
}
}
if (oleDb)
{
CP_XML_NODE(L"olapPr")
{
CP_XML_ATTR(L"sendLocale", 1);
CP_XML_ATTR(L"rowDrillCount", oleDb->nDrillthroughRows);
if (oleGrDb)
{
if (oleGrDb->fLocalConn)
CP_XML_ATTR(L"local", oleGrDb->fLocalConn);
}
if (oleDb->nDrillthroughRows > 0)
CP_XML_ATTR(L"rowDrillCount", oleDb->nDrillthroughRows);
}
}
}
......
......@@ -48,6 +48,14 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeFEAT;
struct _data
{
BaseObjectPtr m_Feat;
std::vector<BaseObjectPtr> m_arContinueFrt;
};
BaseObjectPtr m_FeatHdr;
std::vector<_data> m_arFEAT;
};
} // namespace XLS
......
......@@ -31,15 +31,15 @@
*/
#include "FEAT11.h"
#include <Logic/Biff_records/FeatHdr11.h>
#include <Logic/Biff_records/Feature11.h>
#include <Logic/Biff_records/Feature12.h>
#include <Logic/Biff_records/ContinueFrt11.h>
#include <Logic/Biff_records/List12.h>
#include <Logic/Biff_records/AutoFilter12.h>
#include <Logic/Biff_records/ContinueFrt12.h>
#include <Logic/Biff_records/List12.h>
#include <Logic/Biff_unions/SORTDATA12.h>
#include "../Biff_records/FeatHdr11.h"
#include "../Biff_records/Feature11.h"
#include "../Biff_records/Feature12.h"
#include "../Biff_records/ContinueFrt11.h"
#include "../Biff_records/List12.h"
#include "../Biff_records/AutoFilter12.h"
#include "../Biff_records/ContinueFrt12.h"
#include "../Biff_records/List12.h"
#include "../Biff_unions/SORTDATA12.h"
namespace XLS
{
......@@ -112,34 +112,47 @@ const bool FEAT11::loadContent(BinProcessor& proc)
while(!elements_.empty())
{
if (elements_.front()->get_type() == typeFeature11 ||
elements_.front()->get_type() == typeFeature12 )
switch(elements_.front()->get_type())
{
_data new_data;
new_data.m_Feature = elements_.front();
m_arFEAT.push_back(new_data);
}
case typeFeature11:
case typeFeature12:
{
_data new_data;
new_data.m_Feature = elements_.front();
if (elements_.front()->get_type() == typeList12)
{
if (m_arFEAT.back().m_AutoFilter12)
m_arFEAT.back().m_arList12_second.push_back(elements_.front());
else
m_arFEAT.back().m_arList12.push_back(elements_.front());
}
if (elements_.front()->get_type() == typeAutoFilter12)
{
m_arFEAT.back().m_AutoFilter12 = elements_.front();
}
if (elements_.front()->get_type() == typeSORTDATA12)
{
m_arFEAT.back().m_SORTDATA12 = elements_.front();
m_arFEAT.push_back(new_data);
}break;
case typeList12:
{
if (m_arFEAT.back().m_AutoFilter12)
m_arFEAT.back().m_arList12_second.push_back(elements_.front());
else
m_arFEAT.back().m_arList12.push_back(elements_.front());
}break;
case typeAutoFilter12:
{
m_arFEAT.back().m_AutoFilter12 = elements_.front();
}break;
case typeSORTDATA12:
{
m_arFEAT.back().m_SORTDATA12 = elements_.front();
}break;
}
elements_.pop_front();
}
return true;
}
int FEAT11::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"table")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
}
}
return 0;
}
} // namespace XLS
......@@ -37,8 +37,6 @@
namespace XLS
{
// Logical representation of FEAT11 union of records
class FEAT11: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(FEAT11)
......@@ -49,6 +47,7 @@ public:
BaseObjectPtr clone();
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
static const ElementType type = typeFEAT11;
......
......@@ -31,9 +31,9 @@
*/
#include "FEAT.h"
#include <Logic/Biff_records/FeatHdr.h>
#include <Logic/Biff_records/Feat.h>
#include <Logic/Biff_records/ContinueFrt.h>
#include "../Biff_records/FeatHdr.h"
#include "../Biff_records/Feat.h"
#include "../Biff_records/ContinueFrt.h"
namespace XLS
{
......@@ -64,7 +64,9 @@ public:
{
return false;
}
proc.repeated<ContinueFrt>(0, 0);
int count = proc.repeated<ContinueFrt>(0, 0);
return true;
};
};
......@@ -85,8 +87,27 @@ const bool FEAT::loadContent(BinProcessor& proc)
{
return false;
}
proc.repeated<Parenthesis_FEAT_1>(0, 0);
m_FeatHdr = elements_.back();
elements_.pop_back();
int count = proc.repeated<Parenthesis_FEAT_1>(0, 0);
while(!elements_.empty())
{
if (elements_.front()->get_type() == typeFeat)
{
_data new_data;
new_data.m_Feat = elements_.front();
m_arFEAT.push_back(new_data);
}
else
{
m_arFEAT.back().m_arContinueFrt.push_back(elements_.front());
}
elements_.pop_front();
}
return true;
}
......
......@@ -77,7 +77,7 @@ const bool LBL::loadContent(BinProcessor& proc)
std::wstring name;
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L"");
if (lbl->fBuiltin) name = lbl->Name;
if (name.empty()) name = lbl->Name_bin.value();
NameCmt namecmt(name);
......@@ -139,7 +139,7 @@ int LBL::serialize(std::wostream & stream)
CP_XML_NODE(L"definedName")
{
std::wstring name;
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L"");
if (lbl->fBuiltin) name = lbl->Name;
if (name.empty()) name = lbl->Name_bin.value();
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of TABLESTYLES union of records
class TABLESTYLES: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(TABLESTYLES)
......@@ -49,7 +47,7 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeTABLESTYLES;
static const ElementType type = typeTABLESTYLES;
int serialize(std::wostream & stream);
//----------------------------------------------------------------------------------
......
......@@ -31,9 +31,10 @@
*/
#include "TABLESTYLES.h"
#include <Logic/Biff_records/TableStyles.h>
#include <Logic/Biff_records/TableStyle.h>
#include <Logic/Biff_records/TableStyleElement.h>
#include "../Biff_records/TableStyles.h"
#include "../Biff_records/TableStyle.h"
#include "../Biff_records/TableStyleElement.h"
namespace XLS
{
......@@ -103,7 +104,7 @@ const bool TABLESTYLES::loadContent(BinProcessor& proc)
if (m_arTableStyles.size() > 0)
m_arTableStyles.back().elements_.push_back(elements_.front());
}
elements_.pop_back();
elements_.pop_front();
}
return true;
}
......@@ -127,6 +128,62 @@ int TABLESTYLES::serialize(std::wostream & stream)
CP_XML_ATTR(L"defaultTableStyle", styles->rgchDefTableStyle.value());
}
for (size_t i = 0; i < m_arTableStyles.size(); i++)
{
TableStyle* style = dynamic_cast<TableStyle*>(m_arTableStyles[i].style_.get());
if (!style) continue;
CP_XML_NODE(L"tableStyle")
{
CP_XML_ATTR(L"count", m_arTableStyles[i].elements_.size());
CP_XML_ATTR(L"name", style->rgchName.value());
CP_XML_ATTR(L"pivot", style->fIsPivot);
for (size_t j = 0; j < m_arTableStyles[i].elements_.size(); j++)
{
TableStyleElement* elem = dynamic_cast<TableStyleElement*>(m_arTableStyles[i].elements_[j].get());
if (!elem) continue;
CP_XML_NODE(L"tableStyleElement")
{
CP_XML_ATTR(L"dxfId", elem->index);
switch(elem->tseType)
{
case 0x00000000: CP_XML_ATTR(L"type", L"wholeTable"); break;
case 0x00000001: CP_XML_ATTR(L"type", L"headerRow"); break;
case 0x00000002: CP_XML_ATTR(L"type", L"totalRow"); break;
case 0x00000003: CP_XML_ATTR(L"type", L"firstColumn"); break;
case 0x00000004: CP_XML_ATTR(L"type", L"lastColumn"); break;
case 0x00000005: CP_XML_ATTR(L"type", L"firstRowStripe"); break;
case 0x00000006: CP_XML_ATTR(L"type", L"secondRowStripe"); break;
case 0x00000007: CP_XML_ATTR(L"type", L"firstColumnStripe"); break;
case 0x00000008: CP_XML_ATTR(L"type", L"secondColumnStripe"); break;
case 0x00000009: CP_XML_ATTR(L"type", L"firstHeaderCell"); break;
case 0x0000000a: CP_XML_ATTR(L"type", L"lastHeaderCell"); break;
case 0x0000000b: CP_XML_ATTR(L"type", L"firstTotalCell"); break;
case 0x0000000c: CP_XML_ATTR(L"type", L"lastTotalCell"); break;
case 0x0000000d: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;//??
case 0x0000000e: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;//even
case 0x0000000f: CP_XML_ATTR(L"type", L"lastSubtotalColumn"); break;//odd
case 0x00000010: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;//??
case 0x00000011: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;//even
case 0x00000012: CP_XML_ATTR(L"type", L"lastSubtotalRow"); break;//odd
case 0x00000013: CP_XML_ATTR(L"type", L"blankRow"); break;
case 0x00000014: CP_XML_ATTR(L"type", L"firstColumnSubheading");break;
case 0x00000015: CP_XML_ATTR(L"type", L"firstColumnSubheading");break;
case 0x00000016: CP_XML_ATTR(L"type", L"lastColumnSubheading"); break;
case 0x00000017: CP_XML_ATTR(L"type", L"firstRowSubheading"); break;
case 0x00000018: CP_XML_ATTR(L"type", L"firstRowSubheading"); break;
case 0x00000019: CP_XML_ATTR(L"type", L"lastRowSubheading"); break;
case 0x0000001a: CP_XML_ATTR(L"type", L"pageFieldLabels"); break;
case 0x0000001b: CP_XML_ATTR(L"type", L"pageFieldValues"); break;
}
}
}
}
}
}
}
return 0;
......
......@@ -129,9 +129,9 @@ int WINDOW::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"view", L"pageLayout");
}
if ((window2->topLeftCell.value()) && (*window2->topLeftCell.value() != L"A1"))
if (window2->topLeftCell != L"A1")
{
CP_XML_ATTR(L"topLeftCell", *window2->topLeftCell.value());
CP_XML_ATTR(L"topLeftCell", window2->topLeftCell);
}
if ( window2->icvHdr != (_UINT16)64)
{
......@@ -159,8 +159,8 @@ int WINDOW::serialize(std::wostream & stream)
if (pane->x != (_INT32)0) CP_XML_ATTR(L"xSplit", pane->x);
if (pane->y != (_INT32)0) CP_XML_ATTR(L"ySplit", pane->y);
if ((pane->topLeftCell.value()) && (*pane->topLeftCell.value() != L"A1"))
CP_XML_ATTR(L"topLeftCell", *pane->topLeftCell.value());
if (pane->topLeftCell != L"A1")
CP_XML_ATTR(L"topLeftCell", pane->topLeftCell);
switch(pane->pnnAcct)
{
case PaneType::REVTPNNBOTRIGHT: CP_XML_ATTR(L"activePane", L"bottomRight"); break;
......
......@@ -87,6 +87,8 @@ int CommonSubstream::serialize_format(std::wostream & strm)
SheetExt *sheet_ext = dynamic_cast<SheetExt*>(m_SheetExt.get());
CodeName *code_name = dynamic_cast<CodeName*>(m_CodeName.get());
if (!code_name || !sheet_ext) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"sheetPr")
......
......@@ -692,7 +692,7 @@ void GlobalsSubstream::UpdateDefineNames()
std::wstring name;
std::wstring comment;
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L"");
if (lbl->fBuiltin) name = lbl->Name;
if (name.empty()) name = lbl->Name_bin.value();
NameCmt *namecmt = dynamic_cast<NameCmt*>(LBL_->m_NameCmt.get());
......
......@@ -593,6 +593,9 @@ enum ElementType
typeFactoidData,
typeFeat11FdaAutoFilter,
typeFeat11FieldDataItem,
typeFeat11RgSharepointIdDel,
typeFeat11RgSharepointIdChange,
typeFeat11RgInvalidCells,
typeFeatFormulaErr2,
typeFeatProtection,
typeFeatSmartTag,
......
......@@ -63,6 +63,8 @@
#include "../XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h"
#include "../XlsFormat/Logic/Biff_unions/SUPBOOK.h"
#include "../XlsFormat/Logic/Biff_unions/QUERYTABLE.h"
#include "../XlsFormat/Logic/Biff_unions/FEAT.h"
#include "../XlsFormat/Logic/Biff_unions/FEAT11.h"
#include "../XlsFormat/Logic/Biff_records/BkHim.h"
#include "../XlsFormat/Logic/Biff_records/HLink.h"
......@@ -73,6 +75,9 @@
#include "../XlsFormat/Logic/Biff_records/IMDATA.h"
#include "../XlsFormat/Logic/Biff_records/Note.h"
#include "../XlsFormat/Logic/Biff_records/WsBool.h"
#include "../XlsFormat/Logic/Biff_records/FeatHdr11.h"
#include "../XlsFormat/Logic/Biff_records/Feature11.h"
#include "../XlsFormat/Logic/Biff_records/Feature12.h"
#include "../XlsFormat/Logic/Biff_structures/URLMoniker.h"
#include "../XlsFormat/Logic/Biff_structures/FileMoniker.h"
......@@ -448,21 +453,21 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
{
xlsx_context->start_table();
xlsx_context->start_sheet();
convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
xlsx_context->end_table();
xlsx_context->end_sheet();
}
for (size_t i = 0 ; i < woorkbook->m_arChartSheetSubstream.size(); i++)
{
xlsx_context->start_table();
xlsx_context->start_sheet();
convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arChartSheetSubstream[i].get()));
xlsx_context->end_table();
xlsx_context->end_sheet();
}
for (size_t i = 0 ; i < woorkbook->m_arMacroSheetSubstream.size(); i++)
{
xlsx_context->start_table();
xlsx_context->start_sheet();
convert(dynamic_cast<XLS::MacroSheetSubstream*>(woorkbook->m_arMacroSheetSubstream[i].get()));
xlsx_context->end_table();
xlsx_context->end_sheet();
}
for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); it++)
......@@ -535,6 +540,16 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
{
convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get());
}
//for (size_t i = 0 ; i < sheet->m_arFEAT.size(); i++)
//{
// convert(dynamic_cast<XLS::FEAT*>(sheet->m_arFEAT.get()));
//}
for (size_t i = 0 ; i < sheet->m_arFEAT11.size(); i++)
{
convert(dynamic_cast<XLS::FEAT11*>(sheet->m_arFEAT11[i].get()));
}
}
void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
......@@ -545,10 +560,10 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
if (name.empty())
name = L"Sheet_" + std::to_wstring(sheet->ws_index_ + 1);
xlsx_context->set_table_type(1);
xlsx_context->set_table_name(name) ;
xlsx_context->set_table_id(sheet->ws_index_ + 1);
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state);
xlsx_context->set_sheet_type(1);
xlsx_context->set_sheet_name(name) ;
xlsx_context->set_sheet_id(sheet->ws_index_ + 1);
xlsx_context->set_sheet_state(xls_global_info->sheets_info[sheet->ws_index_].state);
if (sheet->m_GLOBALS)
{
......@@ -562,7 +577,7 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
globals->m_DxGCol = sheet->m_DxGCol;
if (globals->is_dialog)
xlsx_context->set_table_type(2);
xlsx_context->set_sheet_type(2);
}
convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet));
......@@ -630,10 +645,10 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
if (name.empty())
name = L"MacroSheet_" + std::to_wstring(sheet->ws_index_ + 1);
xlsx_context->set_table_type(4);
xlsx_context->set_table_name(name) ;
xlsx_context->set_table_id(sheet->ws_index_ + 1);
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state);
xlsx_context->set_sheet_type(4);
xlsx_context->set_sheet_name(name) ;
xlsx_context->set_sheet_id(sheet->ws_index_ + 1);
xlsx_context->set_sheet_state(xls_global_info->sheets_info[sheet->ws_index_].state);
if (sheet->m_GLOBALS)
{
......@@ -647,7 +662,7 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
globals->m_DxGCol = sheet->m_DxGCol;
if (globals->is_dialog)
xlsx_context->set_table_type(2);
xlsx_context->set_sheet_type(2);
}
convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet));
......@@ -728,10 +743,10 @@ void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream* chartsheet)
if (name.empty())
name = L"ChartSheet_" + std::to_wstring(chartsheet->ws_index_ + 1);
xlsx_context->set_table_type(3);
xlsx_context->set_table_name(name) ;
xlsx_context->set_table_id(chartsheet->ws_index_ + 1);
xlsx_context->set_table_state(xls_global_info->sheets_info[chartsheet->ws_index_].state);
xlsx_context->set_sheet_type(3);
xlsx_context->set_sheet_name(name) ;
xlsx_context->set_sheet_id(chartsheet->ws_index_ + 1);
xlsx_context->set_sheet_state(xls_global_info->sheets_info[chartsheet->ws_index_].state);
convert_common(dynamic_cast<XLS::CommonSubstream*>(chartsheet));
......@@ -976,11 +991,41 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int star
WriteMediaFile(art_bstore->rgfb[i]->pict_data, art_bstore->rgfb[i]->pict_size, art_bstore->rgfb[i]->pict_type, bin_id);
}
}
void XlsConverter::convert(XLS::FEAT11 * shared_feature)
{
if (!shared_feature) return;
xlsx_context->start_table();
std::wstringstream strm;
shared_feature->serialize(strm);
xlsx_context->get_tables_context().add_table(strm.str());
xlsx_context->end_table();
//XLS::FeatHdr11 * feature = dynamic_cast<XLS::FeatHdr11*>(shared_feature->m_FeatHdr11.get());
//for (size_t i = 0; i < shared_feature->m_arFEAT.size(); i++)
//{
// XLS::Feature11 * feature11 = dynamic_cast<XLS::Feature11*>(shared_feature->m_arFEAT[i].m_Feature.get());
// XLS::Feature12 * feature12 = dynamic_cast<XLS::Feature12*>(shared_feature->m_arFEAT[i].m_Feature.get());
//
// if (feature11)
// {
// }
// else if (feature12)
// {
// }
//}
}
void XlsConverter::convert(XLS::HLINK * HLINK_)
{
if (!HLINK_) return;
XLS::HLink * hLink = dynamic_cast<XLS::HLink*>(HLINK_->m_HLink.get());
if (!hLink) return;
std::wstring target;
bool bExternal = false;
......@@ -999,7 +1044,7 @@ void XlsConverter::convert(XLS::HLINK * HLINK_)
if (display.empty()) display = target;
xlsx_context->get_table_context().add_hyperlink( hLink->ref8.toString(), target, display, bExternal);
xlsx_context->get_sheet_context().add_hyperlink( hLink->ref8.toString(), target, display, bExternal);
}
void XlsConverter::convert(XLS::LBL * def_name)
......
......@@ -79,6 +79,7 @@ namespace XLS
class PIVOTCACHEDEFINITION;
class SUPBOOK;
class QUERYTABLE;
class FEAT11;
class Note;
class TxO;
......@@ -135,6 +136,7 @@ public:
void convert(XLS::PIVOTCACHEDEFINITION * pivot_cached);
void convert(XLS::SUPBOOK * external);
void convert(XLS::QUERYTABLE * query_table);
void convert(XLS::FEAT11 * shared_feature);
void convert(ODRAW::OfficeArtRecord * art);
void convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int start_id = 0);
......
......@@ -33,7 +33,7 @@
#include "external_items.h"
#include <utils.h>
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
#include "oox_rels.h"
#include "mediaitems_utils.h"
......
......@@ -29,7 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
#include "oox_content_type.h"
#include "namespaces.h"
......
......@@ -34,9 +34,9 @@
#include <boost/foreach.hpp>
#include "namespaces.h"
#include "mediaitems_utils.h"
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
namespace oox {
......
......@@ -34,8 +34,6 @@
#include <vector>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/make_shared.hpp>
#include <simple_xml_writer.h>
......
......@@ -32,12 +32,9 @@
#include "xlsx_comments_context.h"
#include <boost/foreach.hpp>
#include <iostream>
#include <boost/lexical_cast.hpp>
namespace oox {
class xlsx_comments;
......
......@@ -33,20 +33,17 @@
#include "xlsx_conversion_context.h"
#include <iostream>
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
#include "xlsx_package.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace oox {
xlsx_conversion_context::xlsx_conversion_context( package::xlsx_document * outputDocument) : output_document_(outputDocument),
next_vml_file_id_ ( 1 ),
table_context_ ( *this ),
sheet_context_ ( *this ),
xlsx_drawing_context_handle_ ( next_vml_file_id_, get_mediaitems())
{
}
......@@ -56,7 +53,7 @@ xlsx_conversion_context::~xlsx_conversion_context()
xlsx_comments_context & xlsx_conversion_context::get_comments_context()
{
return get_table_context().get_comments_context();
return get_sheet_context().get_comments_context();
}
xlsx_comments_context_handle & xlsx_conversion_context::get_comments_context_handle()
......@@ -66,7 +63,7 @@ xlsx_comments_context_handle & xlsx_conversion_context::get_comments_context_han
xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
{
return get_table_context().get_drawing_context();
return get_sheet_context().get_drawing_context();
}
void xlsx_conversion_context::start_document()
......@@ -118,38 +115,58 @@ oox_activeX_context & xlsx_conversion_context::current_activeX()
throw std::runtime_error("internal error");
}
}
bool xlsx_conversion_context::start_table()
bool xlsx_conversion_context::start_sheet()
{
sheets_.push_back(xlsx_xml_worksheet::create());
get_table_context().start_table();
get_sheet_context().start_table();
return true;
}
void xlsx_conversion_context::set_table_type(int type)
void xlsx_conversion_context::set_sheet_type(int type)
{
if (sheets_.empty()) return;
sheets_.back()->type = type;
if (type == 3)
{
get_table_context().set_chart_view();
get_sheet_context().set_chart_view();
}
}
void xlsx_conversion_context::start_table()
{
}
void xlsx_conversion_context::end_table()
{
int index = tables_context_.get_count();
std::wstring rid = L"tpId" + std::to_wstring(index);
current_sheet().sheet_rels().add(oox::relationship(rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
L"../tables/table" + std::to_wstring(index) +L".xml"));
CP_XML_WRITER(current_sheet().tableParts())
{
CP_XML_NODE(L"tablePart")
{
CP_XML_ATTR(L"r:id", rid);
}
}
}
void xlsx_conversion_context::set_table_name(const std::wstring & name)
void xlsx_conversion_context::set_sheet_name(const std::wstring & name)
{
if (name.empty()) return;
sheets_.back()->name = name;
}
void xlsx_conversion_context::set_table_state(const std::wstring & state)
void xlsx_conversion_context::set_sheet_state(const std::wstring & state)
{
if (state.empty()) return;
sheets_.back()->state = state;
}
void xlsx_conversion_context::set_table_id(int id)
void xlsx_conversion_context::set_sheet_id(int id)
{
if (id < 0) return;
sheets_.back()->id = id;
......@@ -186,17 +203,17 @@ void xlsx_conversion_context::end_external()
}
void xlsx_conversion_context::end_table()
void xlsx_conversion_context::end_sheet()
{
get_table_context().serialize_ole_objects (current_sheet().ole_objects());
get_table_context().serialize_controls (current_sheet().activeXs());
get_sheet_context().serialize_ole_objects (current_sheet().ole_objects());
get_sheet_context().serialize_controls (current_sheet().activeXs());
get_table_context().dump_rels_drawing(current_sheet().sheet_rels());
get_sheet_context().dump_rels_drawing(current_sheet().sheet_rels());
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
get_sheet_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_sheet_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
get_table_context().end_table();
get_sheet_context().end_table();
}
xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle()
......@@ -439,7 +456,19 @@ void xlsx_conversion_context::end_document()
}
}
int table_parts_count = tables_context_.get_count();
if (table_parts_count > 0)
{
for (int i = 0; i < table_parts_count; i++)
{
package::table_part_content_ptr content = package::table_part_content::create();
tables_context_.dump_rels(i, content->get_rels());
tables_context_.write_to(i, content->content());
output_document_->get_xl_files().add_table_part(content);
}
}
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
output_document_->content_type().set_media(get_mediaitems());
......
......@@ -37,13 +37,14 @@
#include "common.h"
#include "xlsx_textcontext.h"
#include "xlsx_tablecontext.h"
#include "xlsx_sheet_context.h"
#include "xlsx_drawing_context.h"
#include "xlsx_chart_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_pivots_context.h"
#include "xlsx_external_context.h"
#include "xlsx_activeX_context.h"
#include "xlsx_tablecontext.h"
#include "xlsx_output_xml.h"
......@@ -66,16 +67,19 @@ public:
void start_document();
void end_document();
bool start_table();
void set_table_state(const std::wstring & state);
void set_table_type(int type);
void set_table_name(const std::wstring & name);
void set_table_id(int id);
void end_table();
bool start_sheet();
void set_sheet_state(const std::wstring & state);
void set_sheet_type(int type);
void set_sheet_name(const std::wstring & name);
void set_sheet_id(int id);
void end_sheet();
void start_chart();
void end_chart(){}
void start_table();
void end_table();
std::wstring start_activeX();
void end_activeX(){}
......@@ -89,7 +93,7 @@ public:
std::wostream & workbook_format() { return xlsx_workbook_pr_; }
xlsx_text_context & get_text_context() { return text_context_; }
xlsx_table_context & get_table_context() { return table_context_; }
xlsx_sheet_context & get_sheet_context() { return sheet_context_; }
xlsx_xml_worksheet & current_sheet();
oox_chart_context & current_chart();
......@@ -101,6 +105,7 @@ public:
xlsx_drawing_context_handle & get_drawing_context_handle();
xlsx_comments_context & get_comments_context();
xlsx_comments_context_handle & get_comments_context_handle();
xlsx_tables_context & get_tables_context() {return tables_context_;}
external_items & get_mediaitems() { return mediaitems_; }
......@@ -114,9 +119,10 @@ private:
package::xlsx_document *output_document_;
external_items mediaitems_;
xlsx_table_context table_context_;
xlsx_sheet_context sheet_context_;
xlsx_text_context text_context_;
xlsx_pivots_context pivots_context_;
xlsx_tables_context tables_context_;
std::vector<oox_chart_context_ptr> charts_;
std::vector<oox_external_context_ptr> externals_;
......
......@@ -33,7 +33,7 @@
#include "xlsx_output_xml.h"
#include <boost/make_shared.hpp>
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
namespace oox {
......@@ -64,6 +64,7 @@ public:
std::wstringstream picture_background_;
std::wstringstream dataValidations_;
std::wstringstream protection_;
std::wstringstream tableParts_;
rels rels_;
......@@ -171,7 +172,10 @@ std::wostream & xlsx_xml_worksheet::protection()
{
return impl_->protection_;
}
std::wostream & xlsx_xml_worksheet::tableParts()
{
return impl_->tableParts_;
}
//-----------------------------------------------------------------
rels & xlsx_xml_worksheet::sheet_rels()
{
......@@ -269,6 +273,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
}
}
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
//CP_XML_NODE(L"rowBreaks){}
//CP_XML_NODE(L"colBreaks){}
......
......@@ -72,6 +72,7 @@ public:
std::wostream & picture_background();
std::wostream & dataValidations();
std::wostream & protection();
std::wostream & tableParts();
rels & sheet_rels();//hyperlink, background image, external, media ...
......
......@@ -110,6 +110,15 @@ _CP_PTR(pivot_table_content) pivot_table_content::create()
return boost::make_shared<pivot_table_content>();
}
//--------------------------------------------------------------------------------------------
table_part_content::table_part_content() : rels_file_(rels_file::create(L""))
{
}
_CP_PTR(table_part_content) table_part_content::create()
{
return boost::make_shared<table_part_content>();
}
//--------------------------------------------------------------------------------------------
external_content::external_content() : rels_file_(rels_file::create(L""))
{
}
......@@ -258,6 +267,10 @@ void xl_files::write(const std::wstring & RootPath)
pivot_table_files_.set_main_document(get_main_document());
pivot_table_files_.write(path);
}
{
table_part_files_.set_main_document(get_main_document());
table_part_files_.write(path);
}
{
sheets_files_.set_rels(&rels_files_);
sheets_files_.set_main_document( this->get_main_document() );
......@@ -437,6 +450,10 @@ void xl_files::add_control_props (simple_element_ptr element)
{
control_props_files_.add_control_props(element);
}
void xl_files::add_table_part(table_part_content_ptr table)
{
table_part_files_.add_table_part(table);
}
//----------------------------------------------------------------------------------------
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
{
......@@ -528,6 +545,43 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
}
}
//----------------------------------------------------------------------------------------
void xl_table_part_files::add_table_part(table_part_content_ptr table)
{
table_parts_.push_back(table);
}
void xl_table_part_files::write(const std::wstring & RootPath)
{
if (table_parts_.empty()) return;
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"tables";
NSDirectory::CreateDirectory(path.c_str());
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
for (size_t i = 0; i < table_parts_.size(); i++)
{
if (!table_parts_[i]) continue;
const std::wstring fileName = std::wstring(L"table") + std::to_wstring(i + 1) + L".xml";
contentTypes.add_override(std::wstring(L"/xl/tables/") + fileName, kWSConType);
package::simple_element(fileName, table_parts_[i]->str()).write(path);
if (table_parts_[i]->get_rels().empty() == false)
{
rels_files relFiles;
table_parts_[i]->rels_file_->set_file_name(fileName + L".rels");
relFiles.add_rel_file(table_parts_[i]->rels_file_);
relFiles.write(path);
}
}
}
//----------------------------------------------------------------------------------------
void xl_charts_files::add_chart(chart_content_ptr chart)
{
charts_.push_back(chart);
......
......@@ -110,6 +110,24 @@ private:
};
typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr;
//------------------------------------------------------------------------
class table_part_content : boost::noncopyable
{
public:
table_part_content();
static _CP_PTR(table_part_content) create();
std::wostream & content() { return content_; }
rels & get_rels() { return rels_file_->get_rels(); }
std::wstring str() { return content_.str(); }
friend class xl_table_part_files;
private:
std::wstringstream content_;
rels_file_ptr rels_file_;
};
typedef _CP_PTR(table_part_content) table_part_content_ptr;
//------------------------------------------------------------------------
class external_content : boost::noncopyable
{
public:
......@@ -235,6 +253,16 @@ public:
std::vector<pivot_table_content_ptr> pivot_tables_;
};
class xl_table_part_files : public element
{
public:
xl_table_part_files(){}
void add_table_part(table_part_content_ptr table);
virtual void write(const std::wstring & RootPath);
std::vector<table_part_content_ptr> table_parts_;
};
class xl_pivot_cache_files : public element
{
public:
......@@ -323,6 +351,7 @@ public:
void add_pivot_table (pivot_table_content_ptr table);
void add_query_table (simple_element_ptr element);
void add_control_props (simple_element_ptr element);
void add_table_part (table_part_content_ptr table);
void add_vba_project ();
void add_attachedToolbars();
private:
......@@ -335,6 +364,7 @@ private:
xl_activeX_files activeXs_files_;
xl_query_table_files query_tables_files_;
xl_control_props_files control_props_files_;
xl_table_part_files table_part_files_;
element_ptr theme_;
element_ptr workbook_;
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "xlsx_sheet_context.h"
#include "xlsx_textcontext.h"
#include "xlsx_conversion_context.h"
#include <sstream>
#include <simple_xml_writer.h>
namespace oox {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
table_state::table_state(xlsx_conversion_context & Context) : drawing_context_(Context), comments_context_(Context.get_comments_context_handle())
{
}
table_state_ptr & xlsx_sheet_context::state()
{
return tables_state_.back();
}
xlsx_sheet_context::xlsx_sheet_context(xlsx_conversion_context & Context) : context_(Context)
{
}
void xlsx_sheet_context::start_table()
{
tables_state_.push_back( table_state_ptr(new table_state(context_)));
}
void xlsx_sheet_context::set_chart_view()
{
CP_XML_WRITER(context_.current_sheet().sheetViews())
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"showGridLines", 0);
CP_XML_ATTR(L"workbookViewId", 0);
}
}
}
}
void xlsx_sheet_context::end_table()
{
if (!get_drawing_context().empty())
{
std::wstringstream strm;
get_drawing_context().serialize(strm);
const std::pair<std::wstring, std::wstring> drawingName =
context_.get_drawing_context_handle().add_drawing_xml(strm.str(), get_drawing_context().get_rels());
context_.current_sheet().set_drawing_link(drawingName.first, drawingName.second);
CP_XML_WRITER(context_.current_sheet().drawing())
{
CP_XML_NODE(L"drawing")
{
CP_XML_ATTR(L"r:id", drawingName.second);
}
}
}
if (!get_drawing_context().empty_vml_HF())
{
std::wstringstream strm;
get_drawing_context().serialize_vml_HF(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_HF_rels());
context_.current_sheet().set_vml_HF_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_drawing_context().empty_vml())
{
std::wstringstream strm;
get_drawing_context().serialize_vml(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_rels());
context_.current_sheet().set_vml_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_comments_context().empty())
{
std::wstringstream strm;
get_comments_context().write_comments(strm);
const std::pair<std::wstring, std::wstring> commentsName =
context_.get_comments_context_handle().add_comments_xml(strm.str(), context_.get_comments_context().get_comments());
context_.current_sheet().set_comments_link(commentsName.first, commentsName.second);
}
}
xlsx_drawing_context & xlsx_sheet_context::get_drawing_context()
{
return state()->drawing_context_;
}
xlsx_comments_context & xlsx_sheet_context::get_comments_context()
{
return state()->comments_context_;
}
std::wstring xlsx_sheet_context::add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal)
{
return state()->hyperlinks_.add( ref, target, display, bExternal);
}
void xlsx_sheet_context::dump_rels_hyperlinks(rels & Rels)
{
state()->hyperlinks_.dump_rels(Rels);
}
void xlsx_sheet_context::serialize_hyperlinks(std::wostream & _Wostream)
{
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_sheet_context::dump_rels_drawing(rels & Rels)
{
xlsx_drawings_rels_ptr drawing_rels = state()->drawing_context_.get_sheet_rels();
drawing_rels->dump_rels(Rels);
}
void xlsx_sheet_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
void xlsx_sheet_context::serialize_controls(std::wostream & strm)
{
state()->drawing_context_.serialize_controls(strm);
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <list>
#include "xlsx_drawing_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_hyperlinks.h"
namespace oox {
class xlsx_conversion_context;
class xlsx_text_context;
struct table_state
{
table_state(xlsx_conversion_context & Context);
xlsx_hyperlinks hyperlinks_;
xlsx_drawing_context drawing_context_;
xlsx_comments_context comments_context_;
};
typedef _CP_PTR(table_state) table_state_ptr;
class xlsx_sheet_context
{
public:
xlsx_sheet_context(xlsx_conversion_context & Context);
void start_table();
void set_chart_view();
void end_table();
xlsx_drawing_context & get_drawing_context();
xlsx_comments_context & get_comments_context();
//
table_state_ptr & state();
std::wstring add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_hyperlinks(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
void serialize_controls(std::wostream & _Wostream);
void dump_rels_drawing(rels & Rels);
private:
xlsx_conversion_context & context_;
std::list<table_state_ptr> tables_state_;
};
}
......@@ -31,137 +31,47 @@
*/
#include "xlsx_tablecontext.h"
#include "xlsx_textcontext.h"
#include "xlsx_conversion_context.h"
#include <boost/foreach.hpp>
#include <sstream>
#include "simple_xml_writer.h"
#include <boost/make_shared.hpp>
#include <simple_xml_writer.h>
namespace oox {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
table_state::table_state(xlsx_conversion_context & Context) : drawing_context_(Context), comments_context_(Context.get_comments_context_handle())
{
}
table_state_ptr & xlsx_table_context::state()
{
return tables_state_.back();
}
xlsx_table_context::xlsx_table_context(xlsx_conversion_context & Context) : context_(Context)
{
}
void xlsx_table_context::start_table()
class xlsx_tables_context::Impl
{
tables_state_.push_back( table_state_ptr(new table_state(context_)));
}
public:
Impl() {}
std::vector<std::wstring> tables_;
};
void xlsx_table_context::set_chart_view()
xlsx_tables_context::xlsx_tables_context() : impl_(new xlsx_tables_context::Impl())
{
CP_XML_WRITER(context_.current_sheet().sheetViews())
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"showGridLines", 0);
CP_XML_ATTR(L"workbookViewId", 0);
}
}
}
}
void xlsx_table_context::end_table()
void xlsx_tables_context::add_table(std::wstring table)
{
if (!get_drawing_context().empty())
{
std::wstringstream strm;
get_drawing_context().serialize(strm);
const std::pair<std::wstring, std::wstring> drawingName =
context_.get_drawing_context_handle().add_drawing_xml(strm.str(), get_drawing_context().get_rels());
context_.current_sheet().set_drawing_link(drawingName.first, drawingName.second);
CP_XML_WRITER(context_.current_sheet().drawing())
{
CP_XML_NODE(L"drawing")
{
CP_XML_ATTR(L"r:id", drawingName.second);
}
}
}
if (!get_drawing_context().empty_vml_HF())
{
std::wstringstream strm;
get_drawing_context().serialize_vml_HF(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_HF_rels());
context_.current_sheet().set_vml_HF_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_drawing_context().empty_vml())
{
std::wstringstream strm;
get_drawing_context().serialize_vml(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_rels());
context_.current_sheet().set_vml_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_comments_context().empty())
{
std::wstringstream strm;
get_comments_context().write_comments(strm);
const std::pair<std::wstring, std::wstring> commentsName =
context_.get_comments_context_handle().add_comments_xml(strm.str(), context_.get_comments_context().get_comments());
if (table.empty()) return;
context_.current_sheet().set_comments_link (commentsName.first, commentsName.second);
}
impl_->tables_.push_back(table);
}
xlsx_drawing_context & xlsx_table_context::get_drawing_context()
void xlsx_tables_context::dump_rels(int index, rels & Rels)
{
return state()->drawing_context_;
}
xlsx_comments_context & xlsx_table_context::get_comments_context()
{
return state()->comments_context_;
}
std::wstring xlsx_table_context::add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal)
void xlsx_tables_context::write_to(int index, std::wostream & strm)
{
return state()->hyperlinks_.add( ref, target, display, bExternal);
strm << impl_->tables_[index];
}
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels)
int xlsx_tables_context::get_count()
{
state()->hyperlinks_.dump_rels(Rels);
return (int)impl_->tables_.size();
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_table_context::dump_rels_drawing(rels & Rels)
{
xlsx_drawings_rels_ptr drawing_rels = state()->drawing_context_.get_sheet_rels();
drawing_rels->dump_rels(Rels);
}
void xlsx_table_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
void xlsx_table_context::serialize_controls(std::wostream & strm)
xlsx_tables_context::~xlsx_tables_context()
{
state()->drawing_context_.serialize_controls(strm);
}
}
......@@ -31,56 +31,30 @@
*/
#pragma once
#include <list>
#include "xlsx_drawing_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_hyperlinks.h"
#include "oox_package.h"
namespace oox {
class xlsx_conversion_context;
class xlsx_text_context;
struct table_state
{
table_state(xlsx_conversion_context & Context);
xlsx_hyperlinks hyperlinks_;
xlsx_drawing_context drawing_context_;
xlsx_comments_context comments_context_;
class xlsx_tables_context;
typedef _CP_PTR(xlsx_tables_context) xlsx_tables_context_ptr;
};
typedef _CP_PTR(table_state) table_state_ptr;
class xlsx_table_context
class xlsx_tables_context
{
public:
xlsx_table_context(xlsx_conversion_context & Context);
xlsx_tables_context();
~xlsx_tables_context();
void start_table();
void set_chart_view();
void end_table();
void add_table(std::wstring table);
void write_to (int index, std::wostream & strm);
void dump_rels(int index, rels & Rels);
xlsx_drawing_context & get_drawing_context();
xlsx_comments_context & get_comments_context();
//
table_state_ptr & state();
int get_count();
std::wstring add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_hyperlinks(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
void serialize_controls(std::wostream & _Wostream);
void dump_rels_drawing(rels & Rels);
private:
xlsx_conversion_context & context_;
std::list<table_state_ptr> tables_state_;
class Impl;
_CP_PTR(Impl) impl_;
};
}
......@@ -36,9 +36,7 @@
#include <iostream>
#include <list>
#include <boost/foreach.hpp>
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
#include "utils.h"
namespace oox {
......
......@@ -842,6 +842,7 @@ SOURCES += \
../XlsXlsxConverter/xlsx_textcontext.cpp \
../XlsXlsxConverter/xlsx_chart_context.cpp \
../XlsXlsxConverter/xlsx_pivots_context.cpp \
../XlsXlsxConverter/xlsx_sheet_context.cpp \
../XlsXlsxConverter/xlsx_external_context.cpp \
../XlsXlsxConverter/xlsx_activeX_context.cpp \
../XlsXlsxConverter/xlsx_comments.cpp \
......@@ -1601,6 +1602,7 @@ HEADERS += \
../XlsXlsxConverter/xlsx_conversion_context.h \
../XlsXlsxConverter/xlsx_drawing_context.h \
../XlsXlsxConverter/xlsx_drawings.h \
../XlsXlsxConverter/xlsx_sheet_context.cpp \
../XlsXlsxConverter/xlsx_pivots_context.cpp \
../XlsXlsxConverter/xlsx_hyperlinks.h \
../XlsXlsxConverter/xlsx_output_xml.h \
......
......@@ -440,6 +440,14 @@
RelativePath="..\XlsXlsxConverter\xlsx_pivots_context.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_sheet_context.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_sheet_context.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_tablecontext.cpp"
>
......
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